Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Add to cart, don't display product_info?

Add to cart, don't display product_info?

Locked

Views: 1,344

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
3 Apr 2009, 8:31 PM
#1
scrap avatar

scrap

Zen Follower

Join Date:
Mar 2009
Posts:
103
Plugin Contributions:
0

Add to cart, don't display product_info?

Hi
First of all, I have got one "add to cart" button for each item.

However, once the "add to cart" button is clicked Zen Cart adds the product to the cart as well as displays the product information page. I want it to only add the product to the cart and not display the product information. How do I do that?

I've tracked it down to this code in includes/modules/product_listing.php

// 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(zen_get_info_page($listing->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id']), '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>'; 

If I remove the following string

zen_get_info_page($listing->fields['products_id']),

Zen Carts adds the product, but still displays a new page (which is now a 404).

Can I code it to only "refresh" where I'm currently at?

Thanks in advance

4 Apr 2009, 2:28 AM
#2
tony_sar avatar

tony_sar

Totally Zenned

Join Date:
Jul 2006
Location:
Montreal, Canada
Posts:
2,276
Plugin Contributions:
0

Re: Add to cart, don't display product_info?

this is not zc default behaviour , did you install custom template ???
if so , switch to classic template and see the problem gets solved .

also , have you added other add ons ?

4 Apr 2009, 2:35 AM
#3
haredo avatar

haredo

Totally Zenned

Join Date:
Apr 2006
Location:
Texas
Posts:
6,182
Plugin Contributions:
0

Re: Add to cart, don't display product_info?

Scrap,
admin panel/ configuration/ product listing

  1. Display Product Description
  2. set to 0
4 Apr 2009, 2:40 AM
#4
tony_sar avatar

tony_sar

Totally Zenned

Join Date:
Jul 2006
Location:
Montreal, Canada
Posts:
2,276
Plugin Contributions:
0

Re: Add to cart, don't display product_info?

haredo:

Scrap,
admin panel/ configuration/ product listing

  1. Display Product Description
  1. set to 0

what i understood from his first post . is that , product gets added to cart , then gets Redirected to product info page ..

by default , there is no redirect

4 Apr 2009, 9:00 AM
#5
scrap avatar

scrap

Zen Follower

Join Date:
Mar 2009
Posts:
103
Plugin Contributions:
0

Re: Add to cart, don't display product_info?

This is strange. The product_listing.php lies directly within includes/modules, i.e. the same file goes for classic as well as my template. I'm not sure what will happend with my cofigurations if I switch to classic... i'm a bit worried that they all will disapear.

I've downloaded ZC again and reviewed the source for product_listing.php whis is the exact same as the one I've got. I.e. the one with the code above.

Can someone please post their code for product_listing.php? The CODE above is line 140.

4 Apr 2009, 10:36 AM
#6
tony_sar avatar

tony_sar

Totally Zenned

Join Date:
Jul 2006
Location:
Montreal, Canada
Posts:
2,276
Plugin Contributions:
0

Re: Add to cart, don't display product_info?

switching template from admin wont effect your setting .. but is a good way of figuring if some problem template based problem..

you can switch to classic , and go trough same process of adding products from with in listing , and see if you have same issue there .

if not , then you know you have some template issue ..
the code you supplied , is simply the way zencart creates form elements and information about products thats going to get added to cart..

5 Apr 2009, 10:35 AM
#7
scrap avatar

scrap

Zen Follower

Join Date:
Mar 2009
Posts:
103
Plugin Contributions:
0

Re: Add to cart, don't display product_info?

I just changed the template to Classic and tried to add a product and the same thing happened - when I clicked "Add to cart" the product gets added and I get redirected to the product information page. I've tried with Opera 9.64, FF 3.0 and IE 7.

5 Apr 2009, 10:43 AM
#8
scrap avatar

scrap

Zen Follower

Join Date:
Mar 2009
Posts:
103
Plugin Contributions:
0

Re: Add to cart, don't display product_info?

probably something I should have tried a long time ago, but anyways... Setting

Display Product Add to Cart Button (0=off; 1=on; 2=on with Qty Box per Product)

to 1 instead of 2 solved the problem. However, now the customers won't be able to add multiple quantities of a product that easily, but I guess I have to live with it. The customers can still always change the quantity through the shopping cart or through the product information page.