"Add to cart" redirects to Products summary page

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
McF
Forum Members
Forum Members
Posts: 108
Joined: Thu Dec 27, 2007 5:27 pm

"Add to cart" redirects to Products summary page

Post 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
maranc
Forum Members
Forum Members
Posts: 249
Joined: Tue May 04, 2010 5:04 pm

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

Post by maranc »

It's not possible to stay on product detail page without modify module code.

Marek A.
McF
Forum Members
Forum Members
Posts: 108
Joined: Thu Dec 27, 2007 5:27 pm

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

Post 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>
Peciura

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

Post 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).
McF
Forum Members
Forum Members
Posts: 108
Joined: Thu Dec 27, 2007 5:27 pm

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

Post 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.
McF
Forum Members
Forum Members
Posts: 108
Joined: Thu Dec 27, 2007 5:27 pm

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

Post 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
Peciura

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

Post 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.
McF
Forum Members
Forum Members
Posts: 108
Joined: Thu Dec 27, 2007 5:27 pm

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

Post 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
Peciura

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

Post 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}
Post Reply

Return to “Modules/Add-Ons”