Powered by Blogger.

Thay đổi module sản phẩm mới blocknewproducts trong PrestaShop

Thay đổi module sản phẩm mới blocknewproducts để hiển thị sản phẩm với hình ảnh và nút đặt hàng nhằm thu hút khách hàng hơn.
Mặc định khi cài module sản phẩm mới blocknewproducts thì module này chỉ hiện thị 1 block bao gồm 4 hình ảnh sản phẩm mới nhất.
1 block bao gồm 1 danh sách 5 text link sản phẩm mới.



Bạn có thể thay đổi module này để hiển thị nhiều sản phẩm mới với hình ảnh sản phẩm, nút đặt hàng hoặc hiển thị sản phẩm ngẫu nhiên.

Xem hình trên (click vào hình để phóng to).
Mở file /modules/blocknewproducts.tpl.
Sửa code như sau:

 <!-- MODULE Block new products -->
<div id="new-products_block_right" class="block products_block">
 <h4><a href="{$base_dir}new-products.php" title="{l s='New products' mod='blocknewproducts'}">{l s='New products' mod='blocknewproducts'}</a></h4>
 <div class="block_content">
 {if $new_products}
 <ul class="product_images">
 <li><a href="{$new_products.0.link}" title="{$new_products.0.legend}"><img src="{$img_prod_dir}{$new_products.0.id_image}-medium.jpg" alt="{$new_products.0.legend}"></a></li>
 </ul>
 <dl class="ajax_block_product">
 <dt class="first_item"><a href="{$new_products.0.link}" title="{$new_products.0.name}">{$new_products.0.name}</a></dt>
 {if $new_products.0.description_short}<dd class="first_item"><a href="{$new_products.0.link}">{$new_products.0.description_short|strip_tags:'UTF-8'|truncate:50}</a>&nbsp;{/if}<a class="add_to_cart_mini ajax_add_to_cart_button" rel="ajax_id_product_{$new_products.0.id_product}" href="{$base_dir}cart.php?qty=1&id;_product={$new_products.0.id_product}&token;={$static_token}&add;" title="{l s='Add to cart' mod='homefeatured'}">
<img src="{$img_dir}icon/cart.gif"></img></a></dd>
 </dl>
 {if $new_products.1}
 <ul class="product_images">
 <li><a href="{$new_products.1.link}" title="{$new_products.1.legend}"><img src="{$img_prod_dir}{$new_products.1.id_image}-medium.jpg" alt="{$new_products.1.legend}"></a></li>
 </ul>

 <dl class="ajax_block_product">
 <dt class="first_item">
<a href="{$new_products.1.link}" title="{$new_products.1.name}">{$new_products.1.name}</a></dt>
 {if $new_products.1.description_short}<dd class="first_item">
<a href="{$new_products.1.link}">{$new_products.1.description_short|strip_tags:'UTF-8'|truncate:50}</a>&nbsp;{/if}
<a class="add_to_cart_mini ajax_add_to_cart_button" rel="ajax_id_product_{$new_products.1.id_product}" href="{$base_dir}cart.php?qty=1&id;_product={$new_products.1.id_product}&token;={$static_token}&add;" title="{l s='Add to cart' mod='homefeatured'}">
<img src="{$img_dir}icon/cart.gif"></img></a></dd>
 </dl>{/if}
 <p><a href="{$base_dir}new-products.php" title="{l s='All new products' mod='blocknewproducts'}" class="button_large">{l s='All new products' mod='blocknewproducts'}</a></p>
 {else}
 <p>{l s='No new product at this time' mod='blocknewproducts'}</p>
 {/if}
 </div>
</div>
<!-- /MODULE Block new products by SOTEW--> 

Sửa File global.css dòng 114
/prestashop/themes/your-theme/global.css

#new-products_block_right dt a 
{ font-size:0.8em; font-weight:bold; } 
bằng#new-products_block_right dt a 
{ font-weight:bold; }     
/* MODIFY blocknewproducts BACK : 
#new-products_block_right dt a 
{ font-size:0.8em; font-weight:bold; 
}*/
#new-products_block_right dd a 
{ font-size:0.8em; }     

#new-products_block_right ul.product_images 
{ padding-left: 48px; } 

Download (uploading)
Tham khảo từ bài viết của SotEW/ PrestaShop Forums
http://www.prestashop.com/forums/viewthread/4897/P15/
    Blogger Comment
    Facebook Comment