本文整理汇总了PHP中Carrier::getDefaultCarrierSelection方法的典型用法代码示例。如果您正苦于以下问题:PHP Carrier::getDefaultCarrierSelection方法的具体用法?PHP Carrier::getDefaultCarrierSelection怎么用?PHP Carrier::getDefaultCarrierSelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Carrier
的用法示例。
在下文中一共展示了Carrier::getDefaultCarrierSelection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$this->init();
$this->preProcess();
if (Tools::getValue('ajax') == 'true') {
if (Tools::getIsset('summary')) {
$result = array();
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
if (self::$cookie->id_customer) {
$customer = new Customer((int) self::$cookie->id_customer);
$groups = $customer->getGroups();
} else {
$groups = array(1);
}
if ((int) self::$cart->id_address_delivery) {
$deliveryAddress = new Address((int) self::$cart->id_address_delivery);
$id_zone = Address::getZoneById((int) $deliveryAddress->id);
}
if (!isset($id_zone)) {
$id_zone = (int) Country::getIdZone(isset($deliveryAddress) && (int) $deliveryAddress->id ? (int) $deliveryAddress->id_country : (int) _PS_COUNTRY_DEFAULT_);
}
$result['carriers'] = Carrier::getCarriersForOrder($id_zone, $groups);
$result['checked'] = Carrier::getDefaultCarrierSelection($result['carriers'], (int) self::$cart->id_carrier);
$result['HOOK_EXTRACARRIER'] = Module::hookExec('extraCarrier', array('address' => isset($deliveryAddress) && (int) $deliveryAddress->id ? $deliveryAddress : null));
}
$result['summary'] = self::$cart->getSummaryDetails();
$result['customizedDatas'] = Product::getAllCustomizedDatas((int) self::$cart->id);
$result['HOOK_SHOPPING_CART'] = Module::hookExec('shoppingCart', $result['summary']);
$result['HOOK_SHOPPING_CART_EXTRA'] = Module::hookExec('shoppingCartExtra', $result['summary']);
die(Tools::jsonEncode($result));
} else {
$this->includeCartModule();
}
} else {
$this->setMedia();
$this->displayHeader();
$this->process();
$this->displayContent();
$this->displayFooter();
}
}
示例2: _setDefaultCarrierSelection
/**
* Decides what the default carrier is and update the cart with it
*
* @param array $carriers
*
* @deprecated since 1.5.0
*
* @return number the id of the default carrier
*/
protected function _setDefaultCarrierSelection($carriers)
{
$this->context->cart->id_carrier = Carrier::getDefaultCarrierSelection($carriers, (int) $this->context->cart->id_carrier);
if ($this->context->cart->update()) {
return $this->context->cart->id_carrier;
}
return 0;
}
示例3: _setDefaultCarrierSelection
/**
* Decides what the default carrier is and update the cart with it
*
* @param array $carriers
* @return number the id of the default carrier
*/
protected function _setDefaultCarrierSelection($carriers)
{
self::$cart->id_carrier = Carrier::getDefaultCarrierSelection($carriers, (int) self::$cart->id_carrier);
if (self::$cart->update()) {
return self::$cart->id_carrier;
}
return 0;
}