zencart 商品详细页的ADD TO CART的位置移动

品详细页的ADD TO CART的位置移动

在王文学习zencart程序的时候,有很多疑问,例如刚做zencart站时,发现那个add to cart在产品详细描述的下面显示,而在产品的价格旁边却没有显示,于是就在zencart的中文论坛上到处找寻解决方法,今天终于解决了这个问题:

问题1

深圳zencart 如何将产品详细页的add to cart 按钮移动到 产品的价格旁边?

修改tpl_product_info_display.php, 复制

<!–bof Add to Cart Box –>
<?php
if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == ”) {
// do nothing
} else {
?>
<?php
$display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION[‘cart’]->in_cart($_GET[‘products_id’])) ? ‘<p>’ . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION[‘cart’]->get_quantity($_GET[‘products_id’]) . ‘</p>’ : ”);
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)$_GET[‘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($_GET[‘products_id’])) . ‘” maxlength=”6″ size=”4″ /><br />’ . zen_get_products_quantity_min_units_display((int)$_GET[‘products_id’]) . ‘<br />’ . zen_draw_hidden_field(‘products_id’, (int)$_GET[‘products_id’]) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
}
$display_button = zen_get_buy_now_button($_GET[‘products_id’], $the_button);
?>

<div id=”cartAdd”>
<?php
echo $display_qty;
echo $display_button;
?>
</div>
<?php } // display qty and button ?>
<?php } // CUSTOMERS_APPROVAL == 3 ?>
<!–eof Add to Cart Box–>

然后粘贴到   <!–eof Product Price block –>   下面,就OK了。

问题2

深圳zencart 首页如何加add to cart的问题,解决办法

深圳zencart

new_products.php可以在$products_price);的);前加入

深圳zencart

. ‘<a href=”‘ . zen_href_link(FILENAME_PRODUCTS_NEW, zen_get_all_get_params(array(‘action’)) . ‘action=buy_now&products_id=’ . $new_products->fields[‘products_id’]) . ‘”><img src=”/images/buttons/button_buy_now.gif”></a>’

此条目发表在php与mysql参考, 杂文分类目录。将固定链接加入收藏夹。

发表评论

邮箱地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>