13 <?php $_htmlClass =
$block->getElement()->getClass() ?>
14 <?php $_htmlName =
$block->getElement()->getName() ?>
15 <?php $_readonly =
$block->getElement()->getReadonly() ?>
23 <div
class=
"field" id=
"attribute-<?= /* @escapeNotVerified */ $_htmlId ?>-container" data-attribute-code=
"<?= /* @escapeNotVerified */ $_htmlId ?>" 24 data-apply-to=
"<?= $block->escapeHtml( 25 $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode( 26 $element->hasEntityAttribute() ? $element->getEntityAttribute()->getApplyTo() : [] 29 <label
class=
"label"><span><?=
$block->getElement()->getLabel() ?></span></label>
31 <table
class=
"admin__control-table tiers_table" id=
"tiers_table">
34 <th
class=
"col-websites" <?php
if (!
$_showWebsite): ?>style=
"display:none"<?php
endif; ?>><?=
__(
'Web Site') ?></th>
35 <th
class=
"col-customer-group"><?=
__(
'Customer Group') ?></th>
36 <th
class=
"col-qty required"><?=
__(
'Quantity') ?></th>
37 <th
class=
"col-price required"><?=
$block->getPriceColumnHeader(
__(
'Item Price')) ?></th>
38 <th
class=
"col-delete"><?=
__(
'Action') ?></th>
41 <tbody
id=
"<?= /* @escapeNotVerified */ $_htmlId ?>_container"></tbody>
44 <td colspan=
"<?php if (!$_showWebsite): ?>4<?php else: ?>5<?php endif; ?>" class=
"col-actions-add"><?=
$block->getAddButtonHtml() ?></td>
54 ],
function (mageTemplate) {
57 var tierPriceRowTemplate =
'<tr>' 58 +
'<td class="col-websites"<?php if (!$_showWebsite): ?> style="display:none"<?php endif; ?>>' 59 +
'<select class="<?= /* @escapeNotVerified */ $_htmlClass ?> required-entry" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][website_id]" id="tier_price_row_<%- data.index %>_website">' 60 <?php
foreach (
$block->getWebsites() as $_websiteId => $_info): ?>
61 +
'<option value="<?= /* @escapeNotVerified */ $_websiteId ?>"><?= $block->escapeJs($_info['name']) ?><?php if (!empty($_info['currency
'])): ?> [<?= $block->escapeHtml($_info['currency
']) ?>]<?php endif; ?></option>' 64 +
'<td class="col-customer-group"><select class="<?= /* @escapeNotVerified */ $_htmlClass ?> custgroup required-entry" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][cust_group]" id="tier_price_row_<%- data.index %>_cust_group">' 65 <?php
foreach (
$block->getCustomerGroups() as $_groupId => $_groupName): ?>
66 +
'<option value="<?= /* @escapeNotVerified */ $_groupId ?>"><?= $block->escapeJs($_groupName) ?></option>' 69 +
'<td class="col-qty">' 70 +
'<input class="<?= /* @escapeNotVerified */ $_htmlClass ?> qty required-entry validate-greater-than-zero" type="text" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][price_qty]" value="<%- data.qty %>" id="tier_price_row_<%- data.index %>_qty" />' 71 +
'<span><?= /* @escapeNotVerified */ __("and above") ?></span>' 73 +
'<td class="col-price"><input class="<?= /* @escapeNotVerified */ $_htmlClass ?> required-entry <?= /* @escapeNotVerified */ $_priceValueValidation ?>" type="text" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][price]" value="<%- data.price %>" id="tier_price_row_<%- data.index %>_price" /></td>' 74 +
'<td class="col-delete"><input type="hidden" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][delete]" class="delete" value="" id="tier_price_row_<%- data.index %>_delete" />' 75 +
'<button title="<?= /* @escapeNotVerified */ $block->escapeHtml(__('Delete Tier
')) ?>" type="button" class="action- scalable delete icon-btn delete-product-option" id="tier_price_row_<%- data.index %>_delete_button" onclick="return tierPriceControl.deleteItem(event);">' 76 +
'<span><?= /* @escapeNotVerified */ __("Delete") ?></span></button></td>' 80 template: mageTemplate(tierPriceRowTemplate),
82 addItem :
function () {
83 <?php
if ($_readonly): ?>
84 if (arguments.length < 4) {
89 website_id:
'<?= /* @escapeNotVerified */ $block->getDefaultWebsite() ?>',
90 group:
'<?= /* @escapeNotVerified */ $block->getDefaultCustomerGroup() ?>',
94 index: this.itemsCount++
97 if(arguments.length >= 4) {
98 data.website_id = arguments[0];
99 data.group = arguments[1];
100 data.qty = arguments[2];
101 data.price = arguments[3];
103 if (arguments.length == 5) {
104 data.readOnly = arguments[4];
107 Element.insert($(
'<?= /* @escapeNotVerified */ $_htmlId ?>_container'), {
108 bottom : this.
template({
113 $(
'tier_price_row_' + data.index +
'_cust_group').
value = data.group;
114 $(
'tier_price_row_' + data.index +
'_website').value = data.website_id;
116 <?php
if (
$block->isShowWebsiteColumn() && !
$block->isAllowChangeWebsite()):?>
117 var wss = $(
'tier_price_row_' + data.index +
'_website');
118 var txt = wss.options[wss.selectedIndex].text;
120 wss.insert({after:
'<span class="website-name">' + txt +
'</span>'});
124 if (data.readOnly ==
'1') {
125 [
'website',
'cust_group',
'qty',
'price',
'delete'].each(
function(idx){
126 $(
'tier_price_row_'+data.index+
'_'+idx).disabled =
true;
128 $(
'tier_price_row_'+data.index+
'_delete_button').hide();
131 <?php
if ($_readonly): ?>
132 $(
'<?= /* @escapeNotVerified */ $_htmlId ?>_container').select(
'input',
'select').each(this.disableElement);
133 $(
'<?= /* @escapeNotVerified */ $_htmlId ?>_container').up(
'table').select(
'button').each(this.disableElement);
135 $(
'<?= /* @escapeNotVerified */ $_htmlId ?>_container').select(
'input',
'select').each(
function(el){ Event.observe(el,
'change', el.setHasChanges.bind(el)); });
138 disableElement:
function(el) {
140 el.addClassName(
'disabled');
142 deleteItem:
function(event) {
143 var tr = Event.findElement(event,
'tr');
145 Element.select(tr,
'.delete').each(
function(elem){elem.value=
'1'});
146 Element.select(tr, [
'input',
'select']).each(
function(elem){elem.hide()});
148 Element.addClassName(tr,
'no-display template');
154 tierPriceControl.addItem(
'<?= /* @escapeNotVerified */ $_item['website_id
'] ?>',
'<?= /* @escapeNotVerified */ $_item['cust_group
'] ?>',
'<?= /* @escapeNotVerified */ $_item['price_qty
']*1 ?>',
'<?= /* @escapeNotVerified */ $_item['price
'] ?>', <?= (
int)!empty(
$_item[
'readonly']) ?>);
156 <?php
if ($_readonly): ?>
157 $(
'<?= /* @escapeNotVerified */ $_htmlId ?>_container').up(
'table').select(
'button')
if(! $_showWebsite) if(! $_showWebsite) if(! $_showWebsite) foreach( $block->getWebsites() as $_websiteId=> $_info)($block->getCustomerGroups() as $_groupId=> $_groupName) var tierPriceControl
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
$_htmlId $_htmlClass $_htmlName $_readonly $_showWebsite