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,75 @@
<?php
/**
* @var \Esun\Homepage\Block\Accessories $block
* @var \Magento\Framework\Escaper $escaper
*/
$products = $block->getProducts();
if (!$products) {
return;
}
$backgroundImageUrl = $block->getBackgroundImageUrl();
$exploreAllUrl = $block->getExploreAllUrl();
?>
<section class="esun-accessories" aria-labelledby="esun-accessories-title">
<div class="esun-accessories__heading">
<h2 class="typo-section-title" id="esun-accessories-title"><?= $escaper->escapeHtml(__('Accessories')) ?></h2>
<a class="esun-accessories__explore"
href="<?= $exploreAllUrl ? $escaper->escapeUrl($exploreAllUrl) : '#' ?>"
<?= $exploreAllUrl ? '' : 'role="link" aria-disabled="true" onclick="return false;"' ?>>
<?= $escaper->escapeHtml(__('Explore All')) ?>
<span aria-hidden="true">&gt;</span>
</a>
</div>
<div class="esun-accessories__banner"
<?php if ($backgroundImageUrl): ?>
style="background-image: url('<?= $escaper->escapeUrl($backgroundImageUrl) ?>');background-repeat: no-repeat;"
<?php endif; ?>>
<ol class="esun-accessories__products">
<?php foreach ($products as $product): ?>
<li class="esun-accessories__item">
<article class="esun-accessories__card">
<a class="esun-accessories__image"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>"
aria-label="<?= $escaper->escapeHtmlAttr($product->getName()) ?>">
<?= /* @noEscape */ $block->getImage($product, 'category_page_grid')->toHtml() ?>
</a>
<div class="esun-accessories__details">
<h3>
<a href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>">
<?= $escaper->escapeHtml($product->getName()) ?>
</a>
</h3>
<div class="esun-accessories__price">
<span class="esun-accessories__final-price">
<?= $escaper->escapeHtml($block->getFormattedFinalPrice($product)) ?>
</span>
<?php if ($block->hasRegularPrice($product)): ?>
<span class="esun-accessories__regular-price">
<?= $escaper->escapeHtml($block->getFormattedRegularPrice($product)) ?>
</span>
<?php endif; ?>
</div>
<a class="esun-accessories__cart"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>"
title="<?= $escaper->escapeHtmlAttr(__('View Product')) ?>">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M3 4h2l2.2 10.2a2 2 0 0 0 2 1.6h7.7a2 2 0 0 0 2-1.6L20 8H7M10 20a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm8 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z" />
</svg>
<span class="esun-accessories__visually-hidden">
<?= $escaper->escapeHtml(__('View Product')) ?>
</span>
</a>
</div>
</article>
</li>
<?php endforeach; ?>
</ol>
</div>
</section>
@@ -0,0 +1,81 @@
<?php
/**
* @var \Esun\Homepage\Block\Application $block
* @var \Magento\Framework\Escaper $escaper
*/
$items = $block->getItems();
if (!$items) {
return;
}
$exploreAllUrl = $block->getExploreAllUrl();
?>
<section class="esun-application" aria-labelledby="esun-application-title">
<div class="esun-application__heading">
<h2 class="typo-section-title" id="esun-application-title"><?= $escaper->escapeHtml(__('Application')) ?></h2>
<div class="esun-application__heading-row">
<?php if ($block->getSubtitle()): ?>
<p class="typo-product-title"><?= $escaper->escapeHtml($block->getSubtitle()) ?></p>
<?php endif; ?>
<a class="esun-application__explore-all"
href="<?= $exploreAllUrl ? $escaper->escapeUrl($exploreAllUrl) : '#' ?>"
<?= $exploreAllUrl ? '' : 'role="link" aria-disabled="true" onclick="return false;"' ?>>
<?= $escaper->escapeHtml(__('Explore All Use Case')) ?>
<span aria-hidden="true">&gt;</span>
</a>
</div>
</div>
<div class="esun-application__items" data-role="esun-application-items">
<?php foreach ($items as $item): ?>
<?php
$thumbnailUrl = (string) ($item['thumbnail_url'] ?: $item['image_url']);
$hasHoverImage = (string) $item['image_url'] !== '';
$linkUrl = trim((string) $item['link_url']);
?>
<article class="esun-application__item<?= $hasHoverImage ? ' esun-application__item--interactive' : '' ?>"
<?= $hasHoverImage ? 'tabindex="0"' : '' ?>>
<?php if ($thumbnailUrl): ?>
<img class="esun-application__thumbnail"
src="<?= $escaper->escapeUrl($thumbnailUrl) ?>"
alt="<?= $escaper->escapeHtmlAttr($item['title']) ?>">
<?php endif; ?>
<?php if ($hasHoverImage): ?>
<img class="esun-application__hover-image"
src="<?= $escaper->escapeUrl($item['image_url']) ?>"
alt="">
<?php endif; ?>
<span class="esun-application__shade" aria-hidden="true"></span>
<div class="esun-application__default-copy">
<?php if ($item['icon_url']): ?>
<span class="esun-application__icon">
<img src="<?= $escaper->escapeUrl($item['icon_url']) ?>" alt="">
</span>
<?php endif; ?>
<h3><?= $escaper->escapeHtml($item['title']) ?></h3>
</div>
<?php if ($hasHoverImage): ?>
<div class="esun-application__hover-copy">
<h3><?= $escaper->escapeHtml($item['title']) ?></h3>
<a class="esun-application__explore"
href="<?= $linkUrl ? $escaper->escapeUrl($linkUrl) : '#' ?>"
<?= $linkUrl ? '' : 'aria-disabled="true" onclick="return false;"' ?>>
<?= $escaper->escapeHtml(__('Explore More')) ?>
</a>
</div>
<?php endif; ?>
</article>
<?php endforeach; ?>
</div>
</section>
<script type="text/x-magento-init">
{
"[data-role=esun-application-items]": {
"Esun_Homepage/js/application": {}
}
}
</script>
@@ -0,0 +1,75 @@
<?php
/**
* @var \Esun\Homepage\Block\AwardsReviews $block
* @var \Magento\Framework\Escaper $escaper
*/
$items = $block->getItems();
if (!$items) {
return;
}
$hasNavigation = count($items) > 1;
?>
<section class="esun-awards-reviews" aria-labelledby="esun-awards-reviews-title">
<div class="esun-awards-reviews__heading">
<h2 class="typo-section-title" id="esun-awards-reviews-title">
<?= $escaper->escapeHtml(__('Awards & Reviews')) ?>
</h2>
<?php if ($hasNavigation): ?>
<div class="esun-awards-reviews__navigation">
<button class="esun-awards-reviews__previous"
type="button"
aria-label="<?= $escaper->escapeHtmlAttr(__('Previous')) ?>">
<span class="arrow-left" aria-hidden="true"></span>
</button>
<button class="esun-awards-reviews__next"
type="button"
aria-label="<?= $escaper->escapeHtmlAttr(__('Next')) ?>">
<span class="arrow-right" aria-hidden="true"></span>
</button>
</div>
<?php endif; ?>
</div>
<div class="esun-awards-reviews__slider swiper-container"
data-role="esun-awards-reviews-slider"
data-has-navigation="<?= $hasNavigation ? 'true' : 'false' ?>">
<div class="swiper-wrapper">
<?php foreach ($items as $item): ?>
<?php $imageUrl = (string) ($item['image_url'] ?: $item['thumbnail_url']); ?>
<article class="esun-awards-reviews__slide swiper-slide">
<div class="esun-awards-reviews__card">
<img class="esun-awards-reviews__thumbnail"
src="<?= $escaper->escapeUrl($item['thumbnail_url']) ?>"
alt="<?= $escaper->escapeHtmlAttr($item['title']) ?>">
<img class="esun-awards-reviews__image"
src="<?= $escaper->escapeUrl($imageUrl) ?>"
alt="<?= $escaper->escapeHtmlAttr($item['title']) ?>">
<div class="esun-awards-reviews__copy">
<?php if ($item['title']): ?>
<h3><?= $escaper->escapeHtml($item['title']) ?></h3>
<?php endif; ?>
<?php if ($item['description']): ?>
<div class="esun-awards-reviews__description">
<?= /* @noEscape */ nl2br($escaper->escapeHtml($item['description'])) ?>
</div>
<?php endif; ?>
</div>
</div>
</article>
<?php endforeach; ?>
</div>
</div>
</section>
<script type="text/x-magento-init">
{
"[data-role=esun-awards-reviews-slider]": {
"Esun_Homepage/js/awards-reviews": {}
}
}
</script>
@@ -0,0 +1,156 @@
<?php
/**
* @var \Esun\Homepage\Block\CatalogRuleDeal $block
* @var \Magento\Framework\Escaper $escaper
*/
if (!$block->isAvailable()) {
return;
}
$products = $block->getProducts();
$maximumDiscount = $block->getMaximumDiscount();
$countdownEnd = $block->getCountdownEnd();
?>
<section class="esun-rule-deal" aria-labelledby="esun-rule-deal-title">
<div class="esun-rule-deal__header">
<div class="esun-rule-deal__tag" aria-hidden="true">
<span>%</span>
</div>
<h2 class="esun-rule-deal__title" id="esun-rule-deal-title">
<?= $escaper->escapeHtml($block->getHeading()) ?>
<?php if ($block->getAccentHeading()): ?>
<span><?= $escaper->escapeHtml($block->getAccentHeading()) ?></span>
<?php endif; ?>
</h2>
<?php if ($countdownEnd): ?>
<div class="esun-rule-deal__countdown"
data-role="esun-rule-countdown"
data-end="<?= $escaper->escapeHtmlAttr($countdownEnd) ?>">
<?php foreach (['days' => __('Days'), 'hours' => __('Hours'), 'minutes' => __('Minutes'), 'seconds' => __('Seconds')] as $unit => $label): ?>
<div class="esun-rule-deal__time">
<strong data-time="<?= $escaper->escapeHtmlAttr($unit) ?>">00</strong>
<span><?= $escaper->escapeHtml($label) ?></span>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if ($maximumDiscount > 0): ?>
<div class="esun-rule-deal__maximum">
<strong><?= $escaper->escapeHtml($maximumDiscount) ?>%</strong>
<span><?= $escaper->escapeHtml(__('Save Max')) ?></span>
</div>
<?php endif; ?>
</div>
<ol class="esun-rule-deal__products">
<?php foreach ($products as $product): ?>
<?php
$discount = $block->getProductDiscount($product);
$colorSwatches = $block->getColorSwatches($product);
$visibleSwatches = array_slice($colorSwatches, 0, 3);
$remainingSwatches = max(0, count($colorSwatches) - count($visibleSwatches));
?>
<li class="esun-rule-deal__product" data-role="esun-product-card">
<div class="esun-rule-deal__image">
<?php if ($discount > 0): ?>
<span class="esun-rule-deal__discount">
<?= $escaper->escapeHtml(__('%1% OFF', $discount)) ?>
</span>
<?php endif; ?>
<a href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>"
data-role="esun-product-image"
tabindex="-1"
aria-hidden="true">
<?= /* @noEscape */ $block->getImage($product, 'category_page_grid')->toHtml() ?>
</a>
</div>
<div class="esun-rule-deal__details">
<h3>
<a href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>">
<?= $escaper->escapeHtml($product->getName()) ?>
</a>
</h3>
<div class="esun-rule-deal__price">
<span class="esun-rule-deal__final-price">
<?= $escaper->escapeHtml($block->getFormattedFinalPrice($product)) ?>
</span>
<?php if ($block->hasRegularPrice($product)): ?>
<span class="esun-rule-deal__regular-price">
<?= $escaper->escapeHtml($block->getFormattedRegularPrice($product)) ?>
</span>
<?php endif; ?>
</div>
<div class="color-swatches-cart">
<?php if ($colorSwatches): ?>
<div class="esun-rule-deal__swatches"
data-role="esun-product-swatches"
aria-label="<?= $escaper->escapeHtmlAttr(__('Available Colors')) ?>">
<?php foreach ($visibleSwatches as $swatch): ?>
<span class="esun-rule-deal__swatch"
data-product-sku="<?= $escaper->escapeHtmlAttr($swatch['sku']) ?>"
data-child-image="<?= $escaper->escapeUrl($swatch['product_image']) ?>"
title="<?= $escaper->escapeHtmlAttr($swatch['label']) ?>"
aria-label="<?= $escaper->escapeHtmlAttr($swatch['label']) ?>">
<?php if ($swatch['image']): ?>
<img src="<?= $escaper->escapeUrl($swatch['image']) ?>"
alt="<?= $escaper->escapeHtmlAttr($swatch['label']) ?>">
<?php elseif ($swatch['value']): ?>
<span style="background-color: <?= $escaper->escapeHtmlAttr($swatch['value']) ?>"></span>
<?php else: ?>
<span></span>
<?php endif; ?>
</span>
<?php endforeach; ?>
<?php if ($remainingSwatches > 0): ?>
<span class="esun-rule-deal__swatch-more">
+<?= (int) $remainingSwatches ?>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="esun-rule-deal__actions">
<a class="action tocart primary"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>"
title="<?= $escaper->escapeHtmlAttr(__('View Product')) ?>">
<svg class="icon"
viewBox="0 0 1024 1024"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
aria-hidden="true">
<path d="M97.718857 109.714286a109.714286 109.714286 0 0 1 107.349333 87.064381L220.16 268.190476h0.24381l49.005714 234.666667L306.541714 682.666667h459.678476l70.460953-341.333334H285.500952l-15.286857-73.142857h566.491429a73.142857 73.142857 0 0 1 71.631238 87.942095l-70.460952 341.333334A73.142857 73.142857 0 0 1 766.22019 755.809524H306.541714a73.142857 73.142857 0 0 1-71.631238-58.343619l-69.241905-335.335619-0.463238 0.097524-31.695238-150.357334A36.571429 36.571429 0 0 0 97.718857 182.857143H35.157333v-73.142857zM304.761905 926.47619a60.952381 60.952381 0 1 0 0-121.904761 60.952381 60.952381 0 0 0 0 121.904761z m438.857143 0a60.952381 60.952381 0 1 0 0-121.904761 60.952381 60.952381 0 0 0 0 121.904761z"></path>
</svg>
<span class="esun-rule-deal__visually-hidden">
<?= $escaper->escapeHtml(__('View Product')) ?>
</span>
</a>
</div>
</div>
</div>
</li>
<?php endforeach; ?>
</ol>
</section>
<?php if ($countdownEnd): ?>
<script type="text/x-magento-init">
{
"[data-role=esun-rule-countdown]": {
"Esun_Homepage/js/countdown": {}
}
}
</script>
<?php endif; ?>
<script type="text/x-magento-init">
{
".esun-rule-deal": {
"Esun_Homepage/js/product-swatch-image": {}
}
}
</script>
@@ -0,0 +1,100 @@
<?php
/**
* @var \Esun\Homepage\Block\CreateAnything $block
* @var \Magento\Framework\Escaper $escaper
*/
$items = $block->getItems();
if (!$items) {
return;
}
$hasNavigation = count($items) > 4;
?>
<section class="esun-create-anything" aria-labelledby="esun-create-anything-title">
<h2 class="esun-create-anything__heading typo-section-title" id="esun-create-anything-title">
<?= $escaper->escapeHtml(__('Create Anything You Imagine')) ?>
</h2>
<div class="esun-create-anything__slider swiper-container"
data-role="esun-create-anything-slider"
data-has-navigation="<?= $hasNavigation ? 'true' : 'false' ?>">
<div class="swiper-wrapper">
<?php foreach ($items as $item): ?>
<?php /** @var \Magento\Catalog\Model\Product $product */ ?>
<?php $product = $item['product']; ?>
<article class="esun-create-anything__slide swiper-slide">
<div class="esun-create-anything__media"
data-role="esun-create-anything-video"
data-video-url="<?= $escaper->escapeUrl($item['video_url']) ?>">
<?php if ($item['cover_url']): ?>
<img class="esun-create-anything__cover"
src="<?= $escaper->escapeUrl($item['cover_url']) ?>"
alt="<?= $escaper->escapeHtmlAttr($item['title']) ?>">
<?php endif; ?>
<video class="esun-create-anything__video"
muted
playsinline
preload="auto"
src="<?= $escaper->escapeUrl($item['video_url']) ?>"></video>
<div class="esun-create-anything__copy">
<h3><?= $escaper->escapeHtml($item['title']) ?></h3>
<?php if ($item['subtitle']): ?>
<p><?= $escaper->escapeHtml($item['subtitle']) ?></p>
<?php endif; ?>
</div>
<a class="esun-create-anything__product"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>">
<span class="esun-create-anything__product-image">
<?= /* @noEscape */ $block->getImage($product, 'category_page_grid')->toHtml() ?>
</span>
<span class="esun-create-anything__product-copy">
<strong><?= $escaper->escapeHtml($product->getName()) ?></strong>
<span class="esun-create-anything__price">
<span class="esun-create-anything__final-price">
<?= $escaper->escapeHtml($block->getFormattedFinalPrice($product)) ?>
</span>
<?php if ($block->hasRegularPrice($product)): ?>
<span class="esun-create-anything__regular-price">
<?= $escaper->escapeHtml($block->getFormattedRegularPrice($product)) ?>
</span>
<?php endif; ?>
</span>
</span>
</a>
</div>
</article>
<?php endforeach; ?>
</div>
<?php if ($hasNavigation): ?>
<div class="esun-create-anything__controls">
<button class="esun-create-anything__previous"
type="button"
aria-label="<?= $escaper->escapeHtmlAttr(__('Previous')) ?>">
<span aria-hidden="true">&lsaquo;</span>
</button>
<div class="esun-create-anything__pagination swiper-pagination"></div>
<button class="esun-create-anything__next"
type="button"
aria-label="<?= $escaper->escapeHtmlAttr(__('Next')) ?>">
<span aria-hidden="true">&rsaquo;</span>
</button>
</div>
<?php endif; ?>
</div>
</section>
<script type="text/x-magento-init">
{
"[data-role=esun-create-anything-slider]": {
"Esun_Homepage/js/create-anything": {}
},
"[data-role=esun-create-anything-video]": {
"Esun_Homepage/js/video-hover": {}
}
}
</script>
@@ -0,0 +1,157 @@
<?php
/**
* @var \Esun\Homepage\Block\HotSaleFilament $block
* @var \Magento\Framework\Escaper $escaper
*/
$products = $block->getProducts();
if (!$products) {
return;
}
$pages = [array_slice($products, 0, 7)];
$remainingProducts = array_slice($products, 7);
foreach (array_chunk($remainingProducts, 8) as $pageProducts) {
$pages[] = $pageProducts;
}
$hasPagination = count($pages) > 1;
$exploreAllUrl = $block->getExploreAllUrl();
?>
<?php if (count($products) > 0) : ?>
<section class="esun-hot-sale" aria-labelledby="esun-hot-sale-title">
<div class="esun-hot-sale__heading">
<h2 class="typo-section-title" id="esun-hot-sale-title"><?= $escaper->escapeHtml(__('Hot Sale Filaments')) ?></h2>
<div class="esun-hot-sale__heading-row">
<?php if ($block->getSubtitle()): ?>
<p class="typo-product-title"><?= $escaper->escapeHtml($block->getSubtitle()) ?></p>
<?php endif; ?>
<a class="esun-hot-sale__explore"
href="<?= $exploreAllUrl ? $escaper->escapeUrl($exploreAllUrl) : '#' ?>"
<?= $exploreAllUrl ? '' : 'role="link" aria-disabled="true" onclick="return false;"' ?>>
<?= $escaper->escapeHtml(__('Explore All')) ?>
<span aria-hidden="true">&gt;</span>
</a>
</div>
</div>
<div class="esun-hot-sale__slider swiper-container"
data-role="esun-hot-sale-slider"
data-has-pagination="<?= $hasPagination ? 'true' : 'false' ?>">
<div class="swiper-wrapper">
<?php foreach ($pages as $pageIndex => $pageProducts): ?>
<div class="esun-hot-sale__page swiper-slide">
<ol class="esun-hot-sale__grid">
<?php foreach ($pageProducts as $productIndex => $product): ?>
<?php
$isFeatured = $pageIndex === 0 && $productIndex === 0;
$colorSwatches = $block->getColorSwatches($product);
$visibleSwatches = array_slice($colorSwatches, 0, 11);
$remainingSwatches = max(0, count($colorSwatches) - count($visibleSwatches));
$shortDescription = $isFeatured ? $block->getShortDescription($product) : '';
?>
<li class="esun-hot-sale__item<?= $isFeatured ? ' esun-hot-sale__item--featured' : '' ?>">
<article class="esun-hot-sale__card" data-role="esun-product-card">
<a class="esun-hot-sale__image"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>"
data-role="esun-product-image"
aria-label="<?= $escaper->escapeHtmlAttr($product->getName()) ?>">
<?= /* @noEscape */ $block->getImage(
$product,
$isFeatured ? 'product_page_image_large' : 'category_page_grid'
)->toHtml() ?>
</a>
<div class="esun-hot-sale__details">
<h3>
<a href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>">
<?= $escaper->escapeHtml($product->getName()) ?>
</a>
</h3>
<?php if ($shortDescription): ?>
<p class="esun-hot-sale__description">
<?= $escaper->escapeHtml($shortDescription) ?>
</p>
<?php endif; ?>
<?php if ($colorSwatches): ?>
<div class="esun-hot-sale__swatches"
data-role="esun-product-swatches"
aria-label="<?= $escaper->escapeHtmlAttr(__('Available Colors')) ?>">
<?php foreach ($visibleSwatches as $swatch): ?>
<span class="esun-hot-sale__swatch"
data-child-image="<?= $escaper->escapeUrl($isFeatured ? $swatch['product_image_large'] : $swatch['product_image']) ?>"
title="<?= $escaper->escapeHtmlAttr($swatch['label']) ?>"
aria-label="<?= $escaper->escapeHtmlAttr($swatch['label']) ?>">
<?php if ($swatch['image']): ?>
<img src="<?= $escaper->escapeUrl($swatch['image']) ?>"
alt="<?= $escaper->escapeHtmlAttr($swatch['label']) ?>">
<?php elseif ($swatch['value']): ?>
<span style="background-color: <?= $escaper->escapeHtmlAttr($swatch['value']) ?>"></span>
<?php else: ?>
<span></span>
<?php endif; ?>
</span>
<?php endforeach; ?>
<?php if ($remainingSwatches > 0): ?>
<span class="esun-hot-sale__swatch-more">
+<?= (int) $remainingSwatches ?>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="esun-hot-sale__footer">
<div class="esun-hot-sale__price">
<span class="esun-hot-sale__final-price">
<?= $escaper->escapeHtml($block->getFormattedFinalPrice($product)) ?>
</span>
<?php if ($block->hasRegularPrice($product)): ?>
<span class="esun-hot-sale__regular-price">
<?= $escaper->escapeHtml($block->getFormattedRegularPrice($product)) ?>
</span>
<?php endif; ?>
</div>
<a class="esun-hot-sale__cart"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>"
title="<?= $escaper->escapeHtmlAttr(__('View Product')) ?>">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M3 4h2l2.2 10.2a2 2 0 0 0 2 1.6h7.7a2 2 0 0 0 2-1.6L20 8H7M10 20a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm8 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z" />
</svg>
<span class="esun-hot-sale__visually-hidden">
<?= $escaper->escapeHtml(__('View Product')) ?>
</span>
</a>
</div>
</div>
</article>
</li>
<?php endforeach; ?>
</ol>
</div>
<?php endforeach; ?>
</div>
<?php if ($hasPagination): ?>
<div class="esun-hot-sale__pagination swiper-pagination"></div>
<?php endif; ?>
</div>
</section>
<?php if ($hasPagination): ?>
<script type="text/x-magento-init">
{
"[data-role=esun-hot-sale-slider]": {
"Esun_Homepage/js/hot-sale-filament": {}
}
}
</script>
<?php endif; ?>
<script type="text/x-magento-init">
{
".esun-hot-sale": {
"Esun_Homepage/js/product-swatch-image": {}
}
}
</script>
<?php endif; ?>
@@ -0,0 +1,53 @@
<?php
/**
* @var \Esun\Homepage\Block\InnovativeMaterials $block
* @var \Magento\Framework\Escaper $escaper
*/
$items = $block->getItems();
if (!$items) {
return;
}
?>
<section class="esun-innovative-materials" aria-labelledby="esun-innovative-materials-title">
<div class="esun-innovative-materials__inner">
<h2 id="esun-innovative-materials-title">
<?= $escaper->escapeHtml(__('Innovative Materials,')) ?><br>
<?= $escaper->escapeHtml(__('Creative Life')) ?>
</h2>
<div class="esun-innovative-materials__items"
data-role="esun-innovative-materials-items">
<?php foreach ($items as $item): ?>
<?php
$thumbnailUrl = trim((string) $item['thumbnail_url']);
$imageUrl = trim((string) $item['image_url']);
$hasHoverImage = $imageUrl !== '';
?>
<?php if ($thumbnailUrl): ?>
<article class="esun-innovative-materials__item<?= $hasHoverImage
? ' esun-innovative-materials__item--interactive'
: '' ?>"
<?= $hasHoverImage ? 'tabindex="0"' : '' ?>>
<img class="esun-innovative-materials__thumbnail"
src="<?= $escaper->escapeUrl($thumbnailUrl) ?>"
alt="<?= $escaper->escapeHtmlAttr($item['title']) ?>">
<?php if ($hasHoverImage): ?>
<img class="esun-innovative-materials__hover-image"
src="<?= $escaper->escapeUrl($imageUrl) ?>"
alt="<?= $escaper->escapeHtmlAttr($item['title']) ?>">
<?php endif; ?>
</article>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
</section>
<script type="text/x-magento-init">
{
"[data-role=esun-innovative-materials-items]": {
"Esun_Homepage/js/innovative-materials": {}
}
}
</script>
@@ -0,0 +1,69 @@
<?php
/**
* @var \Esun\Homepage\Block\LandscapeVideo $block
* @var \Magento\Framework\Escaper $escaper
*/
$item = $block->getItem();
if (!$item) {
return;
}
/** @var \Magento\Catalog\Model\Product $product */
$product = $item['product'];
?>
<section class="esun-landscape-video">
<div class="esun-landscape-video__media"
data-role="esun-landscape-video"
data-video-url="<?= $escaper->escapeUrl($item['video_url']) ?>">
<img class="esun-landscape-video__cover"
src="<?= $escaper->escapeUrl($item['cover_url']) ?>"
alt="">
<video class="esun-landscape-video__video"
muted
playsinline
preload="auto"
src="<?= $escaper->escapeUrl($item['video_url']) ?>"></video>
<div class="esun-landscape-video__product">
<a class="esun-landscape-video__product-image"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>">
<?= /* @noEscape */ $block->getImage($product, 'category_page_grid')->toHtml() ?>
</a>
<div class="esun-landscape-video__product-copy">
<a class="esun-landscape-video__product-name"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>">
<?= $escaper->escapeHtml($product->getName()) ?>
</a>
<div class="esun-landscape-video__price">
<span class="esun-landscape-video__final-price">
<?= $escaper->escapeHtml($block->getFormattedFinalPrice($product)) ?>
</span>
<?php if ($block->hasRegularPrice($product)): ?>
<span class="esun-landscape-video__regular-price">
<?= $escaper->escapeHtml($block->getFormattedRegularPrice($product)) ?>
</span>
<?php endif; ?>
</div>
</div>
<a class="esun-landscape-video__cart"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>"
title="<?= $escaper->escapeHtmlAttr(__('View Product')) ?>">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M3 4h2l2.2 10.2a2 2 0 0 0 2 1.6h7.7a2 2 0 0 0 2-1.6L20 8H7M10 20a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm8 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"/>
</svg>
<span class="esun-landscape-video__visually-hidden">
<?= $escaper->escapeHtml(__('View Product')) ?>
</span>
</a>
</div>
</div>
</section>
<script type="text/x-magento-init">
{
"[data-role=esun-landscape-video]": {
"Esun_Homepage/js/video-hover": {}
}
}
</script>
@@ -0,0 +1,123 @@
<?php
/**
* @var \Esun\Homepage\Block\NewProduct $block
* @var \Magento\Framework\Escaper $escaper
*/
$products = $block->getProducts();
if (!$products) {
return;
}
?>
<section class="esun-new-product" aria-labelledby="esun-new-product-title">
<h2 class="esun-new-product__title typo-section-title" id="esun-new-product-title">
<?= $escaper->escapeHtml(__('New Product')) ?>
</h2>
<div class="esun-new-product__slider swiper-container" data-role="esun-new-product-slider">
<div class="swiper-wrapper">
<?php foreach ($products as $product): ?>
<?php
$canBuyFromList = $product->getTypeInstance()->isPossibleBuyFromList($product);
$featureContent = $block->getFeatureContent($product);
$galleryContent = $block->getGalleryContent($product);
?>
<article class="esun-new-product__slide swiper-slide">
<div class="esun-new-product__product-card">
<div class="esun-new-product__copy">
<div>
<span class="esun-new-product__series">
<?= $escaper->escapeHtml(__('Flagship Series')) ?>
</span>
<h3>
<a href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>">
<?= $escaper->escapeHtml($product->getName()) ?>
</a>
</h3>
</div>
<div class="esun-new-product__actions">
<a class="esun-new-product__buy"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>">
<?= $escaper->escapeHtml(__('Buy Now')) ?>
</a>
<?php if ($product->isSaleable()): ?>
<?php if ($canBuyFromList): ?>
<form data-role="tocart-form"
data-product-sku="<?= $escaper->escapeHtmlAttr($product->getSku()) ?>"
action="<?= $escaper->escapeUrl($block->getAddToCartUrl($product)) ?>"
method="post">
<input type="hidden" name="product" value="<?= (int) $product->getId() ?>">
<?= $block->getBlockHtml('formkey') ?>
<button class="esun-new-product__cart"
type="submit"
title="<?= $escaper->escapeHtmlAttr(__('Add to Cart')) ?>">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M3 4h2l2.2 10.2a2 2 0 0 0 2 1.6h7.7a2 2 0 0 0 2-1.6L20 8H7M10 20a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm8 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z" />
</svg>
<span class="esun-new-product__visually-hidden">
<?= $escaper->escapeHtml(__('Add to Cart')) ?>
</span>
</button>
</form>
<?php else: ?>
<a class="esun-new-product__cart"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>"
title="<?= $escaper->escapeHtmlAttr(__('Choose Options')) ?>">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M3 4h2l2.2 10.2a2 2 0 0 0 2 1.6h7.7a2 2 0 0 0 2-1.6L20 8H7M10 20a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm8 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z" />
</svg>
<span class="esun-new-product__visually-hidden">
<?= $escaper->escapeHtml(__('Choose Options')) ?>
</span>
</a>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<a class="esun-new-product__image"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>"
tabindex="-1"
aria-hidden="true">
<?= /* @noEscape */ $block->getImage($product, 'product_page_image_large')->toHtml() ?>
</a>
</div>
<div class="esun-new-product__content">
<div class="esun-new-product__features">
<?= /* @noEscape */ $featureContent ?>
</div>
<div class="esun-new-product__gallery">
<?= /* @noEscape */ $galleryContent ?>
</div>
</div>
</article>
<?php endforeach; ?>
</div>
<button class="esun-new-product__previous"
type="button"
aria-label="<?= $escaper->escapeHtmlAttr(__('Previous')) ?>">
<span class="arrow-left" aria-hidden="true"></span>
</button>
<div class="esun-new-product__pagination swiper-pagination"></div>
<button class="esun-new-product__next"
type="button"
aria-label="<?= $escaper->escapeHtmlAttr(__('Next')) ?>">
<span class="arrow-right" aria-hidden="true"></span>
</button>
</div>
</section>
<script type="text/x-magento-init">
{
"[data-role=esun-new-product-slider]": {
"Esun_Homepage/js/new-product": {}
},
".esun-new-product [data-role=tocart-form]": {
"catalogAddToCart": {}
}
}
</script>
@@ -0,0 +1,88 @@
<?php
/**
* @var \Esun\Homepage\Block\NewsRoom $block
* @var \Magento\Framework\Escaper $escaper
*/
$items = $block->getItems();
if (!$items) {
return;
}
$pages = array_chunk($items, 4);
$hasNavigation = count($pages) > 1;
?>
<section class="esun-news-room" aria-labelledby="esun-news-room-title">
<div class="esun-news-room__heading">
<h2 class="typo-section-title" id="esun-news-room-title">
<?= $escaper->escapeHtml(__('News Room')) ?>
</h2>
<?php if ($hasNavigation): ?>
<div class="esun-news-room__navigation">
<button class="esun-news-room__previous"
type="button"
aria-label="<?= $escaper->escapeHtmlAttr(__('Previous')) ?>">
<span class="arrow-left" aria-hidden="true"></span>
</button>
<button class="esun-news-room__next"
type="button"
aria-label="<?= $escaper->escapeHtmlAttr(__('Next')) ?>">
<span class="arrow-right" aria-hidden="true"></span>
</button>
</div>
<?php endif; ?>
</div>
<div class="esun-news-room__slider swiper-container"
data-role="esun-news-room-slider"
data-has-navigation="<?= $hasNavigation ? 'true' : 'false' ?>">
<div class="swiper-wrapper">
<?php foreach ($pages as $pageItems): ?>
<div class="esun-news-room__page swiper-slide">
<div class="esun-news-room__grid">
<?php foreach ($pageItems as $item): ?>
<article class="esun-news-room__slide">
<a class="esun-news-room__card" href="<?= $escaper->escapeUrl($item['url']) ?>">
<span class="esun-news-room__image-wrap">
<img class="esun-news-room__image"
src="<?= $escaper->escapeUrl($item['image_url']) ?>"
alt="<?= $escaper->escapeHtmlAttr($item['title']) ?>">
</span>
<span class="esun-news-room__meta">
<?php if ($item['publish_date']): ?>
<time datetime="<?= $escaper->escapeHtmlAttr($item['publish_date_iso']) ?>">
<?= $escaper->escapeHtml($item['publish_date']) ?>
</time>
<?php endif; ?>
<?php if ($item['tag_name']): ?>
<span class="esun-news-room__category">
<?= $escaper->escapeHtml($item['tag_name']) ?>
</span>
<?php endif; ?>
</span>
<span class="esun-news-room__title">
<?= $escaper->escapeHtml($item['title']) ?>
</span>
</a>
</article>
<?php endforeach; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<?php if ($hasNavigation): ?>
<div class="esun-news-room__pagination swiper-pagination"></div>
<?php endif; ?>
</div>
</section>
<script type="text/x-magento-init">
{
"[data-role=esun-news-room-slider]": {
"Esun_Homepage/js/news-room": {}
}
}
</script>
@@ -0,0 +1,125 @@
<?php
/**
* @var \Esun\Homepage\Block\Resin $block
* @var \Magento\Framework\Escaper $escaper
*/
$products = $block->getProducts();
if (!$products) {
return;
}
$backgroundImageUrl = $block->getBackgroundImageUrl();
$exploreAllUrl = $block->getExploreAllUrl();
?>
<section class="esun-resin" aria-labelledby="esun-resin-title">
<div class="esun-resin__heading">
<h2 class="typo-section-title" id="esun-resin-title"><?= $escaper->escapeHtml(__('3D Resin')) ?></h2>
<a class="esun-resin__explore"
href="<?= $exploreAllUrl ? $escaper->escapeUrl($exploreAllUrl) : '#' ?>"
<?= $exploreAllUrl ? '' : 'role="link" aria-disabled="true" onclick="return false;"' ?>>
<?= $escaper->escapeHtml(__('Explore All')) ?>
<span aria-hidden="true">&gt;</span>
</a>
</div>
<div class="esun-resin__banner"
<?php if ($backgroundImageUrl): ?>
style="background-image: url('<?= $escaper->escapeUrl($backgroundImageUrl) ?>');"
<?php endif; ?>>
<ol class="esun-resin__products">
<?php foreach ($products as $product): ?>
<?php
$colorSwatches = $block->getColorSwatches($product);
$visibleSwatches = array_slice($colorSwatches, 0, 3);
$remainingSwatches = max(0, count($colorSwatches) - count($visibleSwatches));
$shortDescription = $block->getShortDescription($product);
?>
<li class="esun-resin__item">
<article class="esun-resin__card" data-role="esun-product-card">
<a class="esun-resin__image"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>"
data-role="esun-product-image"
aria-label="<?= $escaper->escapeHtmlAttr($product->getName()) ?>">
<?= /* @noEscape */ $block->getImage($product, 'category_page_grid')->toHtml() ?>
</a>
<div class="esun-resin__details">
<h3>
<a href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>">
<?= $escaper->escapeHtml($product->getName()) ?>
</a>
</h3>
<?php if ($shortDescription): ?>
<p class="esun-resin__description">
<?= $escaper->escapeHtml($shortDescription) ?>
</p>
<?php endif; ?>
<div class="esun-resin__price">
<span class="esun-resin__final-price">
<?= $escaper->escapeHtml($block->getFormattedFinalPrice($product)) ?>
</span>
<?php if ($block->hasRegularPrice($product)): ?>
<span class="esun-resin__regular-price">
<?= $escaper->escapeHtml($block->getFormattedRegularPrice($product)) ?>
</span>
<?php endif; ?>
</div>
<div class="esun-resin__footer">
<?php if ($colorSwatches): ?>
<div class="esun-resin__swatches"
data-role="esun-product-swatches"
aria-label="<?= $escaper->escapeHtmlAttr(__('Available Colors')) ?>">
<?php foreach ($visibleSwatches as $swatch): ?>
<span class="esun-resin__swatch"
data-child-image="<?= $escaper->escapeUrl($swatch['product_image']) ?>"
title="<?= $escaper->escapeHtmlAttr($swatch['label']) ?>"
aria-label="<?= $escaper->escapeHtmlAttr($swatch['label']) ?>">
<?php if ($swatch['image']): ?>
<img src="<?= $escaper->escapeUrl($swatch['image']) ?>"
alt="<?= $escaper->escapeHtmlAttr($swatch['label']) ?>">
<?php elseif ($swatch['value']): ?>
<span style="background-color: <?= $escaper->escapeHtmlAttr($swatch['value']) ?>"></span>
<?php else: ?>
<span></span>
<?php endif; ?>
</span>
<?php endforeach; ?>
<?php if ($remainingSwatches > 0): ?>
<span class="esun-resin__swatch-more">
+<?= (int) $remainingSwatches ?>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
<a class="esun-resin__cart"
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>"
title="<?= $escaper->escapeHtmlAttr(__('View Product')) ?>">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M3 4h2l2.2 10.2a2 2 0 0 0 2 1.6h7.7a2 2 0 0 0 2-1.6L20 8H7M10 20a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm8 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z" />
</svg>
<span class="esun-resin__visually-hidden">
<?= $escaper->escapeHtml(__('View Product')) ?>
</span>
</a>
</div>
</div>
</article>
</li>
<?php endforeach; ?>
</ol>
</div>
</section>
<script type="text/x-magento-init">
{
".esun-resin": {
"Esun_Homepage/js/product-swatch-image": {}
}
}
</script>
@@ -0,0 +1,43 @@
<?php
/**
* @var \Esun\Homepage\Block\ResourcesDownloads $block
* @var \Magento\Framework\Escaper $escaper
*/
$items = $block->getItems();
if (!$items) {
return;
}
?>
<section class="esun-resources-downloads" aria-labelledby="esun-resources-downloads-title">
<h2 class="typo-section-title" id="esun-resources-downloads-title">
<?= $escaper->escapeHtml(__('Resources & Downloads')) ?>
</h2>
<div class="esun-resources-downloads__items">
<?php foreach ($items as $item): ?>
<?php $linkUrl = trim((string) $item['link_url']); ?>
<article class="esun-resources-downloads__item">
<?php if ($linkUrl): ?>
<a class="esun-resources-downloads__link"
href="<?= $escaper->escapeUrl($linkUrl) ?>"
aria-label="<?= $escaper->escapeHtmlAttr(__('Open %1', $item['title'])) ?>">
<span aria-hidden="true">↗</span>
</a>
<?php else: ?>
<span class="esun-resources-downloads__link esun-resources-downloads__link--disabled"
aria-hidden="true">↗</span>
<?php endif; ?>
<img class="esun-resources-downloads__image"
src="<?= $escaper->escapeUrl($item['thumbnail_url']) ?>"
alt="<?= $escaper->escapeHtmlAttr($item['title']) ?>">
<?php if ($item['title']): ?>
<h3><?= $escaper->escapeHtml($item['title']) ?></h3>
<?php endif; ?>
</article>
<?php endforeach; ?>
</div>
</section>