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


PHP Discount::getDiscountTypes方法代码示例

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


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

示例1: displayForm

    public function displayForm($isMainTab = true)
    {
        global $currentIndex, $cookie;
        parent::displayForm();
        if (!($obj = $this->loadObject(true))) {
            return;
        }
        echo '
		<script type="text/javascript">
			function discountType()
			{
				if ($("#id_discount_type").val() == 0)
					$("#value-div").css("display", "none");
				else if ($("#id_discount_type").val() == 1)
				{
					$("#value-div").css("display", "block");
					$("#percent-span").css("display", "block");
					$("#id_currency").css("display", "none");
				}
				else if ($("#id_discount_type").val() == 2)
				{
					$("#value-div").css("display", "block");
					$("#percent-span").css("display", "none");
					$("#id_currency").css("display", "block");
					$(\'#behavior_not_exhausted\').show();
					
				}
				else if ($("#id_discount_type").val() == 3)
					$("#value-div").css("display", "none");
				if ($(\'#id_discount_type\').val() != 2)
					$(\'#behavior_not_exhausted\').hide();
					
			}
			$(document).ready(function(){
				$("#id_discount_type").change(function(){discountType();});
				discountType();
			});
		</script>
		<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" id="discount" name="discount" method="post" enctype="multipart/form-data">
		' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
			<fieldset><legend><img src="../img/admin/coupon.gif" />' . $this->l('Vouchers') . '</legend>
				<label>' . $this->l('Code:') . ' </label>
				<div class="margin-form">
					<input type="text" size="30" maxlength="32" name="name" value="' . htmlentities($this->getFieldValue($obj, 'name'), ENT_COMPAT, 'UTF-8') . '" id="code" />
					<sup>*</sup>
					<img src="../img/admin/news-new.gif" onclick="gencode(8);" style="cursor: pointer" />
					<span class="hint" name="help_box">' . $this->l('Invalid characters: numbers and') . ' !<>,;?=+()@#"�{}_$%:<span class="hint-pointer">&nbsp;</span></span>
					<p class="clear">' . $this->l('The voucher\'s code, at least 3 characters long, which the customer types in during check-out') . '</p>
				</div>
				<label>' . $this->l('Type:') . ' </label>
				<div class="margin-form">
					<select name="id_discount_type" id="id_discount_type" onchange="free_shipping()">
						<option value="0">' . $this->l('-- Choose --') . '</option>';
        $discountTypes = Discount::getDiscountTypes((int) $cookie->id_lang);
        foreach ($discountTypes as $discountType) {
            echo '<option value="' . (int) $discountType['id_discount_type'] . '"' . ($this->getFieldValue($obj, 'id_discount_type') == $discountType['id_discount_type'] ? ' selected="selected"' : '') . '>' . $discountType['name'] . '</option>';
        }
        echo '		</select> <sup>*</sup>
				</div>
				<div id="value-div" style="display:none">
					<label>' . $this->l('Value') . '</label>
					<div class="margin-form">
						<input style="float:left;width:80px" type="text" name="value" id="discount_value" value="' . (double) $this->getFieldValue($obj, 'value') . '" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\'); " />
						<select id="id_currency" name="id_currency" style="float:left;margin-left:10px;width:50px;display:none">
							<option value="0">--</option>';
        foreach (Currency::getCurrencies() as $row) {
            echo '			<option value="' . (int) $row['id_currency'] . '" ' . ($this->getFieldValue($obj, 'id_currency') == $row['id_currency'] ? 'selected="selected"' : '') . '>' . $row['sign'] . '</option>';
        }
        echo '			</select>
						<span id="percent-span" style="margin-left:10px;display:none;float:left;font-size:12px;font-weight:bold;color:black"> %</span>
						<sup style="float:left;margin-left:5px">*</sup>
						<p class="clear">' . $this->l('Either the monetary amount or the %, depending on Type selected above') . '</p>
					</div>
				<div id="behavior_not_exhausted" style="display:none;">
					<label>' . $this->l('Behavior:') . '</label>
					<div class="margin-form">
						<select name="behavior_not_exhausted">
							<option value="1" ' . ($obj->behavior_not_exhausted === 1 ? 'selected="selected"' : '') . '>' . $this->l('Reduces the voucher value to correspond to the order amount') . '</option>
							<option value="2" ' . ($obj->behavior_not_exhausted == 2 ? 'selected="selected"' : '') . '>' . $this->l('Create a new voucher with the remaining amount') . '</option>
							<option value="3" ' . ($obj->behavior_not_exhausted == 3 ? 'selected="selected"' : '') . '>' . $this->l('Create negative invoice') . '</option>
						</select>
					</div>
				</div>
				</div>
				<label>' . $this->l('Description:') . ' </label>
				<div class="margin-form">';
        foreach ($this->_languages as $language) {
            echo '	<div id="description_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="description_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'description', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup>
						<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
						<p class="clear">' . $this->l('Will appear in cart next to voucher code') . '</p>
					</div>';
        }
        $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'description', 'description');
        echo '	</div>
				<div class="clear" / >
				<label>' . $this->l('Categories:') . ' </label>
					<div class="margin-form">
							<table cellspacing="0" cellpadding="0" class="table" style="width: 600px;">
									<tr>
//.........这里部分代码省略.........
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:101,代码来源:AdminDiscounts.php

示例2: getContent

    public function getContent()
    {
        global $cookie, $currentIndex;
        if (Tools::isSubmit('submitBirthday')) {
            Configuration::updateValue('BIRTHDAY_ACTIVE', (int) Tools::getValue('bp_active'));
            Configuration::updateValue('BIRTHDAY_DISCOUNT_TYPE', (int) Tools::getValue('id_discount_type'));
            Configuration::updateValue('BIRTHDAY_DISCOUNT_VALUE', (double) Tools::getValue('discount_value'));
            Configuration::updateValue('BIRTHDAY_MINIMAL_ORDER', (double) Tools::getValue('minimal_order'));
            Tools::redirectAdmin($currentIndex . '&configure=birthdaypresent&token=' . Tools::getValue('token') . '&conf=4');
        }
        $this->_html = '
		<fieldset class="width3"><legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->displayName . '</legend>
			<p>' . $this->l('Create a voucher for customers celebrating their birthday and having at least one valid order') . '</p>
			<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post" style="margin-top: 15px;">
				<label>' . $this->l('Active') . '</label>
				<div class="margin-form">
					<img src="../img/admin/enabled.gif" /> <input type="radio" name="bp_active" value="1"' . (Configuration::get('BIRTHDAY_ACTIVE') ? ' checked="checked"' : '') . ' />
					<img src="../img/admin/disabled.gif" /> <input type="radio" name="bp_active" value="0"' . (!Configuration::get('BIRTHDAY_ACTIVE') ? ' checked="checked"' : '') . ' />
					<p style="clear: both;">' . $this->l('Additionally, you have to set a CRON rule which calls the file') . '<br />' . Tools::getProtocol() . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . 'modules/birthdaypresent/cron.php ' . $this->l('every day') . '</p>
				</div>
				<label>' . $this->l('Type') . '</label>
				<div class="margin-form">
					<select name="id_discount_type">';
        $discountTypes = Discount::getDiscountTypes((int) $cookie->id_lang);
        foreach ($discountTypes as $discountType) {
            $this->_html .= '<option value="' . (int) $discountType['id_discount_type'] . '"' . (Configuration::get('BIRTHDAY_DISCOUNT_TYPE') == $discountType['id_discount_type'] ? ' selected="selected"' : '') . '>' . $discountType['name'] . '</option>';
        }
        $this->_html .= '
					</select>
				</div>
				<label>' . $this->l('Value') . '</label>
				<div class="margin-form">
					<input type="text" size="15" name="discount_value" value="' . Configuration::get('BIRTHDAY_DISCOUNT_VALUE') . '" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\'); " />
					<p style="clear: both;">' . $this->l('Either the monetary amount or the %, depending on Type selected above') . '</p>
				</div>
				<label>' . $this->l('Minimum order') . '</label>
				<div class="margin-form">
					<input type="text" size="15" name="minimal_order" value="' . Configuration::get('BIRTHDAY_MINIMAL_ORDER') . '" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\'); " />
					<p style="clear: both;">' . $this->l('The minimum order amount needed to use the voucher') . '</p>
				</div>
				<div class="clear center">
					<input type="submit" value="' . $this->l('   Save   ') . '" name="submitBirthday" class="button" />
				</div>
				<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
			</form>
		</fieldset><br />
		<fieldset class="width3"><legend><img src="../modules/' . $this->name . '/comment.gif" /> ' . $this->l('Guide') . '</legend>
			<h2>' . $this->l('Develop clients\' loyalty') . '</h2>
			<p>' . $this->l('Offering a present to a client is a means of securing their loyalty.') . '</p>
			<h3>' . $this->l('What should you do?') . '</h3>
			<p>
				' . $this->l('Keeping a client is more profitable than capturing a new one. Thus, it is necessary to develop their loyalty, in other words to make them want to come back to your webshop.') . ' <br />
				' . $this->l('Word of mouth is also a means to get new satisfied clients; a dissatisfied one won\'t attract new clients.') . '<br />
				' . $this->l('In order to achieve this goal you can organize: ') . '
				<ul>
					<li>' . $this->l('Punctual operations: commercial rewards (personalized special offers, product or service offered), non commercial rewards (priority handling of an order or a product), pecuniary rewards (bonds, discount coupons, payback...).') . '</li>
					<li>' . $this->l('Sustainable operations: loyalty or points cards, which not only justify communication between merchant and client, but also offer advantages to clients (private offers, discounts).') . '</li>
				</ul>
				' . $this->l('These operations encourage clients to buy and also to come back to your webshop regularly.') . ' <br />
			</p>
		</fieldset>';
        return $this->_html;
    }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:63,代码来源:birthdaypresent.php

示例3: displayForm

    public function displayForm()
    {
        global $currentIndex, $cookie;
        $obj = $this->loadObject(true);
        $defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
        $languages = Language::getLanguages();
        echo '
		<script type="text/javascript">
			id_language = Number(' . $defaultLanguage . ');
		</script>
		<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" id="discount" name="discount" method="post" enctype="multipart/form-data">
		' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
			<fieldset class="width3"><legend><img src="../img/admin/coupon.gif" />' . $this->l('Vouchers') . '</legend>
				<label>' . $this->l('Code:') . ' </label>
				<div class="margin-form">
					<input type="text" size="30" maxlength="32" name="name" value="' . htmlentities($this->getFieldValue($obj, 'name'), ENT_COMPAT, 'UTF-8') . '" style="text-transform: uppercase;" id="code" />
					<sup>*</sup>
					<img src="../img/admin/news-new.gif" onclick="gencode(8);" style="cursor: pointer" />
					<span class="hint" name="help_box">' . $this->l('Invalid characters: numbers and') . ' !<>,;?=+()@#"�{}_$%:<span class="hint-pointer">&nbsp;</span></span>
					<p style="clear: both;">' . $this->l('The voucher\'s code, at least 3 characters long, which the customer types in during check-out') . '</p>
				</div>
				<label>' . $this->l('Type:') . ' </label>
				<div class="margin-form">
					<select name="id_discount_type" id="id_discount_type" onchange="free_shipping()">';
        $discountTypes = Discount::getDiscountTypes(intval($cookie->id_lang));
        foreach ($discountTypes as $discountType) {
            echo '<option value="' . intval($discountType['id_discount_type']) . '"' . ($this->getFieldValue($obj, 'id_discount_type') == $discountType['id_discount_type'] ? ' selected="selected"' : '') . '>' . $discountType['name'] . '</option>';
        }
        echo '
					</select>
				</div>
				<label>' . $this->l('Categories:') . ' </label>
					<div class="margin-form">
							<table cellspacing="0" cellpadding="0" class="table" style="width: 29.5em;">
									<tr>
										<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'categoryBox[]\', this.checked)" /></th>
										<th>' . $this->l('ID') . '</th>
										<th>' . $this->l('Name') . '</th>
									</tr>';
        $done = array();
        $index = array();
        $indexedCategories = isset($_POST['categoryBox']) ? $_POST['categoryBox'] : ($obj->id ? Discount::getCategories($obj->id) : array());
        $categories = Category::getCategories(intval($cookie->id_lang), false);
        foreach ($indexedCategories as $k => $row) {
            $index[] = $row['id_category'];
        }
        $this->recurseCategoryForInclude($index, $categories, $categories[0][1], 1, $obj->id);
        echo '
							</table>
							<p style="padding:0px; margin:0px 0px 10px 0px;">' . $this->l('Mark all checkbox(es) of categories to which the discount is to be applicated') . '<sup> *</sup></p>
						</div>
				<div class="clear" / >
				<label>' . $this->l('Description:') . ' </label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            echo '
					<div id="description_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="description_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'description', intval($language['id_lang'])), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup>
						<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
						<p style="clear: both;">' . $this->l('Will appear in cart next to voucher code') . '</p>
					</div>';
        }
        $this->displayFlags($languages, $defaultLanguage, 'description', 'description');
        echo '
				</div><br /><br /><br />
				<div class="clear" / >
				<label>' . $this->l('Value:') . ' </label>
				<div class="margin-form">
					<input type="text" size="15" name="value" id="discount_value" value="' . floatval($this->getFieldValue($obj, 'value')) . '" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\'); " /> <sup>*</sup>
					<p style="clear: both;">' . $this->l('Either the monetary amount or the %, depending on Type selected above') . '</p>
				</div>
				<label>' . $this->l('Total quantity:') . ' </label>
				<div class="margin-form">
					<input type="text" size="15" name="quantity" value="' . intval($this->getFieldValue($obj, 'quantity')) . '" /> <sup>*</sup>
					<p style="clear: both;">' . $this->l('Total quantity available (mainly for vouchers open to everyone)') . '</p>
				</div>
				<label>' . $this->l('Qty per each user:') . ' </label>
				<div class="margin-form">
					<input type="text" size="15" name="quantity_per_user" value="' . intval($this->getFieldValue($obj, 'quantity_per_user')) . '" /> <sup>*</sup>
					<p style="clear: both;">' . $this->l('Number of times a single customer can use this voucher') . '</p>
				</div>
				<label>' . $this->l('Minimum amount') . '</label>
				<div class="margin-form">
					<input type="text" size="15" name="minimal" value="' . ($this->getFieldValue($obj, 'minimal') ? floatval($this->getFieldValue($obj, 'minimal')) : '0') . '" onkeyup="javascript:this.value = this.value.replace(/,/g, \'.\'); " /> <sup>*</sup>
					<p style="clear: both;">' . $this->l('Leave blank or 0 if not applicable') . '</p>
				</div>
				<div class="margin-form">
					<p>
						<input type="checkbox" name="cumulable"' . ($this->getFieldValue($obj, 'cumulable') == 1 ? ' checked="checked"' : '') . ' id="cumulable_on" value="1" />
						<label class="t" for="cumulable_on"> ' . $this->l('Cumulative with other vouchers') . '</label>
					</p>
				</div>
				<div class="margin-form">
					<p>
						<input type="checkbox" name="cumulable_reduction"' . ($this->getFieldValue($obj, 'cumulable_reduction') == 1 ? ' checked="checked"' : '') . ' id="cumulable_reduction_on" value="1" />
						<label class="t" for="cumulable_reduction_on"> ' . $this->l('Cumulative with price reductions') . '</label>
					</p>
				</div>
				<label>' . $this->l('To be used by:') . ' </label>
								<div class="margin-form">				
//.........这里部分代码省略.........
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:101,代码来源:AdminDiscounts.php


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