Initial Commit
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
<div class="form-container" id="digressive-price">
|
||||
<div class="title title-without-tabs">
|
||||
{intl d="digressiveprice.bo.default" l="Digressive price"}
|
||||
</div>
|
||||
|
||||
{form name="digressiveprice.create"}
|
||||
{if $form_error}
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
{/if}
|
||||
{/form}
|
||||
|
||||
{form name="digressiveprice.update"}
|
||||
{if $form_error}
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
{/if}
|
||||
{/form}
|
||||
|
||||
{form name="digressiveprice.delete"}
|
||||
{if $form_error}
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
{/if}
|
||||
{/form}
|
||||
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="From" d="digressiveprice.bo.default"}</th>
|
||||
<th>{intl l="To" d="digressiveprice.bo.default"}</th>
|
||||
<th>{intl l="Discount (%)" d="digressiveprice.bo.default"}</th>
|
||||
<th class="text-center">{intl l="Add/Update" d="digressiveprice.bo.default"}</th>
|
||||
<th class="text-center">{intl l="Remove" d="digressiveprice.bo.default"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{* List existing digressive prices for this product *}
|
||||
{loop type="digressive" name="prodDigressivePrices" product_id={product attr="id"}}
|
||||
<!-- Update digressive price -->
|
||||
<tr>
|
||||
{form name="digressiveprice.update"}
|
||||
<form action="{url path='/admin/module/DigressivePrice/update'}" class="form-inline" role="form" {form_enctype form=$form} method="post">
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field="id"}
|
||||
<input type="hidden" name="{$name}" value="{$ID}">
|
||||
{/form_field}
|
||||
|
||||
<input type="hidden" name="product_id" value="{$PRODUCT_ID}">
|
||||
|
||||
{form_field form=$form field="productId"}
|
||||
<input type="hidden" name="{$name}" value="{$PRODUCT_ID}">
|
||||
{/form_field}
|
||||
|
||||
<!-- Quantities -->
|
||||
<td>
|
||||
{form_field form=$form field="quantityFrom"}
|
||||
<input name="{$name}" value="{$QUANTITY_FROM}" class="form-control" type="text" required>
|
||||
{/form_field}
|
||||
</td>
|
||||
<td>
|
||||
{form_field form=$form field="quantityTo"}
|
||||
<input name="{$name}" value="{$QUANTITY_TO}" class="form-control" type="text" required>
|
||||
{/form_field}
|
||||
</td>
|
||||
|
||||
<!-- Prices -->
|
||||
<td>
|
||||
{form_field form=$form field="discount"}
|
||||
<input name="{$name}" value="{$DISCOUNT}" class="form-control" type="text" required>
|
||||
{/form_field}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<button type="submit" class="btn btn-primary">{intl d="digressiveprice.bo.default" l="Update"}</button>
|
||||
</td>
|
||||
</form>
|
||||
{/form}
|
||||
|
||||
<!-- Remove -->
|
||||
<td class="text-center">
|
||||
{form name="digressiveprice.delete"}
|
||||
<form style="display:inline-block" action="{url path='/admin/module/DigressivePrice/delete'}" role="form" {form_enctype form=$form} method="post">
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
<input type="hidden" name="product_id" value="{$PRODUCT_ID}">
|
||||
|
||||
{form_field form=$form field="productId"}
|
||||
<input type="hidden" name="{$name}" value="{$PRODUCT_ID}">
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="id"}
|
||||
<input type="hidden" name="{$name}" value="{$ID}">
|
||||
{/form_field}
|
||||
|
||||
<button type="submit" class="btn btn-danger" title="{intl d='digressiveprice.bo.default' l='Remove'}"><span class="glyphicon glyphicon-trash"></span></button>
|
||||
</form>
|
||||
{/form}
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
<!-- New digressive price form -->
|
||||
<tr>
|
||||
{form name="digressiveprice.create"}
|
||||
<form action="{url path='/admin/module/DigressivePrice/create'}" class="form-inline" role="form" {form_enctype form=$form} method="post">
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
<input type="hidden" name="product_id" value="{product attr='id'}">
|
||||
|
||||
{form_field form=$form field="productId"}
|
||||
<input type="hidden" name="{$name}" value="{product attr='id'}">
|
||||
{/form_field}
|
||||
|
||||
<!-- Quantities -->
|
||||
<td>
|
||||
{form_field form=$form field="quantityFrom"}
|
||||
<input name="{$name}" class="form-control" placeholder="{$label}" value="{$value}" type="text" required>
|
||||
{/form_field}
|
||||
</td>
|
||||
<td>
|
||||
{form_field form=$form field="quantityTo"}
|
||||
<input name="{$name}" class="form-control" placeholder="{$label}" value="{$value}" type="text" required>
|
||||
{/form_field}
|
||||
</td>
|
||||
|
||||
<!-- Prices -->
|
||||
<td>
|
||||
{form_field form=$form field="discount"}
|
||||
<input name="{$name}" class="form-control" placeholder="{$label}" value="{$value}" type="text" required>
|
||||
{/form_field}
|
||||
</td>
|
||||
|
||||
<!-- Submit -->
|
||||
<td class="text-center">
|
||||
<button type="submit" class="btn btn-primary">{intl d="digressiveprice.bo.default" l="Add"}</button>
|
||||
</td>
|
||||
<td> </td>
|
||||
</form>
|
||||
{/form}
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
$(function() {
|
||||
$('#pse-id').change(function() {
|
||||
|
||||
alert("pse = "+$(this).val());
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
<script>
|
||||
$(function() {
|
||||
var updateUrl = '{url path="/digressive-price/table/PSE_ID"}';
|
||||
|
||||
$(document).on('change.pse', '#pse-id', function(event, pseId) {
|
||||
$('#digressive-table-container').load(updateUrl.replace('PSE_ID', pseId));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,53 @@
|
||||
{if {count type="digressive" product_id=$product_id pse_id=$pse_id}}
|
||||
<div id="digressive-table-container">
|
||||
<h4>{intl l="Digressive prices" d='digressiveprice.fo.default'}</h4>
|
||||
<p>{intl l="Order more products and get a discount !" d='digressiveprice.fo.default'}</p>
|
||||
|
||||
{loop type="digressive" name="digressivePrice" product_id=$ID limit=1}
|
||||
{$firstQuantity = $QUANTITY_FROM}
|
||||
{/loop}
|
||||
|
||||
{loop type="product" name="theProduct" id=$product_id}
|
||||
{$isPromo = $IS_PROMO}
|
||||
<table class="table table-condensed table-striped">
|
||||
<tr>
|
||||
<th>{intl l="Quantity" d='digressiveprice.fo.default'}</th>
|
||||
<th class="text-center">{intl l="Discount" d='digressiveprice.fo.default'}</th>
|
||||
<th class="text-center">{intl l="Unit price" d='digressiveprice.fo.default'}</th>
|
||||
</tr>
|
||||
|
||||
{if firstQuantity > 1}
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td class="text-center">{intl l="None" d='digressiveprice.fo.default'}</td>
|
||||
<td class="text-center">
|
||||
{if $isPromo}
|
||||
{format_money number=$BEST_TAXED_PROMO_PRICE} <del>{format_money number=$TAXED_PRICE}</del>
|
||||
{else}
|
||||
{format_money number=$TAXED_PRICE}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
{loop type="digressive" name="digressivePrice" product_id=$ID pse_id=$pse_id}
|
||||
<tr>
|
||||
{if $QUANTITY_FROM != 0 && $QUANTITY_TO >= 9999}
|
||||
<td>{intl l='From %qty' qty=$QUANTITY_FROM d='digressiveprice.fo.default'}</td>
|
||||
{else}
|
||||
<td>{intl l='From %from to %to' from=$QUANTITY_FROM to=$QUANTITY_TO d='digressiveprice.fo.default'}</td>
|
||||
{/if}
|
||||
<td class="text-center">{$DISCOUNT}%</td>
|
||||
<td class="text-center">
|
||||
{if $isPromo}
|
||||
{format_money number=$TAXED_PROMO_PRICE} <del>{format_money number=$TAXED_PRICE}</del>
|
||||
{else}
|
||||
{format_money number=$TAXED_PRICE}
|
||||
{/if}
|
||||
</td>
|
||||
<tr>
|
||||
{/loop}
|
||||
</table>
|
||||
{/loop}
|
||||
</div>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user