Thanks for the reply. I see how my original statement was misleading. I am always providing the 'id' of the top level as "$this->code". And I'm doing exactly what you show, setting a unique 'id' value for each of the 'methods' array items. So something like this is what I'm doing (with more calculation of course, but this is simplified):
Code:
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_LTL_SHIPPING_FREIGHT_TEXT_TITLE,
'methods' => array());
$this->quotes['methods'][] = array('id' =>ltlfreight,
'title' => 'LTL Freight',
'cost' => '25.00'));
$this->quotes['methods'][] = array('id' =>ltltwoday,
'title' => 'LTL Two Day',
'cost' => '40.00'));
$this->quotes['methods'][] = array('id' =>ltloneday,
'title' => 'LTL One Day',
'cost' => '50.00'));
So what you're saying is I should be able to do the above and then add something like this to get the right quote at checkout:
Code:
$returnIndex = -1;
if(strcomp($method, 'ltlfreight') == 0){
$returnIndex = 0;
}else if (strcomp($method, 'ltltwoday') == 0){
$returnIndex = 1;
}else if(strcomp($method, 'ltloneday') == 0){
$returnIndex = 2;
}
if($returnIndex >= 0){
//Re-write our indtended quote into method position 0
$this->quotes['methods'][0] = $this->quotes['methods'][$returnIndex];
}
return $this->quotes;
This makes sense, and I don't know how I didn't see it before. I guess I just missed the function signature. I'll give this a shot and see if I can make it work. Thanks.
While I've got you on this thread, I want to ask another question:
Is the 'quote' function called on each page of the checkout process? What if calculations need to make WebService calls or some other fairly heavy operation to produce a set of quotes?
Barry