Page 1 of 1

"Add to cart" redirects to Products summary page

Posted: Sun Mar 04, 2012 12:01 pm
by McF
Hello,

Problem:
Products module with Cart module.
On Product detail page there is "Add to cart" functionality.
After submitting amount of product added to the cart It must remain on the same product detail page, but it redirects to product summary page...

Maybe problem in this html code:

Code: Select all

<form id="m47056moduleform_1" method="post" action="http://localhost/index.php/produktai" class="cms_form">
<div class="hidden">
<input type="hidden" name="mact" value="Cart,m47056,default,0" />
<input type="hidden" name="m47056returnid" value="66" />
<input type="hidden" name="m47056product" value="7" />
<input type="hidden" name="m47056cart_returnto" value="http://localhost/index.php/Products/7/66/PW-207" />
</div>
I see correct form variable m47056cart_returnto, but it seems not working...

CMSMS 1.10.3
CGEcommerceBase 1.3.9
Cart 1.8.1
FrontEndUsers 1.17
Orders 1.13
Products 2.16.2

Settings:
E-Commerce > Cart > Preferences
Page To Redirect To after add to cart: None
E-Commerce > Order Manager > Preferences
Page to assume that the billing form will be displayed on. This is usually the page with your {Orders} tag: None

I'm using CMSMS internal Pretty URLs.

McF

Re: "Add to cart" redirects to Products summary page

Posted: Sun Mar 04, 2012 8:59 pm
by maranc
It's not possible to stay on product detail page without modify module code.

Marek A.

Re: "Add to cart" redirects to Products summary page

Posted: Wed Mar 21, 2012 5:31 pm
by McF
maranc wrote:It's not possible to stay on product detail page without modify module code.
What a pity.

Ok, I made in this way: after clicking "Add to cart" button it redirects to View Cart page.

Question: is it some smarty variable to get back-link?
Or I have to make

Code: Select all

<a href="javascript: history.go(-1)">Back</a>

Re: "Add to cart" redirects to Products summary page

Posted: Wed Mar 21, 2012 6:30 pm
by Peciura
Products should be added to the cart in the background by jQuery. Returned cart content block should replace cart summary block (usually it is placed on a header or sidebar).

Re: "Add to cart" redirects to Products summary page

Posted: Thu Mar 22, 2012 6:44 pm
by McF
Peciura wrote:Products should be added to the cart in the background by jQuery. Returned cart content block should replace cart summary block (usually it is placed on a header or sidebar).
Thanks for the suggestion.
It would be nice, but my site is not so "clever" to use Ajax.

Re: "Add to cart" redirects to Products summary page

Posted: Sun Mar 25, 2012 3:23 pm
by McF
Hello,

Another problem is that my page is multilingual.
I made redirection to Cart page after Product is added to the cart.
But I need to redirect to a different Cart page if User is in different language page...
Is it possible?

McF

Re: "Add to cart" redirects to Products summary page

Posted: Sun Mar 25, 2012 6:34 pm
by Peciura
I think extra field should overwrite original value.
Assume language code is saved to variable {$lang} and Cart in English is on page 'cart_en_US' and for defaut language - 'cart_lt_LT'.

You could add following line just above {$formend}

Code: Select all

{if $lang=='en_US'}
   {assign var='return_to_link' value='cart_en_US'}
{else}{*for default language*}
   {assign var='return_to_link' value='cart_lt_LT'}
{/if}

<input type="hidden" value="/index.php?page={$return_to_link}" name="{$actionid}cart_returnto"/>
If it does not work, post:
Cart form template,
corresponding html source code,
language variable
possible languages
page ID and/or alias you want to redirect to.

Re: "Add to cart" redirects to Products summary page

Posted: Mon Mar 26, 2012 5:56 am
by McF
Hello, Peciura,

I solved this problem by changing {$formstart} tag.
I changed form action URL and hidden parameter returnid.

Only one thing left:
during Order process $lang variable value is lost and Order confirmation is partly displayed in wrong language (some text in English, some text in Lithuanian).

McF

Re: "Add to cart" redirects to Products summary page

Posted: Mon Mar 26, 2012 5:32 pm
by Peciura
Since you already changed {$formstart} there should be easy task to add url parameter for language ('lang', 'hl' or any other you like), e.g.

Code: Select all

http://glasremis.lt/index.php/lietuviskai/krepselis?lang=$lang
{*http://glasremis.lt/index.php/lietuviskai/krepselis?lang=lt_LT*}
You can use it on destination page

Code: Select all

{Cart action='viewcart' lang=$smarty.get.lang}