Post by lepe » Wed Mar 25, 2009 10:55 am

For those who use more than one currency, you may find useful this small patch in order to make it stay in the same page (even in checkout):

Modify 2 lines in: catalog/controller/module/currency.php:

(on the top)
From:
$this->redirect($this->url->http('common/home'));
To:
$this->redirect($this->request->server['HTTP_REFERER']);

(on the middle)
From:
$this->data['action'] = $this->url->http('common/home');
To:
$this->data['action'] = $this->request->server['REQUEST_URI'];

It worked for me...

New member

Posts

Joined
Thu Mar 19, 2009 2:10 pm
Location - Japan

Post by lepe » Thu Mar 26, 2009 11:46 am

At the "Basket" section, the currency was not changing with the approach I posted.

So, I notice that in "catalog/controller/checkout/cart.php" was blocking my change.

I think it is not good to use the condition like this:

if ($this->request->server['REQUEST_METHOD'] == 'POST') {

better this way: (this is the solution to enable currency-change also in the "Basket")

if ($this->request->server['REQUEST_METHOD'] == 'POST' && isset($this->request->post['quantity'])) {

The reason is: If any other "plugin/extension" uses "POST" in the cart section, it will redirect again to "checkout/cart" without even accessing the "plugin/extension" code. I haven't checked in other codes, but I feel that every POST must be defined so it will only ignore the POST when do not belongs to it.

Done.

New member

Posts

Joined
Thu Mar 19, 2009 2:10 pm
Location - Japan

Post by Qphoria » Thu Mar 26, 2009 5:20 pm

lepe wrote: if ($this->request->server['REQUEST_METHOD'] == 'POST' && isset($this->request->post['quantity'])) {

The reason is: If any other "plugin/extension" uses "POST" in the cart section, it will redirect again to "checkout/cart" without even accessing the "plugin/extension" code. I haven't checked in other codes, but I feel that every POST must be defined so it will only ignore the POST when do not belongs to it.
You hit the nail on the head :)
We did exactly this for 0.7.9 Final to get the "stay on same page" stuff working. Was worth it :)

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Daniel » Thu Mar 26, 2009 8:10 pm

I tried doing this myself, but found certain pages buggy.

I sopose I could do it with a redirect.

User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm
Who is online

Users browsing this forum: No registered users and 6 guests