Add to cart button jumps to product info page.
hi,
I have a couple of niggling problems on my cart (not live yet) that I cannot get to the bottom of, appreciate any guidance. I have tried various things to no avail.
One isssue is the 'add to cart' button on the products page.
Basically, I have added the admin option of an 'add to cart' button on each product in the category listing. So you select a category and all the products have an add to cart button next to the qty box.
When the customer clicks on the button I want them to stay on that page. But what happens is they are directed to the 'product info page'. :dontgetit
I tried the suggestion in the thread below. no joy..
http://www.zen-cart.com/showthread.p...g-product-info
Any help on this would be most welcome.
Re: Add to cart button jumps to product info page.
I tried the code change DrByte recommended and it works on v1.3.9h just fine ...
To review, you are using these settings:
1 Configuration ... My Store ... this is set to false
Quote:
Display Cart After Adding Product
Display the shopping cart after adding a product (or return back to their origin)
2 in Configuration ... Product Listing ... this setting is 2:
Quote:
Display Product Add to Cart Button (0=off; 1=on; 2=on with Qty Box per Product)
Do you want to display the Add to Cart Button?
NOTE: Turn OFF Display Multiple Products Qty Box Status to use Option 2 on with Qty Box per Product
3 in Configuration ... Product Listing ... this setting is 0:
Quote:
Display Multiple Products Qty Box Status and Set Button Location
Do you want to display Add Multiple Products Qty Box and Set Button Location?
0= off
1= Top
2= Bottom
3= Both
4 make the changes DrByte posted in post #6 of:
http://www.zen-cart.com/showthread.p...g-product-info
to the file by copying:
/includes/init_includes/init_cart_handler.php
to the file:
/includes/init_includes/overrides/init_cart_handler.php
again, that directory name is exactly as you see it ...
Re: Add to cart button jumps to product info page.
Hi Ajeh
Yes those are the settings I have.
Display Cart After Adding Product false
Display Product Add to Cart Button (0=off; 1=on; 2=on with Qty Box per Product) 2
Display Multiple Products Qty Box Status and Set Button Location 0
Change made as per DrBytes post to init_cart_handler_php and file copied to the 'overrides' folder.
Still no joy i'm afraid.:frusty:
obviously something wrong on my part if you have checked it working, but can't think if I have done some change that has caused it?
Quote:
Originally Posted by
Ajeh
I tried the code change DrByte recommended and it works on v1.3.9h just fine ...
To review, you are using these settings:
1 Configuration ... My Store ... this is set to false
2 in Configuration ... Product Listing ... this setting is 2:
3 in Configuration ... Product Listing ... this setting is 0:
4 make the changes DrByte posted in post #6 of:
http://www.zen-cart.com/showthread.p...g-product-info
to the file by copying:
/includes/init_includes/init_cart_handler.php
to the file:
/includes/init_includes/
overrides/init_cart_handler.php
again, that directory name is exactly as you see it ...
Re: Add to cart button jumps to product info page.
Save this code in the file:
/includes/init_includes/overrides/init_cart_handler.php
Code:
<?php
/**
* initialise and handle cart actions
* see {@link http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials#InitSystem wikitutorials} for more details.
*
* @package initSystem
* @copyright Copyright 2003-2010 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: init_cart_handler.php 17047 2010-07-29 06:00:38Z drbyte $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
if (isset($_GET['action'])) {
/**
* redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
*/
if ($session_started == false) {
zen_redirect(zen_href_link(FILENAME_COOKIE_USAGE));
}
/*
if (DISPLAY_CART == 'true') {
$goto = FILENAME_SHOPPING_CART;
$parameters = array('action', 'cPath', 'products_id', 'pid', 'main_page');
} else {
*/
if ($current_page_base == FILENAME_DEFAULT) {
$goto = FILENAME_DEFAULT;
$parameters = array('action', 'cPath', 'products_id', 'pid', 'main_page');
} elseif (DISPLAY_CART == 'true') {
$goto = FILENAME_SHOPPING_CART;
$parameters = array('action', 'cPath', 'products_id', 'pid', 'main_page');
} else {
$goto = $_GET['main_page'];
if ($_GET['action'] == 'buy_now') {
if (strpos($goto, 'reviews') > 5) {
$parameters = array('action');
$goto = FILENAME_PRODUCT_REVIEWS;
} else {
$parameters = array('action', 'products_id');
}
} else {
$parameters = array('action', 'pid', 'main_page');
}
}
/**
* require file containing code to handle default cart actions
*/
require(DIR_WS_INCLUDES . 'main_cart_actions.php');
}
and load it to your site ...
Does it work?
Re: Add to cart button jumps to product info page.
No unfortunately not.
I tried that file in all the init_includes 'overrides' folders i could find, incase that was the cause, but no joy?
Could some other module be overriding it possibly?
Re: Add to cart button jumps to product info page.
I am not sure what to tell you as it works fine for me when loaded to:
/includes/init_includes/overrides/init_cart_handler.php
Re: Add to cart button jumps to product info page.
Do you know if this is going to work in ZenCart version 1.5? I'm getting the same issue on this version. Once I click on Add to Cart, it redirects to product info page.
Regards,