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


PHP ShoppingCart::displayNoTaxMessage方法代码示例

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


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

示例1: afterLogin

 protected function afterLogin($fromCookie)
 {
     if (!$fromCookie) {
         // Assign the user to the cart, if logged in
         Yii::app()->shoppingcart->assignCustomer(Yii::app()->user->id);
         // If the user is not a guest user, then update the tax destination
         // for the user's cart to display correct product prices. We can't
         // do this for guest users since it will reset their cart to the
         // store default, which is generally not what we want, especially
         // not in tax-inclusive environments when the shipping destination
         // is in a notax region.
         if ($this->getIsGuest() !== true) {
             Yii::app()->shoppingcart->setTaxCodeByDefaultShippingAddress();
         }
         // Since we have successfully logged in, see if we have a cart in progress
         $cartInProgressFound = Yii::app()->shoppingcart->loginMerge();
         // Recalculate and update the cart if prices of any cart items have changed
         if ($cartInProgressFound === true) {
             Yii::app()->shoppingcart->verifyPrices();
             Yii::log("Cart ID is " . Yii::app()->shoppingcart->id, 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
         }
         // Display no-tax message if the customer's default shipping address is
         // in no-tax destination in tax-inclusive mode
         if (Yii::app()->params['TAX_INCLUSIVE_PRICING'] == 1) {
             ShoppingCart::displayNoTaxMessage();
         }
     } else {
         Yii::log("User Login using cookie", 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:30,代码来源:WebUser.php

示例2: actionAddress

 public function actionAddress()
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect($this->createUrl("/myaccount"));
     }
     $this->breadcrumbs = array(Yii::t('global', 'My Account') => $this->createUrl("/myaccount"), Yii::t('global', 'Add an address') => $this->createUrl("myaccount/address"));
     $model = new CustomerAddress();
     $model->country_id = _xls_get_conf('DEFAULT_COUNTRY', 224);
     $checkout = new CheckoutForm();
     //For logged in users we grab the current model
     $objCustomer = Customer::GetCurrent();
     $id = null;
     if (Yii::app()->getRequest()->getParam('id') != null) {
         $id = Yii::app()->getRequest()->getParam('id');
     } elseif (isset($_POST['CustomerAddress']) && isset($_POST['CustomerAddress']['id'])) {
         $id = $_POST['CustomerAddress']['id'];
     }
     $objAddress = CustomerAddress::model()->findByPk($id);
     if ($id && $objAddress instanceof CustomerAddress && $objAddress->customer_id == Yii::app()->user->id) {
         $model = $objAddress;
     }
     // collect user input data
     if (isset($_POST['CustomerAddress'])) {
         $model->setScenario('Default');
         $model->attributes = $_POST['CustomerAddress'];
         if ($model->validate()) {
             $model->customer_id = $objCustomer->id;
             if (!$model->save()) {
                 Yii::log('Error creating new customer address ' . print_r($model->getErrors(), true), 'error', 'application.' . __CLASS__ . '.' . __FUNCTION__);
             }
             if (CPropertyValue::ensureBoolean($model->makeDefaultBilling) === true) {
                 $objCustomer->default_billing_id = $model->id;
             } elseif (CPropertyValue::ensureInteger($objCustomer->default_billing_id) === CPropertyValue::ensureInteger($model->id)) {
                 $objCustomer->default_billing_id = null;
             }
             if (CPropertyValue::ensureBoolean($model->makeDefaultShipping) === true) {
                 $objCustomer->default_shipping_id = $model->id;
             } elseif (CPropertyValue::ensureInteger($objCustomer->default_shipping_id) === CPropertyValue::ensureInteger($model->id)) {
                 $objCustomer->default_shipping_id = null;
             }
             $objCustomer->save();
             ShoppingCart::displayNoTaxMessage();
             try {
                 Yii::app()->shoppingcart->setTaxCodeByDefaultShippingAddress();
             } catch (Exception $e) {
                 Yii::log('Error updating customer cart ' . $e->getMessage(), 'error', 'application.' . __CLASS__ . '.' . __FUNCTION__);
             }
             Yii::app()->shoppingcart->save();
             if (Yii::app()->request->isAjaxRequest === false) {
                 $this->redirect($this->createUrl("/myaccount"));
             }
         }
     }
     if ($id && $objCustomer->default_billing_id == $model->id) {
         $model->makeDefaultBilling = 1;
     }
     if ($id && $objCustomer->default_shipping_id == $model->id) {
         $model->makeDefaultShipping = 1;
     }
     // Added Ajax for Brooklyn2014
     if (Yii::app()->request->isAjaxRequest) {
         unset($model->password);
         $errors = $model->getErrors();
         if (empty($errors) === false) {
             $response = array('status' => 'error', 'errors' => $errors);
         } else {
             $response = array('status' => 'success', 'address' => $model);
         }
         $this->renderJSON($response);
     } else {
         $this->render('address', array('model' => $model, 'checkout' => $checkout));
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:73,代码来源:MyaccountController.php


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