ogun wrote:
have you done any more on this Qphoria? just ran into the same issue while making a shipping module for European airmail.
For my USPS shipping module I finalized on the following session checks:
Code: Select all
function quote() {
// Check session variables to see if new quote download is necessary
$ret = $this->session->get('usps_quotes');
if (is_array($this->session->get('usps_quotes'))
&& ($this->cart->getWeight() == $this->session->get('last_weight'))
&& (count($this->cart->products) == ($this->session->get('last_item_count')))
&& ($this->currency->code == ($this->session->get('last_currency')))
&& ($this->language->code == ($this->session->get('last_language')))
&& ($this->session->get('customer_id') == ($this->session->get('last_cust_id')))
&& ($this->session->get('shipping_address_id') == ($this->session->get('last_address_id')))
&& (count($ret['quote']))) {
$ret['title'] = str_replace('*', '', $ret['title']); //remove asterisk if quotes are old
return $ret;
}//
at the start of my quote function, and at the end:
Code: Select all
// Session Persistence to prevent reprocessing of quotes unless one of these have changed.
$this->session->set('usps_quotes', $method_data); // persist existing quotes to avoid multiple loops.
$this->session->set('last_weight', $shipping_weight); //persist cart weight to check for changes in weight.
$this->session->set('last_item_count', count($this->cart->products)); //persist product count to check for changes in qty.
$this->session->set('last_currency', $this->currency->code); //persist currency to properly show money descriptor.
$this->session->set('last_language', $this->language->code); //persist language to properly show matching language.
$this->session->set('last_cust_id', $this->session->get('customer_id')); //persist customer_id to properly get new quotes.
$this->session->set('last_address_id', $this->session->get('shipping_address_id')); //persist address_id to properly get new quotes.
//
return $method_data;
}// if status
} // EOF Quote
}
Needed all that to ensure proper quoting.. and I had no problems in a whole week of testing with those settings. Feel free to DL the USPS contrib from the download section to see other tricks.