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


PHP Cart::addExtraCarriers方法代码示例

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


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

示例1: _assignCarrier

 protected function _assignCarrier()
 {
     $address = new Address($this->context->cart->id_address_delivery);
     $id_zone = Address::getZoneById($address->id);
     $carriers = $this->context->cart->simulateCarriersOutput(null, true);
     $checked = $this->context->cart->simulateCarrierSelectedOutput(false);
     $delivery_option_list = $this->context->cart->getDeliveryOptionList();
     $this->setDefaultCarrierSelection($delivery_option_list);
     $this->context->smarty->assign(array('address_collection' => $this->context->cart->getAddressCollection(), 'delivery_option_list' => $delivery_option_list, 'carriers' => $carriers, 'checked' => $checked, 'delivery_option' => $this->context->cart->getDeliveryOption(null, false)));
     $vars = array('HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array('carriers' => $carriers, 'checked' => $checked, 'delivery_option_list' => $delivery_option_list, 'delivery_option' => $this->context->cart->getDeliveryOption(null, false))));
     Cart::addExtraCarriers($vars);
     $this->context->smarty->assign($vars);
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:13,代码来源:ParentOrderController.php

示例2: displayAjax

 public function displayAjax()
 {
     if ($this->errors) {
         $this->ajaxDie(Tools::jsonEncode(array('hasError' => true, 'errors' => $this->errors)));
     }
     if ($this->ajax_refresh) {
         $this->ajaxDie(Tools::jsonEncode(array('refresh' => true)));
     }
     $this->context->cookie->write();
     if (Tools::getIsset('summary')) {
         $result = array();
         if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
             $groups = Validate::isLoadedObject($this->context->customer) ? $this->context->customer->getGroups() : array(1);
             if ($this->context->cart->id_address_delivery) {
                 $delivery_address = new Address($this->context->cart->id_address_delivery);
             }
             $id_country = isset($delivery_address) && $delivery_address->id ? (int) $delivery_address->id_country : (int) Tools::getCountry();
             Cart::addExtraCarriers($result);
         }
         $result['summary'] = $this->context->cart->getSummaryDetails(null, true);
         $result['customizedDatas'] = Product::getAllCustomizedDatas($this->context->cart->id, null, true);
         $result['HOOK_SHOPPING_CART'] = Hook::exec('displayShoppingCartFooter', $result['summary']);
         $result['HOOK_SHOPPING_CART_EXTRA'] = Hook::exec('displayShoppingCart', $result['summary']);
         foreach ($result['summary']['products'] as $key => &$product) {
             $product['quantity_without_customization'] = $product['quantity'];
             if ($result['customizedDatas'] && isset($result['customizedDatas'][(int) $product['id_product']][(int) $product['id_product_attribute']])) {
                 foreach ($result['customizedDatas'][(int) $product['id_product']][(int) $product['id_product_attribute']] as $addresses) {
                     foreach ($addresses as $customization) {
                         if ($product['id_cart_product'] == $customization['id_cart_product']) {
                             $product['quantity_without_customization'] -= (int) $customization['quantity'];
                         }
                     }
                 }
             }
             $product['price_without_quantity_discount'] = Product::getPriceStatic($product['id_product'], !Product::getTaxCalculationMethod(), $product['id_product_attribute'], 6, null, false, false);
             $ppropertiessmartprice_hook1 = null;
             if ($product['reduction_type'] == 'amount') {
                 $reduction = (double) $product['price_wt'] - (double) $product['price_without_quantity_discount'];
                 $product['reduction_formatted'] = Tools::displayPrice($reduction);
             }
         }
         if ($result['customizedDatas']) {
             Product::addCustomizationPrice($result['summary']['products'], $result['customizedDatas']);
         }
         $json = null;
         Hook::exec('actionCartListOverride', array('summary' => $result, 'json' => &$json));
         $this->ajaxDie(Tools::jsonEncode(array_merge($result, (array) Tools::jsonDecode($json, true))));
     } elseif (file_exists(_PS_MODULE_DIR_ . '/blockcart/blockcart-ajax.php')) {
         $context = Context::getContext();
         $cart = $context->cart;
         if ($cart && isset($cart->last_icp)) {
             $context->smarty->assign('last_icp', $cart->last_icp);
         }
         require_once _PS_MODULE_DIR_ . '/blockcart/blockcart-ajax.php';
     }
 }
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:56,代码来源:CartController.php

示例3: displayAjax

 /**
  * Display ajax content (this function is called instead of classic display, in ajax mode)
  */
 public function displayAjax()
 {
     if ($this->errors) {
         $this->ajaxDie(Tools::jsonEncode(array('hasError' => true, 'errors' => $this->errors)));
     }
     if ($this->ajax_refresh) {
         $this->ajaxDie(Tools::jsonEncode(array('refresh' => true)));
     }
     // write cookie if can't on destruct
     $this->context->cookie->write();
     if (Tools::getIsset('summary')) {
         $result = array();
         if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
             $groups = Validate::isLoadedObject($this->context->customer) ? $this->context->customer->getGroups() : array(1);
             if ($this->context->cart->id_address_delivery) {
                 $deliveryAddress = new Address($this->context->cart->id_address_delivery);
             }
             $id_country = isset($deliveryAddress) && $deliveryAddress->id ? (int) $deliveryAddress->id_country : (int) Tools::getCountry();
             Cart::addExtraCarriers($result);
         }
         $result['summary'] = $this->context->cart->getSummaryDetails(null, true);
         $result['customizedDatas'] = Product::getAllCustomizedDatas($this->context->cart->id, null, true);
         $result['HOOK_SHOPPING_CART'] = Hook::exec('displayShoppingCartFooter', $result['summary']);
         $result['HOOK_SHOPPING_CART_EXTRA'] = Hook::exec('displayShoppingCart', $result['summary']);
         foreach ($result['summary']['products'] as $key => &$product) {
             $product['quantity_without_customization'] = $product['quantity'];
             if ($result['customizedDatas'] && isset($result['customizedDatas'][(int) $product['id_product']][(int) $product['id_product_attribute']])) {
                 foreach ($result['customizedDatas'][(int) $product['id_product']][(int) $product['id_product_attribute']] as $addresses) {
                     foreach ($addresses as $customization) {
                         $product['quantity_without_customization'] -= (int) $customization['quantity'];
                     }
                 }
             }
         }
         if ($result['customizedDatas']) {
             Product::addCustomizationPrice($result['summary']['products'], $result['customizedDatas']);
         }
         $json = '';
         Hook::exec('actionCartListOverride', array('summary' => $result, 'json' => &$json));
         $this->ajaxDie(Tools::jsonEncode(array_merge($result, (array) Tools::jsonDecode($json, true))));
     } elseif (file_exists(_PS_MODULE_DIR_ . '/blockcart/blockcart-ajax.php')) {
         require_once _PS_MODULE_DIR_ . '/blockcart/blockcart-ajax.php';
     }
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:47,代码来源:CartController.php

示例4: _getCarrierList

 protected function _getCarrierList()
 {
     $address_delivery = new Address($this->context->cart->id_address_delivery);
     $cms = new CMS(Configuration::get('PS_CONDITIONS_CMS_ID'), $this->context->language->id);
     $link_conditions = $this->context->link->getCMSLink($cms, $cms->link_rewrite);
     if (!strpos($link_conditions, '?')) {
         $link_conditions .= '?content_only=1';
     } else {
         $link_conditions .= '&content_only=1';
     }
     $carriers = $this->context->cart->simulateCarriersOutput();
     $delivery_option = $this->context->cart->getDeliveryOption(null, false, false);
     $wrapping_fees = $this->context->cart->getGiftWrappingPrice(false);
     $wrapping_fees_tax_inc = $wrapping_fees = $this->context->cart->getGiftWrappingPrice();
     $oldMessage = Message::getMessageByCartId((int) $this->context->cart->id);
     $free_shipping = false;
     foreach ($this->context->cart->getCartRules() as $rule) {
         if ($rule['free_shipping'] && !$rule['carrier_restriction']) {
             $free_shipping = true;
             break;
         }
     }
     $this->context->smarty->assign('isVirtualCart', $this->context->cart->isVirtualCart());
     $vars = array('free_shipping' => $free_shipping, 'checkedTOS' => (int) $this->context->cookie->checkedTOS, 'recyclablePackAllowed' => (int) Configuration::get('PS_RECYCLABLE_PACK'), 'giftAllowed' => (int) Configuration::get('PS_GIFT_WRAPPING'), 'cms_id' => (int) Configuration::get('PS_CONDITIONS_CMS_ID'), 'conditions' => (int) Configuration::get('PS_CONDITIONS'), 'link_conditions' => $link_conditions, 'recyclable' => (int) $this->context->cart->recyclable, 'gift_wrapping_price' => (double) $wrapping_fees, 'total_wrapping_cost' => Tools::convertPrice($wrapping_fees_tax_inc, $this->context->currency), 'total_wrapping_tax_exc_cost' => Tools::convertPrice($wrapping_fees, $this->context->currency), 'delivery_option_list' => $this->context->cart->getDeliveryOptionList(), 'carriers' => $carriers, 'checked' => $this->context->cart->simulateCarrierSelectedOutput(), 'delivery_option' => $delivery_option, 'address_collection' => $this->context->cart->getAddressCollection(), 'opc' => true, 'oldMessage' => isset($oldMessage['message']) ? $oldMessage['message'] : '', 'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array('carriers' => $carriers, 'delivery_option_list' => $this->context->cart->getDeliveryOptionList(), 'delivery_option' => $delivery_option)));
     Cart::addExtraCarriers($vars);
     $this->context->smarty->assign($vars);
     if (!Address::isCountryActiveById((int) $this->context->cart->id_address_delivery) && $this->context->cart->id_address_delivery != 0) {
         $this->errors[] = Tools::displayError('This address is not in a valid area.');
     } elseif ((!Validate::isLoadedObject($address_delivery) || $address_delivery->deleted) && $this->context->cart->id_address_delivery != 0) {
         $this->errors[] = Tools::displayError('This address is invalid.');
     } else {
         $result = array('HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array('carriers' => $carriers, 'delivery_option_list' => $this->context->cart->getDeliveryOptionList(), 'delivery_option' => $this->context->cart->getDeliveryOption(null, true))), 'carrier_block' => $this->context->smarty->fetch(_PS_THEME_DIR_ . 'order-carrier.tpl'));
         Cart::addExtraCarriers($result);
         return $result;
     }
     if (count($this->errors)) {
         return array('hasError' => true, 'errors' => $this->errors, 'carrier_block' => $this->context->smarty->fetch(_PS_THEME_DIR_ . 'order-carrier.tpl'));
     }
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:39,代码来源:OrderOpcController.php

示例5: displayAjax

 /**
  * Display ajax content (this function is called instead of classic display, in ajax mode)
  */
 public function displayAjax()
 {
     if ($this->errors) {
         die(Tools::jsonEncode(array('hasError' => true, 'errors' => $this->errors)));
     }
     if ($this->ajax_refresh) {
         die(Tools::jsonEncode(array('refresh' => true)));
     }
     if (Tools::getIsset('summary')) {
         $result = array();
         if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
             $groups = Validate::isLoadedObject($this->context->customer) ? $this->context->customer->getGroups() : array(1);
             if ($this->context->cart->id_address_delivery) {
                 $deliveryAddress = new Address($this->context->cart->id_address_delivery);
             }
             $id_country = isset($deliveryAddress) && $deliveryAddress->id ? $deliveryAddress->id_country : Configuration::get('PS_COUNTRY_DEFAULT');
             Cart::addExtraCarriers($result);
         }
         $result['summary'] = $this->context->cart->getSummaryDetails(null, true);
         $result['customizedDatas'] = Product::getAllCustomizedDatas($this->context->cart->id, null, true);
         $result['HOOK_SHOPPING_CART'] = Hook::exec('displayShoppingCartFooter', $result['summary']);
         $result['HOOK_SHOPPING_CART_EXTRA'] = Hook::exec('displayShoppingCart', $result['summary']);
         foreach ($result['summary']['products'] as $key => &$product) {
             $product['quantity_without_customization'] = $product['quantity'];
             if ($result['customizedDatas']) {
                 foreach ($result['customizedDatas'][(int) $product['id_product']][(int) $product['id_product_attribute']] as $addresses) {
                     foreach ($addresses as $customization) {
                         $product['quantity_without_customization'] -= (int) $customization['quantity'];
                     }
                 }
             }
             $product['price_without_quantity_discount'] = Product::getPriceStatic($product['id_product'], !Product::getTaxCalculationMethod(), $product['id_product_attribute'], 6, null, false, false);
         }
         if ($result['customizedDatas']) {
             Product::addCustomizationPrice($result['summary']['products'], $result['customizedDatas']);
         }
         die(Tools::jsonEncode($result));
     } elseif (file_exists(_PS_MODULE_DIR_ . '/blockcart/blockcart-ajax.php')) {
         require_once _PS_MODULE_DIR_ . '/blockcart/blockcart-ajax.php';
     }
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:44,代码来源:CartController.php

示例6: _assignCarrier

 protected function _assignCarrier()
 {
     $address = new Address($this->context->cart->id_address_delivery);
     $id_zone = Address::getZoneById($address->id);
     if (!Address::isCountryActiveById((int) $this->context->cart->id_address_delivery) || !Address::isCountryActiveById((int) $this->context->cart->id_address_invoice)) {
         Tools::redirect('index.php?controller=order&step=1');
     }
     $carriers = $this->context->cart->simulateCarriersOutput();
     $checked = $this->context->cart->simulateCarrierSelectedOutput();
     $delivery_option_list = $this->context->cart->getDeliveryOptionList();
     $this->setDefaultCarrierSelection($delivery_option_list);
     $this->context->smarty->assign(array('address_collection' => $this->context->cart->getAddressCollection(), 'delivery_option_list' => $delivery_option_list, 'carriers' => $carriers, 'checked' => $checked, 'delivery_option' => $this->context->cart->getDeliveryOption(null, false)));
     $vars = array('HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array('carriers' => $carriers, 'checked' => $checked, 'delivery_option_list' => $delivery_option_list, 'delivery_option' => $this->context->cart->getDeliveryOption(null, false))));
     Cart::addExtraCarriers($vars);
     $this->context->smarty->assign($vars);
 }
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:16,代码来源:ParentOrderController.php

示例7: init

 public function init()
 {
     ParentOrderController::init();
     if ($this->nbProducts) {
         $this->context->smarty->assign('virtual_cart', $this->context->cart->isVirtualCart());
     }
     $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);
     if ($this->context->cart->nbProducts()) {
         if (Tools::isSubmit('ajax')) {
             if (Tools::isSubmit('method')) {
                 switch (Tools::getValue('method')) {
                     case 'updateMessage':
                         if (Tools::isSubmit('message')) {
                             $txt_message = urldecode(Tools::getValue('message'));
                             $this->_updateMessage($txt_message);
                             if (count($this->errors)) {
                                 $this->ajaxDie('{"hasError" : true, "errors" : ["' . implode('\',\'', $this->errors) . '"]}');
                             }
                             $this->ajaxDie(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();
                             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);
                                 $this->ajaxDie(Tools::jsonEncode($return));
                             } else {
                                 $this->errors[] = Tools::displayError('An error occurred while updating the cart.');
                             }
                             if (count($this->errors)) {
                                 $this->ajaxDie('{"hasError" : true, "errors" : ["' . implode('\',\'', $this->errors) . '"]}');
                             }
                             exit;
                         }
                         break;
                     case 'updateTOSStatusAndGetPayments':
                         if (Tools::isSubmit('checked')) {
                             $this->context->cookie->checkedTOS = (int) Tools::getValue('checked');
                             $this->ajaxDie(Tools::jsonEncode(array('HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'), 'HOOK_PAYMENT' => $this->_getPaymentMethods())));
                         }
                         break;
                     case 'getCarrierList':
                         $this->ajaxDie(Tools::jsonEncode($this->_getCarrierList()));
                         break;
                     case 'editCustomer':
                         if (!$this->isLogged || !$this->context->customer->is_guest) {
                             exit;
                         }
                         if (Validate::isEmail($email = Tools::getValue('email')) && !empty($email)) {
                             if (Customer::customerExists($email)) {
                                 $this->errors[] = Tools::displayError('An account using this email address has already been registered.', false);
                             }
                         }
                         if (Tools::getValue('years')) {
                             $this->context->customer->birthday = (int) Tools::getValue('years') . '-' . (int) Tools::getValue('months') . '-' . (int) Tools::getValue('days');
                         }
                         $_POST['lastname'] = $_POST['customer_lastname'];
                         $_POST['firstname'] = $_POST['customer_firstname'];
                         if (isset($_POST['customer_fax'])) {
                             $_POST['fax'] = $_POST['customer_fax'];
                         }
                         if (isset($_POST['customer_details_website'])) {
                             $_POST['details_website'] = $_POST['customer_details_website'];
                         }
                         $this->errors = array_merge($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));
                         if (!count($this->errors)) {
                             $return['isSaved'] = (bool) $this->context->customer->update();
                         } else {
                             $return['isSaved'] = false;
                         }
                         $this->ajaxDie(Tools::jsonEncode($return));
                         break;
                     case 'getAddressBlockAndCarriersAndPayments':
                         if ($this->context->customer->isLogged()) {
                             // check if customer have addresses
                             if (!Customer::getAddressesTotalById($this->context->customer->id)) {
                                 $this->ajaxDie(Tools::jsonEncode(array('no_address' => 1)));
                             }
                             if (file_exists(_PS_MODULE_DIR_ . 'blockuserinfo/blockuserinfo.php')) {
                                 include_once _PS_MODULE_DIR_ . 'blockuserinfo/blockuserinfo.php';
                                 $block_user_info = new BlockUserInfo();
                             }
                             $this->context->smarty->assign('isVirtualCart', $this->context->cart->isVirtualCart());
                             $this->_processAddressFormat();
                             $this->_assignAddress();
                             if (!($formated_address_fields_values_list = $this->context->smarty->getTemplateVars('formatedAddressFieldsValuesList'))) {
                                 $formated_address_fields_values_list = array();
                             }
                             // Wrapping fees
                             $wrapping_fees = $this->context->cart->getGiftWrappingPrice(false);
                             $wrapping_fees_tax_inc = $this->context->cart->getGiftWrappingPrice();
                             $return = array_merge(array('order_opc_adress' => $this->context->smarty->fetch(_PS_THEME_DIR_ . 'order-address.tpl'), 'block_user_info' => isset($block_user_info) ? $block_user_info->hookDisplayTop(array()) : '', 'formatedAddressFieldsValuesList' => $formated_address_fields_values_list, 'carrier_data' => $this->_getCarrierList(), 'HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'), 'HOOK_PAYMENT' => $this->_getPaymentMethods(), 'no_address' => 0, 'gift_price' => Tools::displayPrice(Tools::convertPrice(Product::getTaxCalculationMethod() == 1 ? $wrapping_fees : $wrapping_fees_tax_inc, new Currency((int) $this->context->cookie->id_currency)))), $this->getFormatedSummaryDetail());
                             $this->ajaxDie(Tools::jsonEncode($return));
//.........这里部分代码省略.........
开发者ID:vadia007,项目名称:paintings,代码行数:101,代码来源:OrderOpcController.php


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