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


PHP mslib_fe::getUserGroupDiscount方法代码示例

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


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

示例1: getCart


//.........这里部分代码省略.........
             $tax_rate = mslib_fe::taxRuleSet($payment_method['tax_id'], 0, $iso_customer['cn_iso_nr'], 0);
             if ($this->ms['MODULES']['DISABLE_VAT_RATE']) {
                 $tax_rate['total_tax_rate'] = 0;
             }
             $payment_tax_rate = $tax_rate['total_tax_rate'] / 100;
             if ($shipping_tax_rate > 0) {
                 if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) {
                     //$shipping_tax=mslib_fe::taxDecimalCrop($this->cart['user']['shipping_method_costs']*$shipping_tax_rate, 2, false);
                     $shipping_tax = round($this->cart['user']['shipping_method_costs'] * $shipping_tax_rate, 2);
                 } else {
                     $shipping_tax = $this->cart['user']['shipping_method_costs'] * $shipping_tax_rate;
                 }
             }
             if ($payment_tax_rate > 0) {
                 if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) {
                     //$payment_tax=mslib_fe::taxDecimalCrop($this->cart['user']['payment_method_costs']*$payment_tax_rate, 2, false);
                     $payment_tax = round($this->cart['user']['payment_method_costs'] * $payment_tax_rate, 2);
                 } else {
                     $payment_tax = $this->cart['user']['payment_method_costs'] * $payment_tax_rate;
                 }
             }
             if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) {
                 $this->cart['user']['shipping_method_costs_including_vat'] = $this->cart['user']['shipping_method_costs'] + $shipping_tax;
                 $this->cart['user']['payment_method_costs_including_vat'] = $this->cart['user']['payment_method_costs'] + $payment_tax;
             } else {
                 $this->cart['user']['shipping_method_costs_including_vat'] = round($this->cart['user']['shipping_method_costs'] + $this->cart['user']['shipping_method_costs'] * $shipping_tax_rate, 2);
                 $this->cart['user']['payment_method_costs_including_vat'] = round($this->cart['user']['payment_method_costs'] + $this->cart['user']['payment_method_costs'] * $payment_tax_rate, 2);
             }
             // discount
             if (!$this->cart['discount'] and !$GLOBALS["TSFE"]->fe_user->user['uid'] and $this->cart['user']['email']) {
                 // check if guest user is already in the database and if so add possible group discount
                 $user_check = mslib_fe::getUser($this->cart['user']['email'], 'email');
                 if ($user_check['uid']) {
                     $discount_percentage = mslib_fe::getUserGroupDiscount($user_check['uid']);
                     if ($discount_percentage) {
                         $this->cart['coupon_code'] = '';
                         $this->cart['discount'] = $discount_percentage;
                         $this->cart['discount_type'] = 'percentage';
                     }
                 }
             }
             if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) {
                 $subtotal = $this->cart['summarize']['sub_total'];
             } else {
                 $subtotal = $this->cart['summarize']['sub_total_including_vat'];
             }
             $subtotal_tax = $this->cart['summarize']['sub_total_including_vat'] - $this->cart['summarize']['sub_total'];
             if ($this->cart['discount']) {
                 switch ($this->cart['discount_type']) {
                     case 'percentage':
                         $discount_percentage = $this->cart['discount'];
                         if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) {
                             $discount_price = round($this->cart['summarize']['sub_total'] / 100 * $discount_percentage, 2);
                             $subtotal = $this->cart['summarize']['sub_total'] / 100 * (100 - $discount_percentage);
                         } else {
                             $discount_price = round($this->cart['summarize']['sub_total_including_vat'] / 100 * $discount_percentage, 2);
                             $subtotal = $this->cart['summarize']['sub_total_including_vat'] / 100 * (100 - $discount_percentage);
                         }
                         if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
                             $subtotal_tax = round((1 - $discount_price / $this->cart['summarize']['sub_total_including_vat']) * ($this->cart['summarize']['sub_total_including_vat'] - $this->cart['summarize']['sub_total']), 2);
                         } else {
                             $subtotal_tax = ($this->cart['summarize']['sub_total_including_vat'] - $this->cart['summarize']['sub_total']) / 100 * (100 - $discount_percentage);
                         }
                         $this->cart['discount_amount'] = $discount_price;
                         $this->cart['discount_percentage'] = $discount_percentage;
                         break;
开发者ID:bvbmedia,项目名称:multishop,代码行数:67,代码来源:class.tx_mslib_cart.php

示例2: die

<?php

if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}
require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'pi1/classes/class.tx_mslib_cart.php';
$content = '0%';
// first check group discount
if ($GLOBALS["TSFE"]->fe_user->user['uid']) {
    $discount_percentage = mslib_fe::getUserGroupDiscount($GLOBALS["TSFE"]->fe_user->user['uid']);
    if ($discount_percentage) {
        $mslib_cart = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_mslib_cart');
        $mslib_cart->init($this);
        $cart = $mslib_cart->getCart();
        $cart['coupon_code'] = '';
        $cart['discount'] = $discount_percentage;
        $cart['discount_type'] = 'percentage';
        //$GLOBALS['TSFE']->fe_user->setKey('ses', $this->cart_page_uid, $cart);
        //$GLOBALS['TSFE']->fe_user->storeSessionData();
        tx_mslib_cart::storeCart($cart);
        $content = number_format($discount_percentage) . '%';
    }
}
//if(!$discount_percentage)
if (!empty($_POST['code']) && $_POST['code'] != 'undefined') {
    $code = mslib_fe::RemoveXSS(mslib_befe::strtolower($_POST['code']));
    $time = time();
    $str = "SELECT * from tx_multishop_coupons where code = '" . addslashes($code) . "' and status = 1 and (page_uid=0 or page_uid='" . $this->showCatalogFromPage . "') and (startdate <= '" . $time . "' and enddate >= '" . $time . "')";
    $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
    if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry) > 0) {
        $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry);
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:get_discount.php


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