X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Continue Shopping -> Redirect to product (https://forum.x-cart.com/showthread.php?t=57706)

ADDISON 01-24-2011 12:13 PM

Continue Shopping -> Redirect to product
 
Let's enable in General Settings -> Redirect customer to cart after adding a product.

If you want to come back to the product you just added to cart, after pressing Continue Shopping, do the following modifications:

In XC 4.4.2 root find product.php. At the end of the file, before:

Code:

func_display('customer/home.tpl', $smarty);

add the following code lines:

Code:

define('STORE_NAVIGATION_SCRIPT', 'Y');
$smarty->assign('navigation_script', 'product.php?productid=' . $productid);


We can go further adding in General Settings a check box: Redirect to product page.

if (redirect to cart enabled && redirect to productpage enabled)
pressing Continue Shopping go back to product page

Lots of information about Continue Shopping button here: http://www.getelastic.com/4-ways-continue-shopping

Learner 03-15-2012 02:28 AM

Re: Continue Shopping -> Redirect to product
 
Hi,
Thanks for your codes.

If I want to go to the current page suppose in category or in manufacturer page what will be the code for x cart pro 4.4.2 Pro?

ADDISON 03-15-2012 02:45 AM

Re: Continue Shopping -> Redirect to product
 
This is the place you should make the changes:

$smarty->assign('navigation_script', 'product.php?productid=' . $productid);

that productid has associated a categoryid and a manufacturerid. Change product.php with category.php ...

I don't see it relevant to go in Manufacture page after pushing continue shopping button.

Quote:

Originally Posted by Learner
Hi,
Thanks for your codes.

If I want to go to the current page suppose in category or in manufacturer page what will be the code for x cart pro 4.4.2 Pro?


Learner 03-15-2012 04:15 AM

Re: Continue Shopping -> Redirect to product
 
Hi,
It will not work for me...

ADDISON 03-15-2012 04:18 AM

Re: Continue Shopping -> Redirect to product
 
What did you use for replacing this 'product.php?productid=' . $productid"?

Here is what QT replied inside the bugtracker (http://bugtracker.qtmsoft.com/view.php?id=38084)

*****************
As a result of discussion it was decided to implement this as follows:

- customer adds a product from the home page -> it redirects him to home page
- customer adds a product from the search results page -> it redirects him to the same search results (with page number and search conditions as it was before)
- customer adds a product from the category page -> it redirects him to that category (page number is kept)
- customer adds a product from the product details page -> it redirects him to home, category, or search results page the customer was browsing last time

We do not see any reason to forward a customer to the same product page when click on the Continue shopping button. That product is already in cart.
*****************

My personal opinion is X-Cart should let the administrator to decide from a few options where to redirect the customer.

keystone 03-23-2012 12:43 PM

Re: Continue Shopping -> Redirect to product
 
Wouldn't just replacing the onclick javascript code from

Code:

onclick="javascript: self.location = '/DEVELOPMENT/xcart/home.php?cat=7&sort=orderby&sort_direction=0'; if (event) event.cancelBubble = true;">
to
Code:

onclick="javascript:history.back()"
for the continue shopping button?

I'm sure sure what your button code is exactly in the version you are using but it worked great in 4.1.8 and I was going to edit it in my 4.4.5 test version as well to see if it works.

cflsystems 03-23-2012 12:54 PM

Re: Continue Shopping -> Redirect to product
 
Quote:

onclick="javascript:history.back()"


This actually is not good as in some cases will not work as intended. For example - customer adds to cart and then logs out or session expires. Customer logs in again and XC will redirect him/her to the cart because cart is not empty (default XC behaviour). Customer hits the "continue shopping" button - using the js history function customer will be redirected back to the login screen - not good at all.

keystone 03-26-2012 04:35 AM

Re: Continue Shopping -> Redirect to product
 
That is a very good point. Didn't think of that at all.

modibaba 11-20-2012 06:54 AM

Re: Continue Shopping -> Redirect to product
 
I am on 4.1.9 and I tried the way ADDISON mentioned here but did not work, can you please help... thanks


All times are GMT -8. The time now is 01:55 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.