本文整理汇总了PHP中Carrier::getCarrierByReference方法的典型用法代码示例。如果您正苦于以下问题:PHP Carrier::getCarrierByReference方法的具体用法?PHP Carrier::getCarrierByReference怎么用?PHP Carrier::getCarrierByReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Carrier
的用法示例。
在下文中一共展示了Carrier::getCarrierByReference方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getCart
private function _getCart($id_customer, $id_address_billing, $id_address_shipping, $productsNode, $currency, $shipping_method)
{
$cart = new Cart();
$cart->id_customer = $id_customer;
$cart->id_address_invoice = $id_address_billing;
$cart->id_address_delivery = $id_address_shipping;
$cart->id_currency = Currency::getIdByIsoCode((string) $currency == '' ? 'EUR' : (string) $currency);
$cart->id_lang = Configuration::get('PS_LANG_DEFAULT');
$cart->recyclable = 0;
$cart->secure_key = md5(uniqid(rand(), true));
$actual_configuration = unserialize(Configuration::get('SHOPPING_FLUX_SHIPPING_MATCHING'));
$carrier_to_load = isset($actual_configuration[base64_encode(Tools::safeOutput($shipping_method))]) ? (int) $actual_configuration[base64_encode(Tools::safeOutput($shipping_method))] : (int) Configuration::get('SHOPPING_FLUX_CARRIER');
$carrier = Carrier::getCarrierByReference($carrier_to_load);
//manage case PS_CARRIER_DEFAULT is deleted
$carrier = is_object($carrier) ? $carrier : new Carrier($carrier_to_load);
$cart->id_carrier = $carrier->id;
$cart->add();
foreach ($productsNode->Product as $product) {
$skus = explode('_', $product->SKU);
$added = $cart->updateQty((int) $product->Quantity, (int) $skus[0], isset($skus[1]) ? $skus[1] : null);
if ($added < 0 || $added === false) {
return false;
}
}
$cart->update();
return $cart;
}
示例2: getSettings
private function getSettings()
{
$settings_data = self::getSettingsData();
foreach ($settings_data as $name => $setting) {
$this->{$setting} = $this->getSetting($name, $this->{$setting});
}
$carriers_ids = Configuration::getMultiple(array(self::CARRIER_10_ID, self::CARRIER_12_ID, self::CARRIER_CLASSIC_ID, self::CARRIER_SAME_DAY_ID, self::CARRIER_B2C_ID, self::CARRIER_INTERNATIONAL_ID, self::CARRIER_BULGARIA_ID, self::CARRIER_10_COD_ID, self::CARRIER_12_COD_ID, self::CARRIER_CLASSIC_COD_ID, self::CARRIER_SAME_DAY_COD_ID, self::CARRIER_B2C_COD_ID, self::CARRIER_INTERNATIONAL_COD_ID, self::CARRIER_BULGARIA_COD_ID));
$ps_14 = version_compare(_PS_VERSION_, '1.5', '<');
$all_dpd_carriers = array(array('id_carrier' => isset($carriers_ids[self::CARRIER_10_ID]) ? $carriers_ids[self::CARRIER_10_ID] : '', 'id_service' => 'active_services_10'), array('id_carrier' => isset($carriers_ids[self::CARRIER_12_ID]) ? $carriers_ids[self::CARRIER_12_ID] : '', 'id_service' => 'active_services_12'), array('id_carrier' => isset($carriers_ids[self::CARRIER_CLASSIC_ID]) ? $carriers_ids[self::CARRIER_CLASSIC_ID] : '', 'id_service' => 'active_services_classic'), array('id_carrier' => isset($carriers_ids[self::CARRIER_SAME_DAY_ID]) ? $carriers_ids[self::CARRIER_SAME_DAY_ID] : '', 'id_service' => 'active_services_same_day'), array('id_carrier' => isset($carriers_ids[self::CARRIER_B2C_ID]) ? $carriers_ids[self::CARRIER_B2C_ID] : '', 'id_service' => 'active_services_b2c'), array('id_carrier' => isset($carriers_ids[self::CARRIER_INTERNATIONAL_ID]) ? $carriers_ids[self::CARRIER_INTERNATIONAL_ID] : '', 'id_service' => 'active_services_international'), array('id_carrier' => isset($carriers_ids[self::CARRIER_BULGARIA_ID]) ? $carriers_ids[self::CARRIER_BULGARIA_ID] : '', 'id_service' => 'active_services_bulgaria'), array('id_carrier' => isset($carriers_ids[self::CARRIER_10_COD_ID]) ? $carriers_ids[self::CARRIER_10_COD_ID] : '', 'id_service' => 'is_cod_carrier_10'), array('id_carrier' => isset($carriers_ids[self::CARRIER_12_COD_ID]) ? $carriers_ids[self::CARRIER_12_COD_ID] : '', 'id_service' => 'is_cod_carrier_12'), array('id_carrier' => isset($carriers_ids[self::CARRIER_CLASSIC_COD_ID]) ? $carriers_ids[self::CARRIER_CLASSIC_COD_ID] : '', 'id_service' => 'is_cod_carrier_classic'), array('id_carrier' => isset($carriers_ids[self::CARRIER_SAME_DAY_COD_ID]) ? $carriers_ids[self::CARRIER_SAME_DAY_COD_ID] : '', 'id_service' => 'is_cod_carrier_same_day'), array('id_carrier' => isset($carriers_ids[self::CARRIER_B2C_COD_ID]) ? $carriers_ids[self::CARRIER_B2C_COD_ID] : '', 'id_service' => 'is_cod_b2c'), array('id_carrier' => isset($carriers_ids[self::CARRIER_INTERNATIONAL_COD_ID]) ? $carriers_ids[self::CARRIER_INTERNATIONAL_COD_ID] : '', 'id_service' => 'is_cod_international'), array('id_carrier' => isset($carriers_ids[self::CARRIER_BULGARIA_COD_ID]) ? $carriers_ids[self::CARRIER_BULGARIA_COD_ID] : '', 'id_service' => 'is_cod_bulgaria'));
foreach ($all_dpd_carriers as $dpd_carrier) {
if ($dpd_carrier['id_carrier']) {
if ($ps_14) {
$id_carrier = (int) DpdGroupCarrier::getIdCarrierByReference((int) $dpd_carrier['id_carrier']);
$carrier = new Carrier((int) $id_carrier);
} else {
$carrier = Carrier::getCarrierByReference((int) $dpd_carrier['id_carrier']);
}
if (Validate::isLoadedObject($carrier)) {
$this->{$dpd_carrier}['id_service'] = $carrier->active && !$carrier->deleted ? 1 : 0;
} else {
$this->{$dpd_carrier}['id_service'] = 0;
}
}
}
}
示例3: getCarrierByReference
public static function getCarrierByReference($reference)
{
if (version_compare(_PS_VERSION_, '1.5', '<')) {
$id_carrier = (int) DpdPolandCarrier::getIdCarrierByReference($reference);
$carrier = new Carrier((int) $id_carrier);
} else {
$carrier = Carrier::getCarrierByReference((int) $reference);
}
return $carrier;
}
示例4: deleteCarrier
public static function deleteCarrier($carrier_type)
{
$id_carrier = (int) Configuration::get($carrier_type);
if (!$id_carrier) {
return true;
}
if (version_compare(_PS_VERSION_, '1.5', '<')) {
$id_carrier = (int) DpdGroupCarrier::getIdCarrierByReference((int) $id_carrier);
$carrier = new Carrier((int) $id_carrier);
} else {
$carrier = Carrier::getCarrierByReference($id_carrier);
}
if (!Validate::isLoadedObject($carrier)) {
return true;
}
if ($carrier->deleted) {
return true;
}
$carrier->deleted = 1;
return (bool) $carrier->save();
}