首 页  >>  E商学院  >>  zencart百科  >>  给首页New Products,featured products模块加上add to cart按钮

给首页New Products,featured products模块加上add to cart按钮

给首页三大模块加上add to cart按钮,让客户能够快速购物。

1,给New Products模块加按钮

打开文件includes\modules\new_products.php,搜索

  1. $products_price = zen_get_products_display_price($new_products->fields['products_id']);  

 

在下面加上两行:

  1. $products_desc = substr(strip_tags(trim(zen_get_products_description($new_products->fields['products_id'], $_SESSION['languages_id']))),0,100).'…';   
  2. $buy_now_link = zen_get_buy_now_button($new_products->fields['products_id'],'<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) .'<br/>'.'</a>&nbsp;<br /');  

 

其中按钮的变量是$buy_now_link,把它安置在自己想要的地方即可,我是加在$products_price后面的。其中$products_desc是产品描述,如果需要也可以添加上去

 

2,给featured products模块加上按钮

打开文件includes\modules\featured_products.php,搜索

  1. $products_price = zen_get_products_display_price($featured_products->fields['products_id']);  

 

然后在下面加上两行

  1. $products_desc = substr(strip_tags(trim(zen_get_products_description($featured_products->fields['products_id'], $_SESSION['languages_id']))),0,100).'&hellip;';   
  2. $buy_now_link = zen_get_buy_now_button($featured_products->fields['products_id'],'<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) .'<br/>'.'</a>&nbsp;<br /');  

 

就大功告成了!


点击次数:691  发布日期:2014-05-22  【打印此页】  【关闭