ZEN CART如何直接在首页的商品上面加上"购买"按钮
2012-05-18 23:58
344 查看
如何直接在首页的最新商品上面加上直接"购买"按钮?
要添加"购买"按钮,可以参考
/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' => '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']),
'products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br /><a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']),
'products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price);
改为:
if ($products_qty_box_status == '0' or $products_quantity_order_max== '1') {
// hide the quantity box and default to 1
$the_button = '<input type="hidden" name="cart_quantity" value="1" />' . 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 . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($new_products->fields['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$new_products->fields['products_id'])
. '<br />' . 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' => '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']),
'products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br /><div class="border_line01"><strong>Style:
<a class="ab" href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><strong></div><div class="border_line01">Our Price:
<span class="colorr">' . $products_price . '</span></div>' . 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) . '<a href="' .zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'products_id=' . $new_products->fields['products_id']) . '">more</a></form><br /><br /><br />');
要添加"购买"按钮,可以参考
/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' => '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']),
'products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br /><a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']),
'products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price);
改为:
if ($products_qty_box_status == '0' or $products_quantity_order_max== '1') {
// hide the quantity box and default to 1
$the_button = '<input type="hidden" name="cart_quantity" value="1" />' . 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 . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($new_products->fields['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$new_products->fields['products_id'])
. '<br />' . 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' => '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']),
'products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br /><div class="border_line01"><strong>Style:
<a class="ab" href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><strong></div><div class="border_line01">Our Price:
<span class="colorr">' . $products_price . '</span></div>' . 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) . '<a href="' .zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'products_id=' . $new_products->fields['products_id']) . '">more</a></form><br /><br /><br />');
相关文章推荐
- ZEN CART如何直接在首页的商品上面加上"购买"按钮
- zen-cart如何直接在首页的商品上面加上"购买"按
- 如何实现"设为首页","加入收藏"的功能
- 如何控制秒杀商品页面购买按钮的定时点亮
- 如何实现"设为首页","加入收藏"的功能
- 如何去除SDI程序中Commandbar上的"新建"按钮
- ECSHOP "加入购物车"弹窗的实现以及"直接购买"功能
- ECSHOP商品详情页面如何实现直接购买和放入到购物车同时存在
- 如何去除SDI程序中Commandbar上的"新建"按钮
- java中如何向水晶报表传参数--补充"haibodotnet的专栏"中"传参数"的内容
- &quot;不要自己发明轮子&quot;与&quot;了解轮子是如何发明的&quot;
- 如何根据"需求及功能需要"去选择相关的"材料、型号、技术"的思考
- 如何在 "万一的 Delphi 博客" 回复自动格式化的着色代码?
- 1234567890中间加上+、-、*、/或者""后变成的等式结果为110
- 【翻译自mos文章】aix上"Cluster Node Information" or "Specify Cluster Configuration" 窗口中不显示节点并且add 按钮是灰色的
- 如何解决"找不到MSVCR80.dll "的问题
- 市面上所有号称"虚拟机","防火墙"的实时监控杀毒软件无一不是使用的IFSHOOK技术.但是同时也有一些朋友不断写MAIL给我打听如何实现读写的监控.下面给出用VTOOLSD写的代码.也就是所有实时杀毒软件的奥秘.同时,很多拦截文件操作的软件,例如对目录加
- “老"程序员如何能保证自己一直立于不败之地?
- 如何实现"请等待..."页面?
- HttpServletRequest的getServletPath、getServletURI、getServletURL等区别 &&如何防止用户通过直接输入URL访问网页