Problem with my "buy now"
Hi,
If you go to this page: http://www.purenappycakes.com/boys-baby-gifts-c-7.html and click "buy now" on the cup cakes. then from the shopping cart click "back to shopping", then click "buy now" for any other item. The cup cake quantity goes up 1, instead of adding other items to the cart.
I noticed the button for every product then links to the same item number.
Any ideas to what could be causing this?
Thanks
Joe
Remove superflous &products_id
As $_GET['products_id'] is not used by the "add_product" action in Zen Cart 1.5.1 you can modify the core Zen Cart code to stop adding the superfluous "&products_id=18" to the form (only happens with the settings you mentioned earlier in this thread).
I do not recommend modifying core Zen Cart files except as a last resort. Best practice is to avoid modifying core Zen Cart files whenever possible to avoid future upgrade entanglements and issues.
While this should NOT be needed... Open up "/includes/modules/product_listing.php". For Zen Cart 1.5.1 go to line 136 and remove "products_id" from the URL. When you are done it should look something like this:
Code:
} else {
// qty box with add to cart button
if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
$lc_button= zen_draw_form('cart_quantity', zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($listing->fields['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</form>';
} else {
$lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
}
}
Note: The only way I can see this affecting anything is if you have other modifications made to your Zen Cart installation which attempt to use $_GET['products_id'] instead of $_POST['products_id']... Such as AJAX calls implemented by a 3rd party modification to Zen Cart... Or corrupted files...