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


PHP Discount::display方法代码示例

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


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

示例1: initContent

 /**
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $shop_name = htmlentities(Configuration::get('PS_SHOP_NAME'), NULL, 'utf-8');
     $shop_url = Tools::getHttpHost(true, true);
     $customer = Context::getContext()->customer;
     if (!preg_match("#.*\\.html\$#Ui", Tools::getValue('mail')) or !preg_match("#.*\\.html\$#Ui", Tools::getValue('mail'))) {
         die(Tools::redirect());
     }
     $file = file_get_contents(dirname(__FILE__) . '/../../mails/' . strval(preg_replace('#\\.{2,}#', '.', Tools::getValue('mail'))));
     $file = str_replace('{shop_name}', $shop_name, $file);
     $file = str_replace('{shop_url}', $shop_url . __PS_BASE_URI__, $file);
     $file = str_replace('{shop_logo}', $shop_url . _PS_IMG_ . 'logo.jpg', $file);
     $file = str_replace('{firstname}', $customer->firstname, $file);
     $file = str_replace('{lastname}', $customer->lastname, $file);
     $file = str_replace('{email}', $customer->email, $file);
     $file = str_replace('{firstname_friend}', 'XXXXX', $file);
     $file = str_replace('{lastname_friend}', 'xxxxxx', $file);
     $file = str_replace('{link}', 'authentication.php?create_account=1', $file);
     $discount_type = (int) Configuration::get('REFERRAL_DISCOUNT_TYPE');
     if ($discount_type == 1) {
         $file = str_replace('{discount}', Discount::display((double) Configuration::get('REFERRAL_PERCENTAGE'), $discount_type, new Currency($this->context->currency->id)), $file);
     } else {
         $file = str_replace('{discount}', Discount::display((double) Configuration::get('REFERRAL_DISCOUNT_VALUE_' . $this->context->currency->id), $discount_type, new Currency($this->context->currency->id)), $file);
     }
     $this->context->smarty->assign(array('content' => $file));
     $this->setTemplate('email.tpl');
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:31,代码来源:email.php

示例2: initContent

 /**
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     // get discount value (ready to display)
     $discount_type = (int) Configuration::get('REFERRAL_DISCOUNT_TYPE');
     if ($discount_type == 1) {
         $discount = Discount::display((double) Configuration::get('REFERRAL_PERCENTAGE'), $discount_type, new Currency($this->context->currency->id));
     } else {
         $discount = Discount::display((double) Configuration::get('REFERRAL_DISCOUNT_VALUE_' . (int) $this->context->currency->id), $discount_type, new Currency($this->context->currency->id));
     }
     $activeTab = 'sponsor';
     $error = false;
     // Mailing invitation to friend sponsor
     $invitation_sent = false;
     $nbInvitation = 0;
     if (Tools::isSubmit('submitSponsorFriends') and Tools::getValue('friendsEmail') and sizeof($friendsEmail = Tools::getValue('friendsEmail')) >= 1) {
         $activeTab = 'sponsor';
         if (!Tools::getValue('conditionsValided')) {
             $error = 'conditions not valided';
         } else {
             $friendsLastName = Tools::getValue('friendsLastName');
             $friendsFirstName = Tools::getValue('friendsFirstName');
             $mails_exists = array();
             foreach ($friendsEmail as $key => $friendEmail) {
                 $friendEmail = strval($friendEmail);
                 $friendLastName = strval($friendsLastName[$key]);
                 $friendFirstName = strval($friendsFirstName[$key]);
                 if (empty($friendEmail) and empty($friendLastName) and empty($friendFirstName)) {
                     continue;
                 } elseif (empty($friendEmail) or !Validate::isEmail($friendEmail)) {
                     $error = 'email invalid';
                 } elseif (empty($friendFirstName) or empty($friendLastName) or !Validate::isName($friendLastName) or !Validate::isName($friendFirstName)) {
                     $error = 'name invalid';
                 } elseif (ReferralProgramModule::isEmailExists($friendEmail) or Customer::customerExists($friendEmail)) {
                     $mails_exists[] = $friendEmail;
                 } else {
                     $referralprogram = new ReferralProgramModule();
                     $referralprogram->id_sponsor = (int) $this->context->customer->id;
                     $referralprogram->firstname = $friendFirstName;
                     $referralprogram->lastname = $friendLastName;
                     $referralprogram->email = $friendEmail;
                     if (!$referralprogram->validateFields(false)) {
                         $error = 'name invalid';
                     } else {
                         if ($referralprogram->save()) {
                             if (Configuration::get('PS_CIPHER_ALGORITHM')) {
                                 $cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
                             } else {
                                 $cipherTool = new Blowfish(_COOKIE_KEY_, _COOKIE_IV_);
                             }
                             $vars = array('{email}' => strval($this->context->customer->email), '{lastname}' => strval($this->context->customer->lastname), '{firstname}' => strval($this->context->customer->firstname), '{email_friend}' => $friendEmail, '{lastname_friend}' => $friendLastName, '{firstname_friend}' => $friendFirstName, '{link}' => Context::getContext()->link->getPageLink('authentication', true, Context::getContext()->language->id, 'create_account=1&sponsor=' . urlencode($cipherTool->encrypt($referralprogram->id . '|' . $referralprogram->email . '|')), false), '{discount}' => $discount);
                             Mail::Send((int) $this->context->language->id, 'referralprogram-invitation', Mail::l('Referral Program', (int) $this->context->language->id), $vars, $friendEmail, $friendFirstName . ' ' . $friendLastName, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__) . '/../../mails/');
                             $invitation_sent = true;
                             $nbInvitation++;
                             $activeTab = 'pending';
                         } else {
                             $error = 'cannot add friends';
                         }
                     }
                 }
                 if ($error) {
                     break;
                 }
             }
             if ($nbInvitation > 0) {
                 unset($_POST);
             }
             //Not to stop the sending of e-mails in case of doubloon
             if (sizeof($mails_exists)) {
                 $error = 'email exists';
             }
         }
     }
     // Mailing revive
     $revive_sent = false;
     $nbRevive = 0;
     if (Tools::isSubmit('revive')) {
         $activeTab = 'pending';
         if (Tools::getValue('friendChecked') and sizeof($friendsChecked = Tools::getValue('friendChecked')) >= 1) {
             foreach ($friendsChecked as $key => $friendChecked) {
                 if (ReferralProgramModule::isSponsorFriend((int) $this->context->customer->id, (int) $friendChecked)) {
                     if (Configuration::get('PS_CIPHER_ALGORITHM')) {
                         $cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
                     } else {
                         $cipherTool = new Blowfish(_COOKIE_KEY_, _COOKIE_IV_);
                     }
                     $referralprogram = new ReferralProgramModule((int) $key);
                     $vars = array('{email}' => $this->context->customer->email, '{lastname}' => $this->context->customer->lastname, '{firstname}' => $this->context->customer->firstname, '{email_friend}' => $referralprogram->email, '{lastname_friend}' => $referralprogram->lastname, '{firstname_friend}' => $referralprogram->firstname, '{link}' => Context::getContext()->link->getPageLink('authentication', true, Context::getContext()->language->id, 'create_account=1&sponsor=' . urlencode($cipherTool->encrypt($referralprogram->id . '|' . $referralprogram->email . '|')), false), '{discount}' => $discount);
                     $referralprogram->save();
                     Mail::Send((int) $this->context->language->id, 'referralprogram-invitation', Mail::l('Referral Program', (int) $this->context->language->id), $vars, $referralprogram->email, $referralprogram->firstname . ' ' . $referralprogram->lastname, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__) . '/../../mails/');
                     $revive_sent = true;
                     $nbRevive++;
                 }
             }
         } else {
             $error = 'no revive checked';
         }
//.........这里部分代码省略.........
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:101,代码来源:program.php

示例3: htmlentities

<?php

require_once '../../config/config.inc.php';
require_once '../../init.php';
/*
if (!$cookie->isLogged())
	Tools::redirect('../../authentication.php?back=modules/referralprogram/referralprogram-program.php');
*/
$shop_name = htmlentities(Configuration::get('PS_SHOP_NAME'), NULL, 'utf-8');
$shop_url = 'http://' . Tools::getHttpHost(false, true);
$customer = new Customer(intval($cookie->id_customer));
if (!preg_match("#.*\\.html\$#Ui", Tools::getValue('mail')) or !preg_match("#.*\\.html\$#Ui", Tools::getValue('mail'))) {
    die(Tools::displayError());
}
$file = file_get_contents(dirname(__FILE__) . '/mails/' . strval(preg_replace('#\\.{2,}#', '.', Tools::getValue('mail'))));
$file = str_replace('{shop_name}', $shop_name, $file);
$file = str_replace('{shop_url}', $shop_url . __PS_BASE_URI__, $file);
$file = str_replace('{shop_logo}', $shop_url . _PS_IMG_ . 'logo.jpg', $file);
$file = str_replace('{firstname}', $customer->firstname, $file);
$file = str_replace('{lastname}', $customer->lastname, $file);
$file = str_replace('{email}', $customer->email, $file);
$file = str_replace('{firstname_friend}', 'XXXXX', $file);
$file = str_replace('{lastname_friend}', 'xxxxxx', $file);
$file = str_replace('{link}', 'authentication.php?create_account=1', $file);
$file = str_replace('{discount}', Discount::display(floatval(Configuration::get('REFERRAL_DISCOUNT_VALUE_' . $cookie->id_currency)), intval(Configuration::get('REFERRAL_DISCOUNT_TYPE')), new Currency($cookie->id_currency)), $file);
echo $file;
开发者ID:vincent,项目名称:theinvertebrates,代码行数:26,代码来源:preview-email.php

示例4: htmlentities

*  International Registered Trademark & Property of PrestaShop SA
*/
require_once '../../config/config.inc.php';
require_once '../../init.php';
/*
if (!$cookie->isLogged())
	Tools::redirect('../../authentication.php?back=modules/referralprogram/referralprogram-program.php');
*/
$shop_name = htmlentities(Configuration::get('PS_SHOP_NAME'), NULL, 'utf-8');
$shop_url = Tools::getHttpHost(true, true);
$customer = new Customer((int) $cookie->id_customer);
if (!preg_match("#.*\\.html\$#Ui", Tools::getValue('mail')) or !preg_match("#.*\\.html\$#Ui", Tools::getValue('mail'))) {
    die(Tools::displayError());
}
$file = file_get_contents(dirname(__FILE__) . '/mails/' . strval(preg_replace('#\\.{2,}#', '.', Tools::getValue('mail'))));
$file = str_replace('{shop_name}', $shop_name, $file);
$file = str_replace('{shop_url}', $shop_url . __PS_BASE_URI__, $file);
$file = str_replace('{shop_logo}', $shop_url . _PS_IMG_ . 'logo.jpg', $file);
$file = str_replace('{firstname}', $customer->firstname, $file);
$file = str_replace('{lastname}', $customer->lastname, $file);
$file = str_replace('{email}', $customer->email, $file);
$file = str_replace('{firstname_friend}', 'XXXXX', $file);
$file = str_replace('{lastname_friend}', 'xxxxxx', $file);
$file = str_replace('{link}', 'authentication.php?create_account=1', $file);
$discount_type = (int) Configuration::get('REFERRAL_DISCOUNT_TYPE');
if ($discount_type == 1) {
    $file = str_replace('{discount}', Discount::display((double) Configuration::get('REFERRAL_PERCENTAGE'), $discount_type, new Currency($cookie->id_currency)), $file);
} else {
    $file = str_replace('{discount}', Discount::display((double) Configuration::get('REFERRAL_DISCOUNT_VALUE_' . $cookie->id_currency), $discount_type, new Currency($cookie->id_currency)), $file);
}
echo $file;
开发者ID:greench,项目名称:prestashop,代码行数:31,代码来源:preview-email.php

示例5: dirname

$useSSL = true;
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
include_once dirname(__FILE__) . '/ReferralProgramModule.php';
if (!$cookie->isLogged()) {
    Tools::redirect('authentication.php?back=modules/referralprogram/referralprogram-program.php');
}
Tools::addCSS(_PS_CSS_DIR_ . 'thickbox.css', 'all');
Tools::addJS(array(_PS_JS_DIR_ . 'jquery/thickbox-modified.js', _PS_JS_DIR_ . 'jquery/jquery.idTabs.modified.js'));
include dirname(__FILE__) . '/../../header.php';
// get discount value (ready to display)
$discount_type = (int) Configuration::get('REFERRAL_DISCOUNT_TYPE');
if ($discount_type == 1) {
    $discount = Discount::display((double) Configuration::get('REFERRAL_PERCENTAGE'), $discount_type, new Currency($cookie->id_currency));
} else {
    $discount = Discount::display((double) Configuration::get('REFERRAL_DISCOUNT_VALUE_' . (int) $cookie->id_currency), $discount_type, new Currency($cookie->id_currency));
}
$activeTab = 'sponsor';
$error = false;
// Mailing invitation to friend sponsor
$invitation_sent = false;
$nbInvitation = 0;
if (Tools::isSubmit('submitSponsorFriends') and Tools::getValue('friendsEmail') and sizeof($friendsEmail = Tools::getValue('friendsEmail')) >= 1) {
    $activeTab = 'sponsor';
    if (!Tools::getValue('conditionsValided')) {
        $error = 'conditions not valided';
    } else {
        $friendsLastName = Tools::getValue('friendsLastName');
        $friendsFirstName = Tools::getValue('friendsFirstName');
        $mails_exists = array();
        foreach ($friendsEmail as $key => $friendEmail) {
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:31,代码来源:referralprogram-program.php

示例6: hookUpdateOrderStatus

 /**
  * Hook called when order status changed
  * register a discount for sponsor and send him an e-mail
  */
 public function hookUpdateOrderStatus($params)
 {
     if (!Validate::isLoadedObject($params['newOrderStatus'])) {
         die(Tools::displayError('Missing parameters'));
     }
     $orderState = $params['newOrderStatus'];
     $order = new Order((int) $params['id_order']);
     if ($order and !Validate::isLoadedObject($order)) {
         die(Tools::displayError('Incorrect object Order.'));
     }
     include_once dirname(__FILE__) . '/ReferralProgramModule.php';
     $customer = new Customer((int) $order->id_customer);
     $stats = $customer->getStats();
     $nbOrdersCustomer = (int) $stats['nb_orders'] + 1;
     // hack to count current order
     $referralprogram = new ReferralProgramModule(ReferralProgramModule::isSponsorised((int) $customer->id, true));
     if (!Validate::isLoadedObject($referralprogram)) {
         return false;
     }
     $sponsor = new Customer((int) $referralprogram->id_sponsor);
     if ((int) $orderState->logable and $nbOrdersCustomer >= (int) $this->_configuration['REFERRAL_ORDER_QUANTITY'] and $referralprogram->registerDiscountForSponsor((int) $order->id_currency)) {
         $discount = new Discount((int) $referralprogram->id_discount_sponsor);
         $currency = new Currency((int) $order->id_currency);
         $discount_display = $discount->display($discount->value, (int) $discount->id_discount_type, $currency);
         $data = array('{sponsored_firstname}' => $customer->firstname, '{sponsored_lastname}' => $customer->lastname, '{discount_display}' => $discount_display, '{discount_name}' => $discount->name);
         Mail::Send((int) $order->id_lang, 'referralprogram-congratulations', Mail::l('Congratulations!'), $data, $sponsor->email, $sponsor->firstname . ' ' . $sponsor->lastname, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__) . '/mails/');
         return true;
     }
     return false;
 }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:34,代码来源:referralprogram.php

示例7: DiscTab

 /**
  * Discount table with value, quantities...
  */
 public function DiscTab()
 {
     $w = array(90, 25, 15, 10, 25, 25);
     $this->SetFont(self::fontname(), 'B', 7);
     $discounts = self::$order->getDiscounts();
     foreach ($discounts as $discount) {
         $this->Cell($w[0], 6, self::l('Discount:') . ' ' . $discount['name'], 'B');
         $this->Cell($w[1], 6, '', 'B');
         $this->Cell($w[2], 6, '', 'B');
         $this->Cell($w[3], 6, '', 'B', 0, 'R');
         $this->Cell($w[4], 6, '1', 'B', 0, 'C');
         $tax_rate_discount = 0;
         if (self::$_priceDisplayMethod == PS_TAX_EXC) {
             $tax_rate_discount = self::$order->getTaxesAverageUsed();
         }
         $c_decimals = self::$currency->decimals * _PS_PRICE_DISPLAY_PRECISION_;
         $discount_value = Tools::ps_round($discount['value'] / (1 + $tax_rate_discount / 100), $c_decimals);
         $discount_display = self::convertSign(Discount::display($discount_value, $discount['id_discount_type'], self::$currency));
         $math_sign = !self::$orderSlip && $discount['value'] != 0.0 ? '-' : '';
         $this->Cell($w[5], 6, $math_sign . $discount_display, 'B', 0, 'R');
         $this->Ln();
     }
     if (sizeof($discounts)) {
         $this->Cell(array_sum($w), 0, '');
     }
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:29,代码来源:PDF.php

示例8: htmlentities

<?php

require_once '../../config/config.inc.php';
require_once '../../init.php';
/*
if (!$cookie->isLogged())
	Tools::redirect('../../authentication.php?back=modules/referralprogram/referralprogram-program.php');
*/
$shop_name = htmlentities(Configuration::get('PS_SHOP_NAME'), NULL, 'utf-8');
$shop_url = 'http://' . Tools::getHttpHost(false, true);
$customer = new Customer(intval($cookie->id_customer));
if (!preg_match("#.*\\.html\$#Ui", Tools::getValue('mail')) or !preg_match("#.*\\.html\$#Ui", Tools::getValue('mail'))) {
    die(Tools::displayError());
}
$file = file_get_contents(dirname(__FILE__) . '/mails/' . strval(preg_replace('#\\.{2,}#', '.', Tools::getValue('mail'))));
$file = str_replace('{shop_name}', $shop_name, $file);
$file = str_replace('{shop_url}', $shop_url . __PS_BASE_URI__, $file);
$file = str_replace('{shop_logo}', $shop_url . _PS_IMG_ . 'logo.jpg', $file);
$file = str_replace('{firstname}', $customer->firstname, $file);
$file = str_replace('{lastname}', $customer->lastname, $file);
$file = str_replace('{email}', $customer->email, $file);
$file = str_replace('{firstname_friend}', 'XXXXX', $file);
$file = str_replace('{lastname_friend}', 'xxxxxx', $file);
$file = str_replace('{link}', 'authentication.php?create_account=1', $file);
$file = str_replace('{discount}', Discount::display(floatval(Configuration::get('referralprogram_DISCOUNT_VALUE')), intval(Configuration::get('referralprogram_DISCOUNT_TYPE')), new Currency($cookie->id_currency)), $file);
echo $file;
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:26,代码来源:preview-email.php

示例9: dirname

<?php

/* SSL Management */
$useSSL = true;
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
include_once dirname(__FILE__) . '/ReferralProgramModule.php';
if (!$cookie->isLogged()) {
    Tools::redirect('authentication.php?back=modules/referralprogram/referralprogram-program.php');
}
$js_files = array(_PS_JS_DIR_ . 'jquery/thickbox-modified.js', _PS_JS_DIR_ . 'jquery/jquery.idTabs.modified.js');
$css_files = array(__PS_BASE_URI__ . 'css/thickbox.css' => 'all');
include dirname(__FILE__) . '/../../header.php';
// get discount value (ready to display)
$discount = Discount::display(floatval(Configuration::get('REFERRAL_DISCOUNT_VALUE')), intval(Configuration::get('REFERRAL_DISCOUNT_TYPE')), new Currency($cookie->id_currency));
$activeTab = 'sponsor';
$error = false;
// Mailing invitation to friend sponsor
$invitation_sent = false;
$nbInvitation = 0;
if (Tools::isSubmit('submitSponsorFriends') and Tools::getValue('friendsEmail') and sizeof($friendsEmail = Tools::getValue('friendsEmail')) >= 1) {
    $activeTab = 'sponsor';
    if (!Tools::getValue('conditionsValided')) {
        $error = 'conditions not valided';
    } else {
        $friendsLastName = Tools::getValue('friendsLastName');
        $friendsFirstName = Tools::getValue('friendsFirstName');
        $mails_exists = array();
        foreach ($friendsEmail as $key => $friendEmail) {
            $friendEmail = strval($friendEmail);
            $friendLastName = strval($friendsLastName[$key]);
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:31,代码来源:referralprogram-program.php


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