【发布时间】:2012-10-06 20:43:34
【问题描述】:
我正在使用 Drupal 7 和 ubercart shipping。我的客户希望运输成本是地面报价,除非它 >= 50 美元。然后他想收取 50 美元的固定费用。
我创建了一个 50 美元的统一费率和一个 ups ground 报价。
我没有看到使用运输报价来确定运输方式的条件。有什么想法吗?
【问题讨论】:
标签: drupal ubercart ups drupal-rules
我正在使用 Drupal 7 和 ubercart shipping。我的客户希望运输成本是地面报价,除非它 >= 50 美元。然后他想收取 50 美元的固定费用。
我创建了一个 50 美元的统一费率和一个 ups ground 报价。
我没有看到使用运输报价来确定运输方式的条件。有什么想法吗?
【问题讨论】:
标签: drupal ubercart ups drupal-rules
想通了。不漂亮,但它有效。只需转到 ups 选项并使用 php 评估添加条件。请注意,您必须有两种可用的付款方式才能使条件生效。粘贴此代码。
$method = array (
'id' => 'ups',
'module' => 'uc_ups',
'title' => 'UPS',
'operations' => array (
'configure' => array (
'title' => 'configure',
'href' => 'admin/store/settings/quotes/settings/ups',
),
),
'quote' => array (
'type' => 'small_package',
'callback' => 'uc_ups_quote',
'accessorials' => array (
'03' => 'UPS Ground',
),
),
'ship' => array (
'type' => 'small_package',
'callback' => 'uc_ups_fulfill_order',
'file' => 'uc_ups.ship.inc',
'pkg_types' => array (
'02' => 'Customer Supplied Package',
'01' => 'UPS Letter',
'03' => 'Tube',
'04' => 'PAK',
21 => 'UPS Express Box',
24 => 'UPS 25KG Box',
25 => 'UPS 10KG Box',
30 => 'Pallet',
'2a' => 'Small Express Box',
'2b' => 'Medium Express Box',
'2c' => 'Large Express Box',
),
),
'cancel' => 'uc_ups_void_shipment',
'enabled' => 1,
'weight' => '0',
);
$details->postal_code = $order->delivery_postal_code;
$details->zone = $order->delivery_zone;
$details->country = $order->delivery_country;
$quote = uc_ups_quote($order->products, $details , $method);
return ($quote['03']['rate'] < 50);
该方法可以针对其他类型的运输进行调整,此条件仅适用于 ups ground。您可以修改它以自动选择 ups/fedex 之间最便宜的方法或类似的方法。
无论如何。希望这对其他人有帮助。
【讨论】: