Totally Zenned
- Join Date:
- May 2006
- Location:
- Gardiner, Maine
- Posts:
- 2,383
- Plugin Contributions:
- 7
Ceon advanced shipper & cheapest rates
Because the website is using Ceon's advanced shipper, his local pickup option is really just a $0 option.
So how can I change the cheapest shipping option to become the highest option instead so that the $0 shipping isn't default?
Looking at the code in class shipping.php, I'm just not seeing math that I can flip to most expensive instead.
Code hints anyone? Dealing with arrays is always a problem for me but I did expect to see something I could play with.
Commenting out the code means nothing is default.
function cheapest() {
if (is_array($this->modules)) {
$rates = array();
reset($this->modules);
while (list(, $value) = each($this->modules)) {
$class = substr($value, 0, strrpos($value, '.'));
if ($GLOBALS[$class]->enabled) {
$quotes = $GLOBALS[$class]->quotes;
$size = sizeof($quotes['methods']);
for ($i=0; $i<$size; $i++) {
// if ($quotes['methods'][$i]['cost']) {
if (isset($quotes['methods'][$i]['cost'])){
$rates[] = array('id' => $quotes['id'] . '_' . $quotes['methods'][$i]['id'],
'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')',
'cost' => $quotes['methods'][$i]['cost'],
'module' => $quotes['id']
);
}
}
}
}
$cheapest = false;
$size = sizeof($rates);
for ($i=0; $i<$size; $i++) {
if (is_array($cheapest)) {
// never quote storepickup as lowest - needs to be configured in shipping module
if ($rates[$i]['cost'] > $cheapest['cost'] && $rates[$i]['module'] != 'storepickup' && $rates[$i]['module'] != 'willquote' ) {
$cheapest = $rates[$i];
}
} else {
if ($rates[$i]['module'] != 'storepickup' && $rates[$i]['module'] != 'willquote') {
$cheapest = $rates[$i];
}
}
}
$this->notify('NOTIFY_SHIPPING_MODULE_CALCULATE_CHEAPEST', $cheapest);
return $cheapest;
}
}