首页建站经验 直接在zencart首页的最新商品上面加上直接购买按钮

直接在zencart首页的最新商品上面加上直接购买按钮

在zencart首页的最新商品上面要添加"购买"按钮,可以参考最模板此教程:
/includes/templates/template_default/templates l_product_info_display.php
这个文件中购买按钮的…

在zencart首页的最新商品上面要添加"购买"按钮,可以参考最模板此教程:
/includes/templates/template_default/templates l_product_info_display.php
这个文件中购买按钮的代码。
需要修改的代码在:
/includes/modules/new_products.php
商店首页上显示的商品的内容都在变量$list_box_contents中,加上需要的内容就可以了。
$list_box_contents[$row][$col] = array('align' => 'center',
                                             'params' => 'class="smallText" width="' . $col_width . '%" valign="top"',
                                             'text' => '' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '
' . $new_products->fields['products_name'] . '
' . $products_price); 

改为:
if ($products_qty_box_status == '0' or $products_quantity_order_max== '1') {
      // hide the quantity box and default to 1
      $the_button = '' . zen_draw_hidden_field('products_id', (int)$new_products->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
      } else {
      // show the quantity box
      $the_button = PRODUCTS_ORDER_QTY_TEXT . '
' . zen_get_products_quantity_min_units_display((int)$new_products->fields['products_id']) . '
' . zen_draw_hidden_field('products_id', (int)$new_products->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
      };
       
      $list_box_contents[$row][$col] = array('align' => 'center',
                                             'params' => 'class="smallText" style="width:'  . $col_width . '%;float:left" valign="top"',
                                             'text' => '' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '

Style: ' . $new_products->fields['products_name'] . '

Our Price: ' . $products_price  . '

' . zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($new_products->fields['products_id']), zen_get_all_get_params(array('action')). 'action=add_product'), 'post', 'enctype="multipart/form-data"') . zen_get_buy_now_button($new_products->fields['products_id'], $the_button) . 'more


');
本文来自网络,不代表1号站长-站长学院|资讯交流平台立场。转载请注明出处: https://www.1cn.cc/jianzhan/jingyan/20998.html
上一篇zencart1.3.71中文版安装教程
下一篇 ZenCart首页title,keywords,description设置方法
admin

作者: admin

这里可以再内容模板定义一些文字和说明,也可以调用对应作者的简介!或者做一些网站的描述之类的文字或者HTML!

为您推荐

评论列表()

    联系我们

    联系我们

    0898-88888888

    在线咨询: QQ交谈

    邮箱: email@wangzhan.com

    工作时间:周一至周五,9:00-17:30,节假日休息

    关注微信
    微信扫一扫关注我们

    微信扫一扫关注我们