This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,197 @@
<?php
/**
* @var $block \Esun\Catalog\Block\Adminhtml\Attribute\Edit\Options\Visual
* @var $escaper \Magento\Framework\Escaper
*/
$stores = $block->getStoresSortedBySortOrder();
$viewModel = $block->getData('view_model');
$jsonConfig = $viewModel instanceof \Esun\Catalog\ViewModel\Adminhtml\ColorOptionSwatchConfig
? $viewModel->enrichJsonConfig((string)$block->getJsonConfig())
: (string)$block->getJsonConfig();
$isColorAttribute = $viewModel instanceof \Esun\Catalog\ViewModel\Adminhtml\ColorOptionSwatchConfig
&& $viewModel->isColorAttribute((int)$block->getRequest()->getParam('attribute_id'));
?>
<fieldset class="admin__fieldset fieldset">
<legend class="legend">
<span><?= $escaper->escapeHtml(__('Manage Swatch (Values of Your Attribute)')) ?></span>
</legend><br />
<div class="admin__control-table-wrapper" id="swatch-visual-options-panel">
<table class="data-table clearfix" cellspacing="0">
<thead>
<tr id="swatch-visual-options-table">
<th class="col-draggable"></th>
<th class="col-default"><span><?= $escaper->escapeHtml(__('Is Default')) ?></span></th>
<th><span><?= $escaper->escapeHtml(__('Swatch')) ?></span></th>
<?php foreach ($stores as $_store): ?>
<th<?= ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) ? ' class="_required"' : '' ?>>
<span><?= $escaper->escapeHtml($_store->getName()) ?></span>
</th>
<?php endforeach; ?>
<?php if ($isColorAttribute): ?>
<th><span><?= $escaper->escapeHtml(__('Hot Sale')) ?></span></th>
<?php endif; ?>
<th><span><?= $escaper->escapeHtml(__('Swatch Colors')) ?></span></th>
<th><span><?= $escaper->escapeHtml(__('Color Ball Image')) ?></span></th>
<?php $colTotal = count($stores) * 2 + 5 + (int)$isColorAttribute; ?>
<th class="col-delete">&nbsp;</th>
</tr>
</thead>
<tbody data-role="swatch-visual-options-container" class="ignore-validate"></tbody>
<tfoot>
<tr>
<th colspan="<?= (int)$colTotal ?>">
<input type="hidden" class="required-visual-swatch-entry" name="visual_swatch_validation"/>
<input type="hidden" class="required-visual-swatch-unique" name="visual_swatch_validation_unique"/>
<input type="hidden" name="reset_is-default_option"/>
</th>
</tr>
<tr>
<th colspan="<?= (int)$colTotal ?>" class="col-actions-add">
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
<button id="add_new_swatch_visual_option_button"
title="<?= $escaper->escapeHtml(__('Add Swatch')) ?>"
type="button" class="action- scalable add">
<span><?= $escaper->escapeHtml(__('Add Swatch')) ?></span>
</button>
<button id="reset_default_swatch_visual_option_button"
title="<?= $escaper->escapeHtml(__('Reset Is Default')) ?>"
type="button" class="action- scalable reset">
<span><?= $escaper->escapeHtml(__('Reset Is Default')) ?></span>
</button>
<?php endif; ?>
</th>
</tr>
</tfoot>
</table>
<input type="hidden" id="swatch-visual-option-count-check" value="" />
</div>
<style>
.esun-color-option-col {
min-width: 190px;
vertical-align: top;
}
.esun-color-option-col .note {
color: #777;
display: block;
font-size: 11px;
margin-top: 4px;
}
.esun-color-ball-preview {
align-items: center;
display: flex;
gap: 8px;
margin-top: 8px;
}
.esun-color-ball-preview img {
border: 1px solid #d6d6d6;
border-radius: 50%;
height: 42px;
object-fit: contain;
width: 42px;
}
</style>
<script id="swatch-visual-row-template" type="text/x-magento-template">
<tr>
<td class="col-draggable">
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
<div data-role="draggable-handle" class="draggable-handle"
title="<?= $escaper->escapeHtml(__('Sort Option')) ?>"></div>
<?php endif; ?>
<input data-role="order" type="hidden" name="optionvisual[order][<%- data.id %>]" value="<%- data.sort_order %>" <?= ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) ? ' disabled="disabled"' : '' ?>/>
</td>
<td class="col-default">
<input class="input-radio" type="<%- data.intype %>" name="defaultvisual[]" value="<%- data.id %>" <%- data.checked %><?= ($block->getReadOnly()) ? ' disabled="disabled"' : '' ?>/>
</td>
<td class="swatches-visual-col col-default <%- data.empty_class %>">
<input id="swatch_visual_value_<%- data.id %>" type="hidden" name="swatchvisual[value][<%- data.id %>]" value="<%- data.defaultswatch0 %>" />
<div class="swatch_window" id="swatch_window_option_<%- data.id %>" style="<%- data.swatch0 %>"></div>
<div class="swatch_sub-menu_container" id="swatch_container_option_<%- data.id %>">
<div class="swatch_row position-relative">
<div class="swatch_row_name colorpicker_handler">
<p><?= $escaper->escapeHtml(__('Choose a color')) ?></p>
</div>
</div>
<div class="swatch_row">
<div class="swatch_row_name btn_choose_file_upload" id="swatch_choose_file_option_<%- data.id %>">
<p><?= $escaper->escapeHtml(__('Upload a file')) ?></p>
</div>
</div>
<div class="swatch_row">
<div class="swatch_row_name btn_remove_swatch">
<p><?= $escaper->escapeHtml(__('Clear')) ?></p>
</div>
</div>
</div>
</td>
<?php foreach ($stores as $_store): ?>
<td class="swatch-col-<%- data.id %>">
<input name="optionvisual[value][<%- data.id %>][<?= (int)$_store->getId() ?>]"
value="<%- data.store<?= (int) $_store->getId() ?> %>"
class="input-text<?= ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) ? ' required-option required-unique' : '' ?>"
type="text" <?= ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) ? ' disabled="disabled"' : '' ?>/>
</td>
<?php endforeach; ?>
<?php if ($isColorAttribute): ?>
<td class="col-default">
<input type="hidden"
name="esun_color_option[<%- data.id %>][is_hot_sale]"
value="0" />
<input class="admin__control-checkbox"
id="esun-color-hot-sale-<%- data.id %>"
type="checkbox"
name="esun_color_option[<%- data.id %>][is_hot_sale]"
value="1"
aria-label="<?= $escaper->escapeHtmlAttr(__('Hot Sale')) ?>"
<% if (data.esun_is_hot_sale) { %>checked="checked"<% } %>
<?= ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) ? ' disabled="disabled"' : '' ?> />
<label for="esun-color-hot-sale-<%- data.id %>"
title="<?= $escaper->escapeHtmlAttr(__('Hot Sale')) ?>"></label>
</td>
<?php endif; ?>
<td class="esun-color-option-col">
<input class="input-text"
type="text"
name="esun_color_option[<%- data.id %>][swatch_colors]"
value="<%- data.esun_swatch_colors %>"
placeholder="#FF0000,#FFD800,#18A957" />
<span class="note"><?= $escaper->escapeHtml(__('Used only for the product-page color swatch selector.')) ?></span>
</td>
<td class="esun-color-option-col">
<input type="hidden" name="esun_color_option[<%- data.id %>][ball_image]" value="<%- data.esun_ball_image %>" data-role="esun-ball-image-existing" />
<input type="hidden" name="esun_color_option[<%- data.id %>][ball_image_base64]" value="<%- data.esun_ball_image_base64 %>" data-role="esun-ball-image-base64" />
<input type="hidden" name="esun_color_option[<%- data.id %>][ball_image_name]" value="<%- data.esun_ball_image_name %>" data-role="esun-ball-image-name" />
<input type="hidden" name="esun_color_option[<%- data.id %>][delete_ball_image]" value="<%- data.esun_delete_ball_image %>" data-role="esun-delete-ball-image" />
<input type="file" class="admin__control-file esun-color-ball-input" accept=".jpg,.jpeg,.png,.gif,.webp" />
<div class="esun-color-ball-preview" data-role="esun-ball-preview" <% if (!data.esun_ball_image_url) { %>style="display:none"<% } %>>
<img src="<%- data.esun_ball_image_url %>" alt="" data-role="esun-ball-preview-image" />
<button type="button" class="action-default esun-color-ball-remove">
<span><?= $escaper->escapeHtml(__('Remove')) ?></span>
</button>
</div>
<span class="note"><?= $escaper->escapeHtml(__('Used only in Available Colors.')) ?></span>
</td>
<td id="delete_button_swatch_container_<%- data.id %>" class="col-delete">
<input type="hidden" class="delete-flag" name="optionvisual[delete][<%- data.id %>]" value="" />
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
<button title="<?= $escaper->escapeHtml(__('Delete')) ?>" type="button"
class="action- scalable delete delete-option">
<span><?= $escaper->escapeHtml(__('Delete')) ?></span>
</button>
<?php endif;?>
</td>
</tr>
</script>
<script type="text/x-magento-init">
{
"*": {
"Magento_Swatches/js/visual": <?= /* @noEscape */ $jsonConfig ?> ,
"Esun_Catalog/js/color-option-swatch-admin": {},
"Magento_Catalog/catalog/product/attribute/unique-validate": {
"element": "required-visual-swatch-unique",
"message": "<?= $escaper->escapeHtml(__("The value of Admin must be unique.")) ?>"
}
}
}
</script>
</fieldset>
@@ -0,0 +1,90 @@
<?php
/** @var \Esun\Catalog\Block\Adminhtml\CertificationType\EditBlock $block */
$type = $block->getTypeModel();
$icon = (string)$type->getData('icon');
?>
<div class="page-main-actions">
<div class="page-actions">
<a class="action-secondary" href="<?= $block->escapeUrl($block->getBackUrl()) ?>">
<?= $block->escapeHtml(__('Back')) ?>
</a>
<button class="action-primary" type="submit" form="esun-certification-type-form">
<?= $block->escapeHtml(__('Save Certification Type')) ?>
</button>
</div>
</div>
<form id="esun-certification-type-form"
class="admin__fieldset"
action="<?= $block->escapeUrl($block->getSaveUrl()) ?>"
method="post"
enctype="multipart/form-data">
<?= $block->getBlockHtml('formkey') ?>
<input type="hidden" name="type_id" value="<?= (int)$type->getId() ?>">
<div class="admin__field _required">
<label class="admin__field-label" for="certification-name">
<span><?= $block->escapeHtml(__('Certification Type Name')) ?></span>
</label>
<div class="admin__field-control">
<input id="certification-name"
class="admin__control-text required-entry"
type="text"
name="name"
value="<?= $block->escapeHtmlAttr((string)$type->getData('name')) ?>">
</div>
</div>
<div class="admin__field">
<label class="admin__field-label" for="certification-icon">
<span><?= $block->escapeHtml(__('Icon')) ?></span>
</label>
<div class="admin__field-control">
<?php if ($icon !== ''): ?>
<p>
<img src="<?= $block->escapeUrl($block->getIconUrl($icon)) ?>"
alt=""
style="height:70px;max-width:120px;object-fit:contain;">
</p>
<label>
<input type="checkbox" name="delete_icon" value="1">
<?= $block->escapeHtml(__('Delete current icon')) ?>
</label>
<?php endif; ?>
<input id="certification-icon"
class="admin__control-file"
type="file"
name="icon"
accept=".jpg,.jpeg,.png,.gif,.webp,.svg">
</div>
</div>
<div class="admin__field">
<label class="admin__field-label" for="certification-status">
<span><?= $block->escapeHtml(__('Status')) ?></span>
</label>
<div class="admin__field-control">
<select id="certification-status" class="admin__control-select" name="status">
<option value="1"<?= (int)$type->getData('status') !== 0 ? ' selected' : '' ?>>
<?= $block->escapeHtml(__('Enabled')) ?>
</option>
<option value="0"<?= (int)$type->getData('status') === 0 ? ' selected' : '' ?>>
<?= $block->escapeHtml(__('Disabled')) ?>
</option>
</select>
</div>
</div>
<div class="admin__field">
<label class="admin__field-label" for="certification-sort-order">
<span><?= $block->escapeHtml(__('Sort Order')) ?></span>
</label>
<div class="admin__field-control">
<input id="certification-sort-order"
class="admin__control-text"
type="number"
name="sort_order"
value="<?= (int)$type->getData('sort_order') ?>">
</div>
</div>
</form>
@@ -0,0 +1,57 @@
<?php
/** @var \Esun\Catalog\Block\Adminhtml\CertificationType\ListBlock $block */
$types = $block->getTypes();
?>
<div class="page-main-actions">
<div class="page-actions">
<a class="action-primary" href="<?= $block->escapeUrl($block->getNewUrl()) ?>">
<?= $block->escapeHtml(__('Add Certification Type')) ?>
</a>
</div>
</div>
<table class="data-grid">
<thead>
<tr>
<th class="data-grid-th"><?= $block->escapeHtml(__('ID')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Icon')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Certification Type Name')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Status')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Sort Order')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Action')) ?></th>
</tr>
</thead>
<tbody>
<?php if ($types->getSize()): ?>
<?php foreach ($types as $type): ?>
<tr>
<td><?= (int)$type->getId() ?></td>
<td>
<?php if ((string)$type->getData('icon') !== ''): ?>
<img src="<?= $block->escapeUrl($block->getIconUrl((string)$type->getData('icon'))) ?>"
alt=""
style="height:44px;max-width:80px;object-fit:contain;">
<?php endif; ?>
</td>
<td><?= $block->escapeHtml((string)$type->getData('name')) ?></td>
<td><?= $block->escapeHtml((int)$type->getData('status') === 1 ? __('Enabled') : __('Disabled')) ?></td>
<td><?= (int)$type->getData('sort_order') ?></td>
<td>
<a href="<?= $block->escapeUrl($block->getEditUrl((int)$type->getId())) ?>">
<?= $block->escapeHtml(__('Edit')) ?>
</a>
|
<a href="<?= $block->escapeUrl($block->getDeleteUrl((int)$type->getId())) ?>"
onclick="return confirm('<?= $block->escapeJs(__('Are you sure you want to delete this certification type?')) ?>');">
<?= $block->escapeHtml(__('Delete')) ?>
</a>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="6"><?= $block->escapeHtml(__('No certification types found.')) ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
@@ -0,0 +1,147 @@
<?php
/** @var \Esun\Catalog\Block\Adminhtml\ColorOption\EditBlock $block */
$item = $block->getItem();
$ballImage = (string)$item->getData('ball_image');
?>
<div class="page-main-actions">
<div class="page-actions">
<a class="action-secondary" href="<?= $block->escapeUrl($block->getBackUrl()) ?>">
<?= $block->escapeHtml(__('Back')) ?>
</a>
<button class="action-primary" type="submit" form="esun-color-option-form">
<?= $block->escapeHtml(__('Save Color Option')) ?>
</button>
</div>
</div>
<form id="esun-color-option-form"
class="admin__fieldset"
action="<?= $block->escapeUrl($block->getSaveUrl()) ?>"
method="post"
enctype="multipart/form-data">
<?= $block->getBlockHtml('formkey') ?>
<input type="hidden" name="entity_id" value="<?= (int)$item->getId() ?>">
<div class="admin__field _required">
<label class="admin__field-label" for="color-option-id">
<span><?= $block->escapeHtml(__('Color Option')) ?></span>
</label>
<div class="admin__field-control">
<select id="color-option-id" class="admin__control-select required-entry" name="option_id">
<option value=""><?= $block->escapeHtml(__('-- Please Select --')) ?></option>
<?php foreach ($block->getColorOptions() as $option): ?>
<?php $optionId = (int)$option['value']; ?>
<option value="<?= $optionId ?>"<?= (int)$item->getData('option_id') === $optionId ? ' selected' : '' ?>>
<?= $block->escapeHtml((string)$option['label']) ?>
</option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="admin__field">
<label class="admin__field-label" for="color-display-name">
<span><?= $block->escapeHtml(__('Display Name')) ?></span>
</label>
<div class="admin__field-control">
<input id="color-display-name"
class="admin__control-text"
type="text"
name="display_name"
value="<?= $block->escapeHtmlAttr((string)$item->getData('display_name')) ?>">
<div class="admin__field-note">
<?= $block->escapeHtml(__('Leave empty to use the Magento color option label.')) ?>
</div>
</div>
</div>
<div class="admin__field">
<label class="admin__field-label" for="color-swatch-colors">
<span><?= $block->escapeHtml(__('Swatch Colors')) ?></span>
</label>
<div class="admin__field-control">
<input id="color-swatch-colors"
class="admin__control-text"
type="text"
name="swatch_colors"
value="<?= $block->escapeHtmlAttr((string)$item->getData('swatch_colors')) ?>"
placeholder="#FF0000,#FFD800,#18A957">
<div class="admin__field-note">
<?= $block->escapeHtml(__('Comma-separated hex colors. These are used only for the product-page color swatch selector.')) ?>
</div>
</div>
</div>
<div class="admin__field">
<label class="admin__field-label" for="color-ball-image">
<span><?= $block->escapeHtml(__('Color Ball Image')) ?></span>
</label>
<div class="admin__field-control">
<?php if ($ballImage !== ''): ?>
<p>
<img src="<?= $block->escapeUrl($block->getImageUrl($ballImage)) ?>"
alt=""
style="height:80px;width:80px;object-fit:contain;">
</p>
<label>
<input type="checkbox" name="delete_ball_image" value="1">
<?= $block->escapeHtml(__('Delete current image')) ?>
</label>
<?php endif; ?>
<input id="color-ball-image"
class="admin__control-file"
type="file"
name="ball_image"
accept=".jpg,.jpeg,.png,.gif,.webp">
<div class="admin__field-note">
<?= $block->escapeHtml(__('This image is used only in the Available Colors section.')) ?>
</div>
</div>
</div>
<div class="admin__field">
<label class="admin__field-label" for="color-is-hot-sale">
<span><?= $block->escapeHtml(__('Hot Sale')) ?></span>
</label>
<div class="admin__field-control">
<input type="hidden" name="is_hot_sale" value="0">
<input id="color-is-hot-sale"
class="admin__control-checkbox"
type="checkbox"
name="is_hot_sale"
value="1"<?= (int)$item->getData('is_hot_sale') === 1 ? ' checked' : '' ?>>
<label for="color-is-hot-sale">
<span><?= $block->escapeHtml(__('Show this color as a Hot Sale color in category filters.')) ?></span>
</label>
</div>
</div>
<div class="admin__field">
<label class="admin__field-label" for="color-status">
<span><?= $block->escapeHtml(__('Status')) ?></span>
</label>
<div class="admin__field-control">
<select id="color-status" class="admin__control-select" name="status">
<option value="1"<?= (int)$item->getData('status') !== 0 ? ' selected' : '' ?>>
<?= $block->escapeHtml(__('Enabled')) ?>
</option>
<option value="0"<?= (int)$item->getData('status') === 0 ? ' selected' : '' ?>>
<?= $block->escapeHtml(__('Disabled')) ?>
</option>
</select>
</div>
</div>
<div class="admin__field">
<label class="admin__field-label" for="color-sort-order">
<span><?= $block->escapeHtml(__('Sort Order')) ?></span>
</label>
<div class="admin__field-control">
<input id="color-sort-order"
class="admin__control-text"
type="number"
name="sort_order"
value="<?= (int)$item->getData('sort_order') ?>">
</div>
</div>
</form>
@@ -0,0 +1,72 @@
<?php
/** @var \Esun\Catalog\Block\Adminhtml\ColorOption\ListBlock $block */
$items = $block->getItems();
?>
<div class="page-main-actions">
<div class="page-actions">
<a class="action-primary" href="<?= $block->escapeUrl($block->getNewUrl()) ?>">
<?= $block->escapeHtml(__('Add Color Option')) ?>
</a>
</div>
</div>
<table class="data-grid">
<thead>
<tr>
<th class="data-grid-th"><?= $block->escapeHtml(__('ID')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Color Option')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Display Name')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Swatch Colors')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Color Ball')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Hot Sale')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Status')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Sort Order')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Action')) ?></th>
</tr>
</thead>
<tbody>
<?php if ($items->getSize()): ?>
<?php foreach ($items as $item): ?>
<?php
$swatchColors = array_filter(array_map('trim', explode(',', (string)$item->getData('swatch_colors'))));
$ballImage = (string)$item->getData('ball_image');
?>
<tr>
<td><?= (int)$item->getId() ?></td>
<td><?= $block->escapeHtml($block->getColorOptionLabel((int)$item->getData('option_id'))) ?></td>
<td><?= $block->escapeHtml((string)$item->getData('display_name')) ?></td>
<td>
<?php foreach ($swatchColors as $color): ?>
<span title="<?= $block->escapeHtmlAttr($color) ?>"
style="display:inline-block;width:22px;height:22px;border:1px solid #ccc;border-radius:50%;background:<?= $block->escapeHtmlAttr($color) ?>;"></span>
<?php endforeach; ?>
</td>
<td>
<?php if ($ballImage !== ''): ?>
<img src="<?= $block->escapeUrl($block->getImageUrl($ballImage)) ?>"
alt=""
style="height:44px;width:44px;object-fit:contain;">
<?php endif; ?>
</td>
<td><?= $block->escapeHtml((int)$item->getData('is_hot_sale') === 1 ? __('Yes') : __('No')) ?></td>
<td><?= $block->escapeHtml((int)$item->getData('status') === 1 ? __('Enabled') : __('Disabled')) ?></td>
<td><?= (int)$item->getData('sort_order') ?></td>
<td>
<a href="<?= $block->escapeUrl($block->getEditUrl((int)$item->getId())) ?>">
<?= $block->escapeHtml(__('Edit')) ?>
</a>
|
<a href="<?= $block->escapeUrl($block->getDeleteUrl((int)$item->getId())) ?>"
onclick="return confirm('<?= $block->escapeJs(__('Are you sure you want to delete this color option?')) ?>');">
<?= $block->escapeHtml(__('Delete')) ?>
</a>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="9"><?= $block->escapeHtml(__('No color options found.')) ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
@@ -0,0 +1,66 @@
<?php
/** @var \Esun\Catalog\Block\Adminhtml\Faq\EditBlock $block */
$faq = $block->getFaqModel();
$selectedStores = array_map('intval', explode(',', (string)($faq->getData('store_ids') ?: '0')));
?>
<form method="post" action="<?= $block->escapeUrl($block->getSaveUrl()) ?>">
<?= $block->getBlockHtml('formkey') ?>
<input type="hidden" name="faq_id" value="<?= (int)$faq->getId() ?>">
<div class="page-main-actions"><div class="page-actions">
<a class="action-secondary" href="<?= $block->escapeUrl($block->getBackUrl()) ?>">
<span><?= $block->escapeHtml(__('Back')) ?></span>
</a>
<button class="action-primary" type="submit"><span><?= $block->escapeHtml(__('Save FAQ')) ?></span></button>
</div></div>
<fieldset class="admin__fieldset">
<div class="admin__field _required">
<label class="admin__field-label"><span><?= $block->escapeHtml(__('Title')) ?></span></label>
<div class="admin__field-control">
<input class="admin__control-text" type="text" name="title" required
value="<?= $block->escapeHtmlAttr((string)$faq->getData('title')) ?>">
</div>
</div>
<div class="admin__field">
<label class="admin__field-label"><span><?= $block->escapeHtml(__('Stores')) ?></span></label>
<div class="admin__field-control">
<select class="admin__control-multiselect" name="store_ids[]" multiple size="8">
<?php foreach ($block->getStoreOptions() as $group): ?>
<?php if (isset($group['value']) && is_array($group['value'])): ?>
<optgroup label="<?= $block->escapeHtmlAttr((string)$group['label']) ?>">
<?php foreach ($group['value'] as $store): ?>
<option value="<?= (int)$store['value'] ?>" <?= in_array((int)$store['value'], $selectedStores, true) ? 'selected' : '' ?>>
<?= $block->escapeHtml((string)$store['label']) ?>
</option>
<?php endforeach; ?>
</optgroup>
<?php else: ?>
<option value="<?= (int)$group['value'] ?>" <?= in_array((int)$group['value'], $selectedStores, true) ? 'selected' : '' ?>>
<?= $block->escapeHtml((string)$group['label']) ?>
</option>
<?php endif; ?>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="admin__field">
<label class="admin__field-label"><span><?= $block->escapeHtml(__('Content')) ?></span></label>
<div class="admin__field-control">
<?= /* @noEscape */ $block->getContentEditorHtml() ?>
</div>
</div>
<div class="admin__field">
<label class="admin__field-label"><span><?= $block->escapeHtml(__('Status')) ?></span></label>
<div class="admin__field-control"><select class="admin__control-select" name="status">
<option value="1" <?= !$faq->getId() || (int)$faq->getData('status') === 1 ? 'selected' : '' ?>><?= $block->escapeHtml(__('Enabled')) ?></option>
<option value="0" <?= $faq->getId() && (int)$faq->getData('status') === 0 ? 'selected' : '' ?>><?= $block->escapeHtml(__('Disabled')) ?></option>
</select></div>
</div>
<div class="admin__field">
<label class="admin__field-label"><span><?= $block->escapeHtml(__('Sort Order')) ?></span></label>
<div class="admin__field-control">
<input class="admin__control-text" type="number" name="sort_order"
value="<?= (int)$faq->getData('sort_order') ?>">
</div>
</div>
</fieldset>
</form>
@@ -0,0 +1,41 @@
<?php
/** @var \Esun\Catalog\Block\Adminhtml\Faq\ListBlock $block */
?>
<div class="page-main-actions">
<div class="page-actions">
<a class="action-primary" href="<?= $block->escapeUrl($block->getNewUrl()) ?>">
<span><?= $block->escapeHtml(__('Add FAQ')) ?></span>
</a>
</div>
</div>
<table class="data-grid">
<thead>
<tr>
<th class="data-grid-th"><?= $block->escapeHtml(__('ID')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Title')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Stores')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Status')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Sort Order')) ?></th>
<th class="data-grid-th"><?= $block->escapeHtml(__('Actions')) ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($block->getFaqs() as $faq): ?>
<tr>
<td><?= (int)$faq->getId() ?></td>
<td><?= $block->escapeHtml((string)$faq->getData('title')) ?></td>
<td><?= $block->escapeHtml((string)$faq->getData('store_ids')) ?></td>
<td><?= $block->escapeHtml((int)$faq->getData('status') ? __('Enabled') : __('Disabled')) ?></td>
<td><?= (int)$faq->getData('sort_order') ?></td>
<td>
<a href="<?= $block->escapeUrl($block->getEditUrl((int)$faq->getId())) ?>"><?= $block->escapeHtml(__('Edit')) ?></a>
|
<a href="<?= $block->escapeUrl($block->getDeleteUrl((int)$faq->getId())) ?>"
onclick="return confirm('<?= $block->escapeJs(__('Delete this FAQ?')) ?>')">
<?= $block->escapeHtml(__('Delete')) ?>
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
@@ -0,0 +1,177 @@
<?php
/**
* @var \Esun\Catalog\Block\Adminhtml\MixStepPricing\Form $block
* @var \Magento\Framework\Escaper $escaper
*/
$state = $block->getValidationState();
$stats = (array)($state['stats'] ?? []);
$preview = (array)($state['preview'] ?? []);
$invalidPreview = (array)($state['invalid_preview'] ?? []);
$isDelete = $block->isDelete();
?>
<div class="admin__fieldset-wrapper">
<div class="admin__fieldset-wrapper-title">
<strong class="title">
<span><?= $escaper->escapeHtml($isDelete ? __('Batch Delete') : __('Batch Import')) ?></span>
</strong>
</div>
<div class="admin__fieldset-wrapper-content">
<fieldset class="admin__fieldset">
<div class="admin__field">
<div class="admin__field-control">
<p>
<?php if ($isDelete): ?>
<?= $escaper->escapeHtml(__('Deletes all Mix Step Pricing for each sku + website across every Store View.')) ?>
<?php else: ?>
<?= $escaper->escapeHtml(__('Replaces the complete Mix Step Pricing tier set for each sku + website across every Store View.')) ?>
<?php endif; ?>
</p>
<p>
<a class="action-secondary" href="<?= $escaper->escapeUrl($block->getTemplateUrl()) ?>">
<span><?= $escaper->escapeHtml(__('Download Excel Template')) ?></span>
</a>
</p>
</div>
</div>
<form action="<?= $escaper->escapeUrl($block->getValidateUrl()) ?>" method="post" enctype="multipart/form-data">
<input name="form_key" type="hidden" value="<?= $escaper->escapeHtmlAttr($block->getFormKey()) ?>"/>
<div class="admin__field required">
<label class="admin__field-label" for="mix-step-pricing-file">
<span><?= $escaper->escapeHtml(__('Excel File')) ?></span>
</label>
<div class="admin__field-control">
<input id="mix-step-pricing-file" class="admin__control-file" type="file"
name="excel_file" accept=".xlsx,.xls" required/>
<div class="note"><?= $escaper->escapeHtml(__('The file is validated before any data is changed.')) ?></div>
</div>
</div>
<div class="admin__actions">
<button class="action-primary" type="submit">
<span><?= $escaper->escapeHtml(__('Validate File')) ?></span>
</button>
</div>
</form>
</fieldset>
</div>
</div>
<?php if ($state): ?>
<div class="admin__fieldset-wrapper">
<div class="admin__fieldset-wrapper-title">
<strong class="title"><span><?= $escaper->escapeHtml(__('Validation Preview')) ?></span></strong>
</div>
<div class="admin__fieldset-wrapper-content">
<fieldset class="admin__fieldset">
<p>
<?= $escaper->escapeHtml(__(
'%1 valid data rows; %2 sku + website groups; %3 Store View writes.',
(int)($stats['valid_rows'] ?? 0),
(int)($stats['groups'] ?? 0),
(int)($stats['store_view_writes'] ?? 0)
)) ?>
</p>
<?php if ($preview): ?>
<div class="admin__data-grid-wrap">
<table class="data-grid">
<thead>
<tr>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Excel Row')) ?></th>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('SKU')) ?></th>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Website')) ?></th>
<?php if (!$isDelete): ?>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Combined Qty From')) ?></th>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Pricing Method')) ?></th>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Discount % / Unit Price')) ?></th>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php foreach ($preview as $item): ?>
<tr class="data-row">
<td><?= $escaper->escapeHtml((string)($item['row'] ?? '')) ?></td>
<td><?= $escaper->escapeHtml((string)($item['sku'] ?? '')) ?></td>
<td><?= $escaper->escapeHtml((string)($item['website'] ?? '')) ?></td>
<?php if (!$isDelete): ?>
<td><?= $escaper->escapeHtml((string)($item['combined_qty_from'] ?? '')) ?></td>
<td><?= $escaper->escapeHtml((string)($item['pricing_method'] ?? '')) ?></td>
<td><?= $escaper->escapeHtml((string)($item['value'] ?? '')) ?></td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<?php if (!empty($state['preview_truncated'])): ?>
<p class="note"><?= $escaper->escapeHtml(__('Preview is limited to the first 100 valid rows.')) ?></p>
<?php endif; ?>
<?php if ($invalidPreview): ?>
<div class="mix-step-pricing-invalid-data">
<h3><?= $escaper->escapeHtml(__('Invalid Data')) ?></h3>
<p>
<?= $escaper->escapeHtml(__('%1 invalid rows.', (int)($stats['invalid_rows'] ?? 0))) ?>
</p>
<div class="admin__data-grid-wrap">
<table class="data-grid">
<thead>
<tr>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Excel Row')) ?></th>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('SKU')) ?></th>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Website')) ?></th>
<?php if (!$isDelete): ?>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Combined Qty From')) ?></th>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Pricing Method')) ?></th>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Discount % / Unit Price')) ?></th>
<?php endif; ?>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Reason')) ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($invalidPreview as $item): ?>
<tr class="data-row">
<td><?= $escaper->escapeHtml((string)($item['row'] ?? '')) ?></td>
<td><?= $escaper->escapeHtml((string)($item['sku'] ?? '')) ?></td>
<td><?= $escaper->escapeHtml((string)($item['website'] ?? '')) ?></td>
<?php if (!$isDelete): ?>
<td><?= $escaper->escapeHtml((string)($item['combined_qty_from'] ?? '')) ?></td>
<td><?= $escaper->escapeHtml((string)($item['pricing_method'] ?? '')) ?></td>
<td><?= $escaper->escapeHtml((string)($item['value'] ?? '')) ?></td>
<?php endif; ?>
<td><?= $escaper->escapeHtml((string)($item['reason'] ?? '')) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php if (!empty($state['invalid_preview_truncated'])): ?>
<p class="note">
<?= $escaper->escapeHtml(__('Invalid data is limited to the first 100 rows.')) ?>
</p>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if (!empty($state['valid'])): ?>
<form action="<?= $escaper->escapeUrl($block->getRunUrl()) ?>" method="post">
<input name="form_key" type="hidden" value="<?= $escaper->escapeHtmlAttr($block->getFormKey()) ?>"/>
<?php if ($isDelete): ?>
<div class="admin__field required">
<div class="admin__field-control">
<input id="confirm-delete-all-tiers" type="checkbox" name="confirm_delete" value="1" required/>
<label for="confirm-delete-all-tiers">
<?= $escaper->escapeHtml(__('I understand this permanently deletes all tiers for every listed sku + website.')) ?>
</label>
</div>
</div>
<?php endif; ?>
<button class="<?= $isDelete ? 'action-delete' : 'action-primary' ?>" type="submit">
<span><?= $escaper->escapeHtml($isDelete ? __('Delete Validated Prices') : __('Import Validated Prices')) ?></span>
</button>
</form>
<?php endif; ?>
</fieldset>
</div>
</div>
<?php endif; ?>
@@ -0,0 +1,81 @@
<?php
/**
* @var \Esun\Catalog\Block\Adminhtml\ProductRecommendation\ImportForm $block
* @var \Magento\Framework\Escaper $escaper
*/
$state = $block->getValidationState();
$stats = (array)($state['stats'] ?? []);
$preview = (array)($state['preview'] ?? []);
?>
<div class="admin__fieldset-wrapper">
<div class="admin__fieldset-wrapper-title">
<strong class="title"><span><?= $escaper->escapeHtml(__('Excel Import')) ?></span></strong>
</div>
<div class="admin__fieldset-wrapper-content">
<fieldset class="admin__fieldset">
<p><?= $escaper->escapeHtml(__('Each source SKU + website group completely replaces its existing recommendation set. Partial changes must be made on the product edit page.')) ?></p>
<p><a class="action-secondary" href="<?= $escaper->escapeUrl($block->getTemplateUrl()) ?>">
<span><?= $escaper->escapeHtml(__('Download Excel Template')) ?></span>
</a></p>
<form action="<?= $escaper->escapeUrl($block->getValidateUrl()) ?>" method="post" enctype="multipart/form-data">
<input name="form_key" type="hidden" value="<?= $escaper->escapeHtmlAttr($block->getFormKey()) ?>"/>
<div class="admin__field required">
<label class="admin__field-label" for="product-recommendation-file">
<span><?= $escaper->escapeHtml(__('Excel File')) ?></span>
</label>
<div class="admin__field-control">
<input id="product-recommendation-file" class="admin__control-file" type="file"
name="excel_file" accept=".xlsx,.xls" required/>
<div class="note"><?= $escaper->escapeHtml(__('The file is validated before any data is changed.')) ?></div>
</div>
</div>
<button class="action-primary" type="submit"><span><?= $escaper->escapeHtml(__('Validate File')) ?></span></button>
</form>
</fieldset>
</div>
</div>
<?php if ($state): ?>
<div class="admin__fieldset-wrapper">
<div class="admin__fieldset-wrapper-title">
<strong class="title"><span><?= $escaper->escapeHtml(__('Replacement Preview')) ?></span></strong>
</div>
<div class="admin__fieldset-wrapper-content">
<fieldset class="admin__fieldset">
<p><?= $escaper->escapeHtml(__(
'%1 rows define %2 product + website sets containing %3 recommendations.',
(int)($stats['rows'] ?? 0),
(int)($stats['groups'] ?? 0),
(int)($stats['recommendations'] ?? 0)
)) ?></p>
<?php if ($preview): ?>
<div class="admin__data-grid-wrap"><table class="data-grid">
<thead><tr>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Source SKU')) ?></th>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Website')) ?></th>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Recommended SKUs (display order)')) ?></th>
<th class="data-grid-th"><?= $escaper->escapeHtml(__('Count')) ?></th>
</tr></thead>
<tbody><?php foreach ($preview as $item): ?><tr class="data-row">
<td><?= $escaper->escapeHtml((string)$item['source_sku']) ?></td>
<td><?= $escaper->escapeHtml((string)$item['website']) ?></td>
<td><?= $escaper->escapeHtml((string)$item['recommended_skus']) ?></td>
<td><?= (int)$item['count'] ?></td>
</tr><?php endforeach; ?></tbody>
</table></div>
<?php endif; ?>
<?php if (!empty($state['preview_truncated'])): ?>
<p class="note"><?= $escaper->escapeHtml(__('Preview is limited to the first 100 groups.')) ?></p>
<?php endif; ?>
<?php if (!empty($state['valid'])): ?>
<form action="<?= $escaper->escapeUrl($block->getRunUrl()) ?>" method="post">
<input name="form_key" type="hidden" value="<?= $escaper->escapeHtmlAttr($block->getFormKey()) ?>"/>
<button class="action-primary" type="submit">
<span><?= $escaper->escapeHtml(__('Import and Replace Recommendations')) ?></span>
</button>
</form>
<?php endif; ?>
</fieldset>
</div>
</div>
<?php endif; ?>
@@ -0,0 +1,69 @@
<?php
/** @var \Esun\Catalog\Block\Adminhtml\SpecificationBrand\EditBlock $block */
$brand = $block->getBrand();
$logo = (string)$brand->getData('brand_logo');
?>
<form method="post" action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" enctype="multipart/form-data">
<?= $block->getBlockHtml('formkey') ?>
<input type="hidden" name="brand_id" value="<?= (int)$brand->getId() ?>">
<div class="page-main-actions"><div class="page-actions">
<a class="action-secondary" href="<?= $block->escapeUrl($block->getBackUrl()) ?>">
<span><?= $block->escapeHtml(__('Back')) ?></span>
</a>
<button class="action-primary" type="submit"><span><?= $block->escapeHtml(__('Save Brand')) ?></span></button>
</div></div>
<fieldset class="admin__fieldset">
<div class="admin__field _required">
<label class="admin__field-label"><span><?= $block->escapeHtml(__('Brand Name')) ?></span></label>
<div class="admin__field-control">
<input class="admin__control-text" type="text" name="brand_name" required
value="<?= $block->escapeHtmlAttr((string)$brand->getData('brand_name')) ?>">
</div>
</div>
<div class="admin__field">
<label class="admin__field-label"><span><?= $block->escapeHtml(__('Brand Logo')) ?></span></label>
<div class="admin__field-control">
<?php if ($logo !== ''): ?>
<div style="margin-bottom:1.5rem">
<img src="<?= $block->escapeUrl($block->getMediaUrl($logo)) ?>"
alt=""
style="display:block;max-width:16rem;max-height:8rem;margin-bottom:1rem;border:1px solid #d6d6d6;background:#fff;padding:.5rem">
<label>
<input type="checkbox" name="delete_logo" value="1">
<?= $block->escapeHtml(__('Delete current logo')) ?>
</label>
</div>
<?php endif; ?>
<input type="file" name="brand_logo" accept="image/jpeg,image/png,image/gif,image/webp,image/svg+xml">
<p class="note"><?= $block->escapeHtml(__('Allowed: JPG, PNG, GIF, WebP and SVG.')) ?></p>
</div>
</div>
<div class="admin__field">
<label class="admin__field-label"><span><?= $block->escapeHtml(__('Product Specific')) ?></span></label>
<div class="admin__field-control">
<select class="admin__control-select" name="is_product_specific">
<option value="1" <?= (int)$brand->getData('is_product_specific') !== 0 ? 'selected' : '' ?>>
<?= $block->escapeHtml(__('Yes - match files by product name')) ?>
</option>
<option value="0" <?= (int)$brand->getData('is_product_specific') === 0 ? 'selected' : '' ?>>
<?= $block->escapeHtml(__('No - files are common for all products')) ?>
</option>
</select>
</div>
</div>
<div class="admin__field">
<label class="admin__field-label"><span><?= $block->escapeHtml(__('Status')) ?></span></label>
<div class="admin__field-control"><select class="admin__control-select" name="status">
<option value="1" <?= !$brand->getId() || (int)$brand->getData('status') === 1 ? 'selected' : '' ?>><?= $block->escapeHtml(__('Enabled')) ?></option>
<option value="0" <?= $brand->getId() && (int)$brand->getData('status') === 0 ? 'selected' : '' ?>><?= $block->escapeHtml(__('Disabled')) ?></option>
</select></div>
</div>
<div class="admin__field">
<label class="admin__field-label"><span><?= $block->escapeHtml(__('Sort Order')) ?></span></label>
<div class="admin__field-control">
<input class="admin__control-text" type="number" name="sort_order"
value="<?= (int)$brand->getData('sort_order') ?>">
</div>
</div>
</fieldset>
</form>
@@ -0,0 +1,52 @@
<?php
/** @var \Esun\Catalog\Block\Adminhtml\SpecificationImport\EditBlock $block */
$import = $block->getImport();
?>
<form method="post" action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" enctype="multipart/form-data">
<?= $block->getBlockHtml('formkey') ?>
<input type="hidden" name="import_id" value="<?= (int)$import->getId() ?>">
<div class="page-main-actions"><div class="page-actions">
<a class="action-secondary" href="<?= $block->escapeUrl($block->getBackUrl()) ?>">
<span><?= $block->escapeHtml(__('Back')) ?></span>
</a>
<button class="action-primary" type="submit"><span><?= $block->escapeHtml(__('Save and Import ZIP')) ?></span></button>
</div></div>
<fieldset class="admin__fieldset">
<div class="admin__field _required">
<label class="admin__field-label"><span><?= $block->escapeHtml(__('Brand')) ?></span></label>
<div class="admin__field-control">
<select class="admin__control-select" name="brand_id" required>
<option value=""><?= $block->escapeHtml(__('Please select')) ?></option>
<?php foreach ($block->getBrands() as $brand): ?>
<option value="<?= (int)$brand->getId() ?>"
<?= (int)$import->getData('brand_id') === (int)$brand->getId() ? 'selected' : '' ?>>
<?= $block->escapeHtml((string)$brand->getData('brand_name')) ?>
</option>
<?php endforeach; ?>
</select>
<p class="note">
<a href="<?= $block->escapeUrl($block->getBrandUrl()) ?>" target="_blank" rel="noopener">
<?= $block->escapeHtml(__('Create a new brand')) ?>
</a>
</p>
</div>
</div>
<div class="admin__field <?= $import->getId() ? '' : '_required' ?>">
<label class="admin__field-label"><span><?= $block->escapeHtml(__('Specifications ZIP')) ?></span></label>
<div class="admin__field-control">
<?php if ((string)$import->getData('archive_file') !== ''): ?>
<p>
<a href="<?= $block->escapeUrl($block->getMediaUrl((string)$import->getData('archive_file'))) ?>"
target="_blank"
rel="noopener">
<?= $block->escapeHtml(basename((string)$import->getData('archive_file'))) ?>
</a>
</p>
<p class="note"><?= $block->escapeHtml(__('Uploading a new ZIP replaces all existing parsed files for this brand.')) ?></p>
<?php endif; ?>
<input type="file" name="archive_file" accept=".zip" <?= $import->getId() ? '' : 'required' ?>>
<p class="note"><?= $block->escapeHtml(__('Only ZIP files are supported. The ZIP should contain Brand / Model / specification files.')) ?></p>
</div>
</div>
</fieldset>
</form>