Page 1 of 1

Shipping quote checks run twice

Posted: Wed Oct 21, 2009 9:51 am
by Qphoria
The problem is, the quote data runs once on page load, and then on form submit, it posts back to itself, so it loads a second time.

Luckily the fix for this double load is very easy. It's simply that the POST check is too far down the page. Instead of putting the POST check after the quote check, move it before it and it works perfect.

Please be sure to add this to 1.3.3 before release.

1. EDIT catalog/controller/checkout/shipping.php
2. MOVE THIS CODE:

Code: Select all

	if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
			$shipping = explode('.', $this->request->post['shipping']);
			
			$this->session->data['shipping_method'] = $this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]];
			
			$this->session->data['comment'] = strip_tags($this->request->post['comment']);

	  		$this->redirect($this->url->https('checkout/payment'));
    	}
3. TO RIGHT BEFORE:

Code: Select all

$this->load->model('checkout/extension');
That will prevent it from loading twice. You won't notice it with localized shipping like zone and free. But when using things like UPS and FedEx, you notice a huge unnecessary delay while it does the second quote lookup

Re: Shipping quote checks run twice

Posted: Wed Oct 21, 2009 10:41 pm
by Qphoria
Fixed file attached for easy adding (v1.3.2).

Re: Shipping quote checks run twice

Posted: Mon Nov 02, 2009 11:42 am
by tbeigle
First off, thanks Qphoria! I really appreciate the work you do.

I'm using your FedEx module and Guest Checkout and I love them both. I'm having some issues, though.

Everything works perfectly after making the change you posted here unless the user plugs in incorrect address information and FedEx is the only shipping option. In those cases guest_shipping comes up as a blank screen. As long as there's another shipping option, though, an error message will come up telling the user the address information is incorrect. Any ideas on how to fix this so the error message still comes up even when FedEx is the only shipping option?

Thanks!

- Tom

Re: Shipping quote checks run twice

Posted: Mon Nov 02, 2009 12:09 pm
by Qphoria
This isn't meant to be used on the guest_shipping.php page. That has other custom code. I will pm you a version for guest shipping.

Re: Shipping quote checks run twice

Posted: Mon Nov 02, 2009 7:47 pm
by amplifywebdesign
Thanks for this!

Re: Shipping quote checks run twice

Posted: Tue Nov 03, 2009 10:22 pm
by tbeigle
Qphoria wrote:This isn't meant to be used on the guest_shipping.php page. That has other custom code. I will pm you a version for guest shipping.
I truly appreciate the help. When can I expect the pm? I'd like to get this updated as soon as possible.

Thanks!