2012-10-16 36 views
0

我正在使用Drupal 7与ubercart运输。我的客户希望运费成本高于地面报价,除非它大于等于50美元。然后,他想收取50美元的平价。如何根据ups运输报价设置ubercart作为条件?

我创建了一个价格为50美元的统一费率和一个ups语录报价。

我没有看到使用航运报价确定运输方式的情况。有任何想法吗?

回答

1

得出这个想法。不漂亮,但它的作品。只要去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/fedex之间最便宜的方法或类似的东西。

无论如何。希望这可以帮助别人。