Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Back to Shopping Link

Back to Shopping Link

Locked

Views: 535

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
28 Aug 2010, 9:33 PM
#1
buckit avatar

buckit

New Zenner

Join Date:
Nov 2009
Posts:
45
Plugin Contributions:
0

Back to Shopping Link

I am using Zen Cart 1.3.9f

I have the "add to Cart" button showing in the product listing. If you press that button it takes you to the cart. if you then press the "back to shopping" button it takes you to the product details page of the product you added... it doesnt take you back to the product list.

If I change zen_back_link()'s session navigation path to -3 rather than -2 it works... but then ofcourse that makes it go all the way back to the product listing when adding to the cart from the product detail page.

it seems that when pressing the Add to Cart button in the product listing page that an entry is wrongly put into $_SESSION['navigation']->path for the product detail page.

I never navigated to that page so it shouldn't go into that session array.

hopefully I am making sense :)

28 Aug 2010, 9:44 PM
#2
buckit avatar

buckit

New Zenner

Join Date:
Nov 2009
Posts:
45
Plugin Contributions:
0

Re: Back to Shopping Link

Well, the answer why was a little clearer then I thought it was. The "add to Cart" form used in the product listing takes you to the product info page which then adds the item to the cart and sends you off to the cart.

There must be a way to fix this. I cant have people add something to the cart from the product list and be taken back to a page they never visited.

28 Aug 2010, 10:15 PM
#3
buckit avatar

buckit

New Zenner

Join Date:
Nov 2009
Posts:
45
Plugin Contributions:
0

Re: Back to Shopping Link

I fixed it.

in includes/modules/product_listing.php

changed:

line #136:   $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>';

to:

line #136:   $lc_button= zen_draw_form('cart_quantity', zen_href_link(FILENAME_DEFAULT, 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>';

This makes the form submission process the 'add_product' action on the product listing page(simply changing the forms action url). the default zen cart way has the form submitting to the product_info page... which then wrongly puts in the navigation as having visited that page.