当前位置: 首页>>代码示例>>PHP>>正文


PHP Cart::intifier方法代码示例

本文整理汇总了PHP中Cart::intifier方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart::intifier方法的具体用法?PHP Cart::intifier怎么用?PHP Cart::intifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cart的用法示例。


在下文中一共展示了Cart::intifier方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: simulateCarriersOutput

 /**
  * Get all deliveries options available for the current cart formated like Carriers::getCarriersForOrder
  * This method was wrote for retrocompatibility with 1.4 theme
  * New theme need to use Cart::getDeliveryOptionList() to generate carriers option in the checkout process
  *
  * @since 1.5.0
  *
  * @param Country $default_country
  * @param boolean $flush Force flushing cache
  *
  */
 public function simulateCarriersOutput(Country $default_country = null, $flush = false)
 {
     static $cache = false;
     if ($cache !== false && !$flush) {
         return $cache;
     }
     $delivery_option_list = $this->getDeliveryOptionList($default_country, $flush);
     // This method cannot work if there is multiple address delivery
     if (count($delivery_option_list) > 1 || empty($delivery_option_list)) {
         return array();
     }
     $carriers = array();
     foreach (reset($delivery_option_list) as $key => $option) {
         $price = $option['total_price_with_tax'];
         $price_tax_exc = $option['total_price_without_tax'];
         if ($option['unique_carrier']) {
             $carrier = reset($option['carrier_list']);
             $name = $carrier['instance']->name;
             $img = $carrier['logo'];
             $delay = $carrier['instance']->delay;
             $delay = isset($delay[Context::getContext()->language->id]) ? $delay[Context::getContext()->language->id] : $delay[(int) Configuration::get('PS_LANG_DEFAULT')];
         } else {
             $nameList = array();
             foreach ($option['carrier_list'] as $carrier) {
                 $nameList[] = $carrier['instance']->name;
             }
             $name = join(' -', $nameList);
             $img = '';
             // No images if multiple carriers
             $delay = '';
         }
         $mod = $carrier['instance']->external_module_name;
         $carriers[] = array('name' => $name, 'img' => $img, 'mod' => $mod, 'delay' => $delay, 'price' => $price, 'price_tax_exc' => $price_tax_exc, 'id_carrier' => Cart::intifier($key), 'is_module' => false);
     }
     return $carriers;
 }
开发者ID:ulozenka,项目名称:prestashop-1-5,代码行数:47,代码来源:Cart.php

示例2: simulateCarrierSelectedOutput

 public function simulateCarrierSelectedOutput()
 {
     $delivery_option = $this->getDeliveryOption();
     if (count($delivery_option) > 1 || empty($delivery_option)) {
         return 0;
     }
     return Cart::intifier(reset($delivery_option));
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:8,代码来源:Cart.php

示例3: simulateCarrierSelectedOutput

 public function simulateCarrierSelectedOutput($use_cache = true)
 {
     $delivery_option = $this->getDeliveryOption(null, false, $use_cache);
     if (count($delivery_option) > 1 || empty($delivery_option)) {
         return 0;
     }
     return Cart::intifier(reset($delivery_option));
 }
开发者ID:satanicman,项目名称:Pizzushi.loc,代码行数:8,代码来源:Cart.php

示例4: init

 public function init()
 {
     if (!$this->isOpcModuleActive()) {
         return parent::init();
     }
     if (Tools::getIsset('id_carrier') && strpos(Tools::getValue('id_carrier'), ",") > 0) {
         $_POST['id_carrier'] = Cart::intifier(Tools::getValue('id_carrier'));
     }
     $this->opc_templates_path = _PS_MODULE_DIR_ . 'onepagecheckout/views/templates/front';
     $this->origInit();
     $this->_assignOpcSettings();
     if ($this->opc_config != null && $this->opc_config['goods_return_cms'] > 0) {
         $cms = new CMS((int) $this->opc_config['goods_return_cms'], (int) $this->context->language->id);
         $link_goods_return = $this->context->link->getCMSLink($cms, $cms->link_rewrite, true);
         if (!strpos($link_goods_return, '?')) {
             $link_goods_return .= '?content_only=1';
         } else {
             $link_goods_return .= '&content_only=1';
         }
         $this->context->smarty->assign("link_goods_return", $link_goods_return);
     }
     $this->_setInfoBlockContent();
     $this->_setExtraDivPaymentBlock();
     if ($this->nbProducts) {
         $this->context->smarty->assign('virtual_cart', false);
     }
     $this->context->smarty->assign('is_multi_address_delivery', $this->context->cart->isMultiAddressDelivery() || (int) Tools::getValue('multi-shipping') == 1);
     $this->context->smarty->assign('open_multishipping_fancybox', (int) Tools::getValue('multi-shipping') == 1);
     $this->context->smarty->assign('order_process_type', Configuration::get('PS_ORDER_PROCESS_TYPE'));
     $this->context->smarty->assign('one_phone_at_least', (int) Configuration::get('PS_ONE_PHONE_AT_LEAST'));
     $this->inv_first_on = isset($this->opc_config) && isset($this->opc_config["invoice_first"]) && $this->opc_config["invoice_first"] == "1";
     $this->default_ps_carriers = isset($this->opc_config) && isset($this->opc_config["default_ps_carriers"]) && $this->opc_config["default_ps_carriers"] == "1";
     if (version_compare(_PS_VERSION_, "1.5.2.0") <= 0) {
         $this->isLogged = (bool) ($this->context->customer->id && Customer::customerIdExistsStatic((int) $this->context->cookie->id_customer));
     }
     if ($this->context->cart->nbProducts()) {
         if (Tools::isSubmit('ajax')) {
             if (Tools::isSubmit('method')) {
                 switch (Tools::getValue('method')) {
                     case 'updateMessage':
                         if (Tools::isSubmit('message')) {
                             $txtMessage = urldecode(Tools::getValue('message'));
                             $this->_updateMessage($txtMessage);
                             if (count($this->errors)) {
                                 die('{"hasError" : true, "errors" : ["' . implode('\',\'', $this->errors) . '"]}');
                             }
                             die(true);
                         }
                         break;
                     case 'updateCarrierAndGetPayments':
                         if ((Tools::isSubmit('delivery_option') || Tools::isSubmit('id_carrier')) && Tools::isSubmit('recyclable') && Tools::isSubmit('gift') && Tools::isSubmit('gift_message')) {
                             $this->_assignWrappingAndTOS();
                             CartRule::autoRemoveFromCart($this->context);
                             CartRule::autoAddToCart($this->context);
                             if ($this->_processCarrier()) {
                                 $carriers = $this->context->cart->simulateCarriersOutput();
                                 $return = array_merge(array('HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'), 'HOOK_PAYMENT' => $this->_getPaymentMethods(), 'carrier_data' => $this->_getCarrierList(), 'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array('carriers' => $carriers))), $this->getFormatedSummaryDetail());
                                 Cart::addExtraCarriers($return);
                                 die(Tools::jsonEncode($return));
                             } else {
                                 $this->errors[] = Tools::displayError('Error occurred while updating cart.');
                             }
                             if (count($this->errors)) {
                                 die('{"hasError" : true, "errors" : ["' . implode('\',\'', $this->errors) . '"]}');
                             }
                             exit;
                         }
                         break;
                     case 'updateTOSStatusAndGetPayments':
                         if (Tools::isSubmit('checked')) {
                             $this->context->cookie->checkedTOS = (int) Tools::getValue('checked');
                             die(Tools::jsonEncode(array()));
                         }
                         break;
                     case 'updatePaymentsOnly':
                         die(Tools::jsonEncode(array('HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'), 'HOOK_PAYMENT' => self::_getPaymentMethods())));
                         break;
                     case 'getCarrierList':
                         $this->context->smarty->assign('isVirtualCart', $this->context->cart->isVirtualCart());
                         $result = $this->_getCarrierList();
                         $result = array_merge($result, array('HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'), 'HOOK_PAYMENT' => $this->_getPaymentMethods()), $this->getFormatedSummaryDetail());
                         die(Tools::jsonEncode($result));
                         break;
                     case 'editCustomer':
                         if (!$this->isLogged) {
                             exit;
                         }
                         if (Tools::getValue('years')) {
                             $this->context->customer->birthday = (int) Tools::getValue('years') . '-' . (int) Tools::getValue('months') . '-' . (int) Tools::getValue('days');
                         }
                         if (trim(Tools::getValue('customer_lastname')) == "") {
                             $_POST['customer_lastname'] = $this->inv_first_on ? Tools::getValue('lastname_invoice') : Tools::getValue('lastname');
                         }
                         if (trim(Tools::getValue('customer_firstname')) == "") {
                             $_POST['customer_firstname'] = $this->inv_first_on ? Tools::getValue('firstname_invoice') : Tools::getValue('firstname');
                         }
                         $this->errors = $this->context->customer->validateController();
                         $this->context->customer->newsletter = (int) Tools::isSubmit('newsletter');
                         $this->context->customer->optin = (int) Tools::isSubmit('optin');
                         $return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'id_customer' => (int) $this->context->customer->id, 'token' => Tools::getToken(false));
//.........这里部分代码省略.........
开发者ID:evgrishin,项目名称:se1614,代码行数:101,代码来源:OrderOpcController.php

示例5: simulateCarriersOutput

 /**
  * Get all deliveries options available for the current cart formatted like Carriers::getCarriersForOrder
  * This method was wrote for retro-compatibility with 1.4 theme
  * New theme need to use Cart::getDeliveryOptionList() to generate carriers option in the checkout process
  *
  *
  * @param \Country|\JeproshopCountryModelCountry $default_country
  * @param boolean $flush Force flushing cache
  * @return array
  */
 public function simulateCarriersOutput(JeproshopCountryModelCountry $default_country = null, $flush = false)
 {
     static $cache = false;
     if ($cache !== false && !$flush) {
         return $cache;
     }
     $delivery_option_list = $this->getDeliveryOptionList($default_country, $flush);
     // This method cannot work if there is multiple address delivery
     if (count($delivery_option_list) > 1 || empty($delivery_option_list)) {
         return array();
     }
     $carriers = array();
     foreach (reset($delivery_option_list) as $key => $option) {
         $price = $option->total_price_with_tax;
         $price_tax_exc = $option->total_price_without_tax;
         if ($option->unique_carrier) {
             $carrier = reset($option->carrier_list);
             $name = $carrier->instance->name;
             $img = $carrier->logo;
             $delay = $carrier->instance->delay;
             $delay = isset($delay[JeproshopContext::getContext()->language->lang_id]) ? $delay[JeproshopContext::getContext()->language->lang_id] : $delay[(int) JeproshopSettingModelSetting::getValue('default_lang')];
         } else {
             $nameList = array();
             foreach ($option->carrier_list as $carrier) {
                 $nameList[] = $carrier->instance->name;
             }
             $name = join(' -', $nameList);
             $img = '';
             // No images if multiple carriers
             $delay = '';
         }
         $carriers[] = array('name' => $name, 'img' => $img, 'delay' => $delay, 'price' => $price, 'price_tax_exc' => $price_tax_exc, 'carrier_id' => Cart::intifier($key), 'is_module' => false);
     }
     return $carriers;
 }
开发者ID:jeprodev,项目名称:jeproshop,代码行数:45,代码来源:cart.php

示例6: hookExtraCarrier

 public function hookExtraCarrier($params)
 {
     $address = new Address($params['cart']->id_address_delivery);
     $this->context->smarty->assign(array('module_uri' => __PS_BASE_URI__ . 'modules/' . $this->name, 'cust_codePostal' => $address->postcode, 'cust_firstname' => $address->firstname, 'cust_lastname' => $address->lastname, 'cartID' => $params['cart']->id, 'carrierID' => Configuration::get('CHRONORELAIS_CARRIER_ID'), 'carrierIntID' => (string) Cart::intifier(Configuration::get('CHRONORELAIS_CARRIER_ID') . ','), 'cust_address' => $address->address1 . ' ' . $address->address2 . ' ' . $address->postcode . ' ' . $address->city, 'cust_address_clean' => $address->address1 . ' ' . $address->address2 . ' ', 'cust_city' => $address->city));
     return $this->context->smarty->fetch(dirname(__FILE__) . '/views/templates/hook/chronorelais.tpl');
 }
开发者ID:rcollard,项目名称:chronopost,代码行数:6,代码来源:chronopost.php

示例7: getCarrierOptionNumFromIntifier

 private function getCarrierOptionNumFromIntifier($carriers)
 {
     $num = 0;
     foreach ($carriers as $carrier) {
         $test = Cart::intifier(Configuration::get($this->uppername . '_CARRIER_ID') . ',');
         if ($carrier['id_carrier'] == $test) {
             return $num;
         }
         $num++;
     }
     return $num;
 }
开发者ID:ulozenka,项目名称:prestashop-1-5,代码行数:12,代码来源:ulozenka.php


注:本文中的Cart::intifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。