Of course I expected a delay on the checkout_shipping page, as that has to run the getQuotes process and wait for the reponses from the usps server and any other servers that might be enabled.
After that however, the delay was just as long on the checkout_payment and checkout_confirm pages on local server.
So using Nusphere as my debugger, and switching back to zone shipping. I stepped through the pages and found the follow to be quite interesting:
- checkout_shipping - goes through the getQuotes process one time to find ALL available mailing options and list them out for the customer to chooose. Once chosen, it then sets that to the shipping_method. That is proper behavior.
- checkout_payment - goes through the "getQuotes" process one extra time to get the price for the shipping option that was selected on the shipping page as part of a verification step. This is completely unnecessary as the postage cost should have already been saved in the session from the last page.
- checkout_confirm - goes through the "getQuotes" process SIX more times!! I haven't finished testing yet, but it seems to loop through once for each element of the array (id, title, cost, text, taxclass, etc). Pure craziness
This seems to be the first culprit. Seem opencart is checking if there isn't a shipping method in the session, then go back to checkout_shipping, which is fine. But then does a redundant check if its not in the shipping class by getting the quotes again. This I believe is already being validated before leaving the checkout_shipping page.if ($cart->hasShipping()) {
if (!$session->get('shipping_method')) {
$response->redirect($url->ssl('checkout_shipping'));
}
if (!$shipping->getQuote($session->get('shipping_method'))) {
$response->redirect($url->ssl('checkout_shipping'));
}
if (!$session->get('shipping_address_id')) {
$response->redirect($url->ssl('checkout_address', 'shipping'));
}
} else {
$session->delete('shipping_address_id');
$session->delete('shipping_method');
}
Then later in the shipping.php library there are 3 more calls:
[php]
function getTitle($key) {
$data = $this->getQuote($key);
return (isset($data['title']) ? $data['title'] : NULL);
}
function getCost($key) {
$data = $this->getQuote($key);
return (isset($data['cost']) ? $data['cost'] : NULL);
}
function getTaxClassId($key) {
$data = $this->getQuote($key);
return (isset($data['tax_class_id']) ? $data['tax_class_id'] : NULL);
}
[/php]
This looks like it all needs to be reworked to just get it out of the existing session or another global that already has it set.
I'll post with more as I find more.