Forums / General Questions / Add to cart button jumps to product info page.

Add to cart button jumps to product info page.

Views: 2,439

Results 1 to 7 of 7
11 May 2012, 6:40 AM
#1
onetrack avatar

onetrack

New Zenner

Join Date:
Apr 2012
Posts:
8
Plugin Contributions:
0

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.php?83621-add-to-cart-without-displaying-product-info

Any help on this would be most welcome.

11 May 2012, 3:06 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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

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:

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:

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.php?83621-add-to-cart-without-displaying-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 ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

11 May 2012, 8:27 PM
#3
onetrack avatar

onetrack

New Zenner

Join Date:
Apr 2012
Posts:
8
Plugin Contributions:
0

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?

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.php?83621-add-to-cart-without-displaying-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 ...

12 May 2012, 4:25 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Add to cart button jumps to product info page.

Save this code in the file:
/includes/init_includes/overrides/init_cart_handler.php

<?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?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 May 2012, 9:38 PM
#5
onetrack avatar

onetrack

New Zenner

Join Date:
Apr 2012
Posts:
8
Plugin Contributions:
0

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?

12 May 2012, 10:48 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

27 Jul 2012, 10:53 AM
#7
futurist71 avatar

futurist71

New Zenner

Join Date:
Jul 2011
Posts:
24
Plugin Contributions:
0

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,