本文整理汇总了PHP中Discount::getVouchersToCartDisplay方法的典型用法代码示例。如果您正苦于以下问题:PHP Discount::getVouchersToCartDisplay方法的具体用法?PHP Discount::getVouchersToCartDisplay怎么用?PHP Discount::getVouchersToCartDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Discount
的用法示例。
在下文中一共展示了Discount::getVouchersToCartDisplay方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _assignSummaryInformations
protected function _assignSummaryInformations()
{
global $currency;
if (file_exists(_PS_SHIP_IMG_DIR_ . (int) self::$cart->id_carrier . '.jpg')) {
self::$smarty->assign('carrierPicture', 1);
}
$summary = self::$cart->getSummaryDetails();
$customizedDatas = Product::getAllCustomizedDatas((int) self::$cart->id);
Product::addCustomizationPrice($summary['products'], $customizedDatas);
if ($free_ship = Tools::convertPrice((double) Configuration::get('PS_SHIPPING_FREE_PRICE'), new Currency((int) self::$cart->id_currency))) {
$discounts = self::$cart->getDiscounts();
$total_free_ship = $free_ship - ($summary['total_products_wt'] + $summary['total_discounts']);
foreach ($discounts as $discount) {
if ($discount['id_discount_type'] == 3) {
$total_free_ship = 0;
break;
}
}
self::$smarty->assign('free_ship', $total_free_ship);
}
// for compatibility with 1.2 themes
foreach ($summary['products'] as $key => $product) {
$summary['products'][$key]['quantity'] = $product['cart_quantity'];
}
self::$smarty->assign($summary);
self::$smarty->assign(array('token_cart' => Tools::getToken(false), 'isVirtualCart' => self::$cart->isVirtualCart(), 'productNumber' => self::$cart->nbProducts(), 'voucherAllowed' => Configuration::get('PS_VOUCHERS'), 'shippingCost' => self::$cart->getOrderTotal(true, Cart::ONLY_SHIPPING), 'shippingCostTaxExc' => self::$cart->getOrderTotal(false, Cart::ONLY_SHIPPING), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'lastProductAdded' => self::$cart->getLastProduct(), 'displayVouchers' => Discount::getVouchersToCartDisplay((int) self::$cookie->id_lang, isset(self::$cookie->id_customer) ? (int) self::$cookie->id_customer : 0), 'currencySign' => $currency->sign, 'currencyRate' => $currency->conversion_rate, 'currencyFormat' => $currency->format, 'currencyBlank' => $currency->blank));
self::$smarty->assign(array('HOOK_SHOPPING_CART' => Module::hookExec('shoppingCart', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Module::hookExec('shoppingCartExtra', $summary)));
}
示例2: _assignSummaryInformations
protected function _assignSummaryInformations()
{
$summary = $this->context->cart->getSummaryDetails();
$customizedDatas = Product::getAllCustomizedDatas($this->context->cart->id);
// override customization tax rate with real tax (tax rules)
if ($customizedDatas) {
foreach ($summary['products'] as &$productUpdate) {
$productId = (int) (isset($productUpdate['id_product']) ? $productUpdate['id_product'] : $productUpdate['product_id']);
$productAttributeId = (int) (isset($productUpdate['id_product_attribute']) ? $productUpdate['id_product_attribute'] : $productUpdate['product_attribute_id']);
if (isset($customizedDatas[$productId][$productAttributeId])) {
$productUpdate['tax_rate'] = Tax::getProductTaxRate($productId, $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
}
}
Product::addCustomizationPrice($summary['products'], $customizedDatas);
}
foreach ($summary['products'] as $key => &$product) {
$product['quantity'] = $product['cart_quantity'];
// for compatibility with 1.2 themes
$product['price_without_specific_price'] = Product::getPriceStatic($product['id_product'], !Product::getTaxCalculationMethod(), $product['id_product_attribute'], 2, null, false, false);
if (Product::getTaxCalculationMethod()) {
$product['is_discounted'] = $product['price_without_specific_price'] != $product['price'];
} else {
$product['is_discounted'] = $product['price_without_specific_price'] != $product['price_wt'];
}
}
$show_option_allow_separate_package = !$this->context->cart->isAllProductsInStock(true) && Configuration::get('PS_SHIP_WHEN_AVAILABLE');
$this->context->smarty->assign($summary);
$this->context->smarty->assign(array('token_cart' => Tools::getToken(false), 'isVirtualCart' => $this->context->cart->isVirtualCart(), 'productNumber' => $this->context->cart->nbProducts(), 'voucherAllowed' => Configuration::get('PS_VOUCHERS') && CartRule::isFeatureActive(), 'shippingCost' => $this->context->cart->getOrderTotal(true, Cart::ONLY_SHIPPING), 'shippingCostTaxExc' => $this->context->cart->getOrderTotal(false, Cart::ONLY_SHIPPING), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'lastProductAdded' => $this->context->cart->getLastProduct(), 'displayVouchers' => Discount::getVouchersToCartDisplay($this->context->language->id, isset($this->context->customer->id) ? $this->context->customer->id : 0), 'currencySign' => $this->context->currency->sign, 'currencyRate' => $this->context->currency->conversion_rate, 'currencyFormat' => $this->context->currency->format, 'currencyBlank' => $this->context->currency->blank, 'show_option_allow_separate_package' => $show_option_allow_separate_package));
$this->context->smarty->assign(array('HOOK_SHOPPING_CART' => Hook::exec('displayShoppingCartFooter', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Hook::exec('displayShoppingCart', $summary)));
}
示例3: Discount
}
$cart->addCartRule($voucher->id);
} else {
$voucher = new Discount();
$voucher->id_discount_type = 2;
$voucher->value = $amount;
$languages = Language::getLanguages(true);
$voucher->name = 'Fid\'Bag';
$voucher->description = 'Discount Fid\'Bag';
$voucher->id_customer = (int) $cart->id_customer;
$voucher->id_currency = (int) $cart->id_currency;
$voucher->quantity = 1;
$voucher->quantity_per_user = 1;
$voucher->cumulable = 1;
$voucher->cumulable_reduction = 1;
$voucher->minimal = (double) $voucher->value;
$voucher->include_tax = 1;
$voucher->active = 1;
$voucher->cart_display = 1;
$now = time();
$voucher->date_from = date('Y-m-d H:i:s', $now);
$voucher->date_to = date('Y-m-d H:i:s', $now + 3600 * 24 * 365.25);
if (!$voucher->validateFieldsLang(false) || !$voucher->add()) {
die('0');
}
$cart->addDiscount($voucher->id);
Discount::getVouchersToCartDisplay(1, $cart->id_customer);
}
}
$values = array('total' => Tools::ps_round($cart->getOrderTotal(), $currency->decimals), 'discount' => $amount);
die(Tools::jsonEncode($values));
示例4: foreach
foreach ($discounts as $discount) {
if ($discount['id_discount_type'] == 3 || $discount['id_discount_type'] == 4 || $discount['id_discount_type'] == 5) {
$total_free_ship = 0;
break;
}
}
$smarty->assign('free_ship', $total_free_ship);
}
// for compatibility with 1.2 themes
foreach ($summary['products'] as $key => $product) {
$summary['products'][$key]['quantity'] = $product['cart_quantity'];
}
$smarty->assign($summary);
$address = new Address((int) $cart->id_address_delivery);
$smarty->assign('delivery_address', $address);
$smarty->assign(array('token_cart' => Tools::getToken(false), 'isVirtualCart' => $cart->isVirtualCart(), 'productNumber' => $cart->nbProducts(), 'voucherAllowed' => Configuration::get('PS_VOUCHERS'), 'shippingCost' => $cart->getOrderTotal(true, Cart::ONLY_SHIPPING), 'codCharge' => COD_CHARGE, 'shippingCostTaxExc' => $cart->getOrderTotal(false, Cart::ONLY_SHIPPING), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'lastProductAdded' => $cart->getLastProduct(), 'displayVouchers' => Discount::getVouchersToCartDisplay((int) $cookie->id_lang, isset($cookie->id_customer) ? (int) $cookie->id_customer : 0), 'currencySign' => $currency->sign, 'currencyRate' => $currency->conversion_rate, 'currencyFormat' => $currency->format, 'currencyBlank' => $currency->blank));
/* Validate order */
if (Tools::getValue('confirm')) {
$customer = new Customer((int) $cart->id_customer);
$total = $cart->getOrderTotal(true, Cart::BOTH, false);
$cashOnDelivery->validateOrder((int) $cart->id, _PS_OS_COD_PENDING_CONFIRMATION, $total, $cashOnDelivery->displayName, NULL, array(), NULL, false, $customer->secure_key);
$order = new Order((int) $cashOnDelivery->currentOrder);
Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $customer->secure_key . '&id_cart=' . (int) $cart->id . '&id_module=' . (int) $cashOnDelivery->id . '&id_order=' . (int) $cashOnDelivery->currentOrder);
} else {
/* or ask for confirmation */
$smarty->assign(array('total' => $cart->getOrderTotal(true, Cart::BOTH, false), 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/cashondelivery/'));
$smarty->assign('this_path', __PS_BASE_URI__ . 'modules/cashondelivery/');
$template = 'validation.tpl';
echo Module::display('cashondelivery', $template);
}
include dirname(__FILE__) . '/../../footer.php';