Мне трудно понять, как osCommerce рассчитывает стоимость доставки для модулей доставки Expedited и Super Rush.
Я ищу объяснение того, как эти затраты рассчитываются на английском языке.Мне дали два файла, которые справляются с этим, но мне трудно понять, что происходит.
Ускоренный
function quote($method = '') {
global $order, $cart, $shipping_weight, $shipping_num_boxes, $total_count;
$porciento = ($cart->show_total() * MODULE_SHIPPING_TABLEEXPEDITE_PERCENTAGE) / 100 ;
if ($porciento < MODULE_SHIPPING_TABLEEXPEDITE_FORMULA3) {
$porciento = MODULE_SHIPPING_TABLEEXPEDITE_FORMULA3;
}
if (MODULE_SHIPPING_TABLEEXPEDITE_MODE == 'price') {
$order_total = $cart->show_total();
} else {
$order_total = $shipping_weight;
}
$EXPEDITE_cost = split("[:,]" , MODULE_SHIPPING_TABLEEXPEDITE_COST);
$size = sizeof($EXPEDITE_cost);
for ($i=0, $n=$size; $i<$n; $i+=2) {
if ($order_total <= $EXPEDITE_cost[$i]) {
$shipping = $EXPEDITE_cost[$i+1];
break;
}
}
if (MODULE_SHIPPING_TABLEEXPEDITE_MODE == 'weight') {
$shipping = $shipping * $shipping_num_boxes;
}
$prueba = MODULE_SHIPPING_TABLEEXPEDITE_HANDLING . ' ' . $total_count . ' ' . $shipping_weight;
$coste = (MODULE_SHIPPING_TABLEEXPEDITE_HANDLING) + ($shipping_weight);
$coste = ($coste * MODULE_SHIPPING_TABLEEXPEDITE_FORMULA1) + (MODULE_SHIPPING_TABLEEXPEDITE_FORMULA2);
$coste = $coste + $porciento;
if ($shipping_weight == 0) {
$coste = 0;
}
if ($cart->show_weight() == 0) {
$coste = MODULE_SHIPPING_TABLEEXPEDITE_GIFTCARD;
}
$coste = $coste * $total_count;
$duedate = strftime('%A, %B %d, %Y',calcduedate(time(),MODULE_SHIPPING_TABLEEXPEDITE_BUSINESS_DAYS));
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_TABLEEXPEDITE_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_TABLEEXPEDITE_TEXT_WAY,
'porciento' => $porciento,
'ordertotal' => $cart->show_total(),
'duedate' => $duedate,
'cost' => $coste)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);
return $this->quotes;
}
Super Rush
function quote($method = '') {
global $order, $cart, $shipping_weight, $shipping_num_boxes, $total_count;
$porciento = ($cart->show_total() * MODULE_SHIPPING_TABLESUPERRUSH_PERCENTAGE) / 100 ;
if ($porciento < MODULE_SHIPPING_TABLESUPERRUSH_FORMULA3) {
$porciento = MODULE_SHIPPING_TABLESUPERRUSH_FORMULA3;
}
if (MODULE_SHIPPING_TABLESUPERRUSH_MODE == 'price') {
$order_total = $cart->show_total();
} else {
$order_total = $shipping_weight;
}
$table_overnight_cost = split("[:,]" , MODULE_SHIPPING_TABLESUPERRUSH_COST);
$size = sizeof($table_overnight_cost);
for ($i=0, $n=$size; $i<$n; $i+=2) {
if ($order_total <= $table_overnight_cost[$i]) {
$shipping = $table_overnight_cost[$i+1];
break;
}
}
if (MODULE_SHIPPING_TABLESUPERRUSH_MODE == 'weight') {
$shipping = $shipping * $shipping_num_boxes;
}
$prueba = MODULE_SHIPPING_TABLESUPERRUSH_HANDLING . ' ' . $total_count . ' ' . $shipping_weight;
//echo $prueba;
$coste = (MODULE_SHIPPING_TABLESUPERRUSH_HANDLING) + ($shipping_weight);
$coste = ($coste * MODULE_SHIPPING_TABLESUPERRUSH_FORMULA1) + (MODULE_SHIPPING_TABLESUPERRUSH_FORMULA2);
$coste = $coste + $porciento;
if ($shipping_weight == 0) {
$coste = 0;
}
if ($cart->show_weight() == 0) {
$coste = MODULE_SHIPPING_TABLESUPERRUSH_GIFTCARD;
}
$coste = $coste * $total_count;
$duedate = strftime('%A, %B %d, %Y',calcduedate(time(),MODULE_SHIPPING_TABLESUPERRUSH_BUSINESS_DAYS));
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_TABLESUPERRUSH_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_TABLESUPERRUSH_TEXT_WAY,
'duedate' => $duedate,
'cost' => $coste)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);
return $this->quotes;
}