Added Attribute value related coupons

This commit is contained in:
Franck Allimant
2014-06-12 13:14:07 +02:00
parent 147d4a70f1
commit db29505fee
7 changed files with 507 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
{block name="discount-field"}{/block}
<div class="form-group input-coupon-attribute-id">
<label for="coupon-category-id">{intl l="Select attribute :"} = {$attribute_value}</label>
<select required class="form-control" id="coupon-attribute-id" name="{$attribute_field_name}">
<option value="0">{intl l="Please select..."}</option>
{loop type="attribute" name="list-of-attributes" order="alpha" backend_context="1"}
<option value="{$ID}" {if $ID == $attribute_value}selected="selected"{/if}>{$TITLE}</option>
{/loop}
</select>
</div>
<div class="loading" id="input-coupon-attributeAvs-id-loading" style="display: none"></div>
<div class="form-group" id="input-coupon-attributeAvs-id" {if $attribute_value == 0}style="display: none"{/if}>
<label for="coupon-products-id">{intl l="Applies to attribute values :"}</label>
<select required multiple size="10" class="form-control" id="coupon-attributeAvs-id" name="{$attribute_av_field_name}[]">
{loop type="attribute_availability" attribute=$attribute_value name="list-of-attribute_avs" backend_context="1"}
<option value="{$ID}" {if in_array($ID, $attribute_av_values)}selected="selected"{/if}>{$TITLE}</option>
{/loop}
</select>
<span class="label-help-block">{intl l='Use Ctrl+click to select (or deselect) more that one attribute value'}</span>
</div>
<script>
function couponInputFormSetup() {
var $catSelect = $('#coupon-attribute-id');
$catSelect.change(function(ev) {
var $attribute_id = $(this).val();
$('#input-coupon-attributeAvs-id').hide();
$('#coupon-attributeAvs-id').html('');
if ($attribute_id != 0) {
$('#input-coupon-attributeAvs-id-loading').show();
$.ajax({
url: "{url path='/admin/coupon/type-fragments/ajax-attribute-avs-list'}",
type: 'POST',
data: {
attribute_id: $attribute_id
},
success: function(options) {
$('#coupon-attributeAvs-id').html(options);
$('#input-coupon-attributeAvs-id').show();
},
complete: function() {
$('#input-coupon-attributeAvs-id-loading').hide();
}
});
}
});
};
</script>

View File

@@ -0,0 +1,16 @@
{extends file="coupon/type-fragments/base-remove-on-attributes.html"}
{block name="discount-field"}
<div class="form-group input-coupon-amount">
<label for="coupon-amount" class="control-label">{intl l="Discount amount"}</label>
<div class="input-group">
<input id="coupon-amount" type="money" class="form-control" name="{$amount_field_name}" value="{$amount_value}" placeholder="14.50">
{loop type="currency" name="get-symbol" default_only="true"}
<div class="input-group-addon">{$SYMBOL}</div>
{/loop}
</div>
</div>
{/block}

View File

@@ -0,0 +1,14 @@
{extends file="coupon/type-fragments/base-remove-on-attributes.html"}
{block name="discount-field"}
<div class="form-group input-coupon-percentage">
<label for="coupon-percentage" class="control-label">{intl l="Discount percentage"}</label>
<div class="input-group">
<input id="coupon-percentage" type="number" class="form-control" name="{$percentage_field_name}" value="{$percentage_value}" placeholder="5">
<div class="input-group-addon">%</div>
</div>
</div>
{/block}