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,174 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block;
use Esun\Catalog\Model\Product\CardPriceResolver;
use Magento\Catalog\Block\Product\AbstractProduct;
use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Visibility;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use Magento\Customer\Model\Context as CustomerContext;
use Magento\Framework\App\Http\Context as HttpContext;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\UrlInterface;
use Magento\Store\Model\ScopeInterface;
class Accessories extends AbstractProduct implements IdentityInterface
{
private const XML_PATH = 'esun_homepage/accessories/';
private const BACKGROUND_MEDIA_PATH = 'esun/homepage/accessories/';
/**
* @var Product[]|null
*/
private ?array $products = null;
public function __construct(
Context $context,
private readonly CollectionFactory $productCollectionFactory,
private readonly Visibility $productVisibility,
private readonly PriceCurrencyInterface $priceCurrency,
private readonly HttpContext $httpContext,
private readonly CardPriceResolver $cardPriceResolver,
array $data = []
) {
parent::__construct($context, $data);
}
/**
* @return Product[]
*/
public function getProducts(): array
{
if ($this->products !== null) {
return $this->products;
}
$skus = $this->getConfiguredSkus();
if (!$skus) {
return $this->products = [];
}
$collection = $this->productCollectionFactory->create();
$collection->setStoreId((int) $this->_storeManager->getStore()->getId());
$this->_addProductAttributesAndPrices($collection);
$collection->addStoreFilter();
$collection->addAttributeToFilter('sku', ['in' => $skus]);
$collection->addAttributeToFilter(
'visibility',
['in' => $this->productVisibility->getVisibleInSiteIds()]
);
$collection->addAttributeToFilter(
'status',
Product\Attribute\Source\Status::STATUS_ENABLED
);
$productsBySku = [];
foreach ($collection as $product) {
$productsBySku[strtolower((string) $product->getSku())] = $product;
}
$this->products = [];
foreach ($skus as $sku) {
$key = strtolower($sku);
if (isset($productsBySku[$key])) {
$this->products[] = $productsBySku[$key];
}
}
return $this->products;
}
public function getBackgroundImageUrl(): string
{
$image = ltrim(trim((string) $this->getConfig('background_image')), '/');
if ($image === '') {
return '';
}
return $this->_storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_MEDIA)
. self::BACKGROUND_MEDIA_PATH
. $image;
}
public function getExploreAllUrl(): string
{
return trim((string) $this->getConfig('explore_all_url'));
}
public function getFormattedFinalPrice(Product $product): string
{
return $this->formatPrice($this->getFinalPriceValue($product));
}
public function getFormattedRegularPrice(Product $product): string
{
return $this->formatPrice($this->getRegularPriceValue($product));
}
public function hasRegularPrice(Product $product): bool
{
return $this->getRegularPriceValue($product) > $this->getFinalPriceValue($product);
}
public function getCacheKeyInfo(): array
{
return [
'ESUN_HOMEPAGE_ACCESSORIES',
(int) $this->_storeManager->getStore()->getId(),
(int) $this->httpContext->getValue(CustomerContext::CONTEXT_GROUP),
sha1(implode('|', $this->getConfiguredSkus())),
sha1($this->getBackgroundImageUrl()),
sha1($this->getExploreAllUrl()),
];
}
public function getIdentities(): array
{
$identities = [];
foreach ($this->getProducts() as $product) {
$identities = array_merge($identities, $product->getIdentities());
}
return array_values(array_unique($identities));
}
private function getConfiguredSkus(): array
{
$value = (string) $this->getConfig('skus');
$skus = preg_split('/[\s,;]+/', $value, -1, PREG_SPLIT_NO_EMPTY) ?: [];
return array_values(array_unique(array_map('trim', $skus)));
}
private function getConfig(string $field): mixed
{
return $this->_scopeConfig->getValue(
self::XML_PATH . $field,
ScopeInterface::SCOPE_STORE
);
}
private function getFinalPriceValue(Product $product): float
{
return $this->cardPriceResolver->getFinalPrice($product);
}
private function getRegularPriceValue(Product $product): float
{
return $this->cardPriceResolver->getRegularPrice($product);
}
private function formatPrice(float $price): string
{
return $this->priceCurrency->format(
$price,
false,
PriceCurrencyInterface::DEFAULT_PRECISION,
$this->_storeManager->getStore()
);
}
}
@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block\Adminhtml\System\Config\Form\Field;
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;
class CreateAnythingItems extends AbstractFieldArray
{
protected function _prepareToRender(): void
{
$this->addColumn('title', [
'label' => __('Title'),
'style' => 'width:160px',
]);
$this->addColumn('subtitle', [
'label' => __('Subtitle'),
'style' => 'width:180px',
]);
$this->addColumn('video_id', [
'label' => __('Video ID'),
'class' => 'validate-digits',
'style' => 'width:90px',
]);
$this->addColumn('product_sku', [
'label' => __('Product SKU'),
'style' => 'width:150px',
]);
$this->addColumn('sort_number', [
'label' => __('Sort Number'),
'class' => 'validate-number',
'style' => 'width:90px',
]);
$this->_addAfter = false;
$this->_addButtonLabel = __('Add Item');
}
public function getArrayRows(): array
{
$element = $this->getElement();
if (!$element->getValue()) {
$element->setValue([
'_initial' => [
'title' => '',
'subtitle' => '',
'video_id' => '',
'product_sku' => '',
'sort_number' => '',
],
]);
}
return parent::getArrayRows();
}
}
@@ -0,0 +1,90 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block;
use Esun\ImageManager\Model\Category;
use Esun\ImageManager\Model\Image;
use Esun\ImageManager\Model\ImageProvider;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Magento\Store\Model\ScopeInterface;
class Application extends Template implements IdentityInterface
{
private const XML_PATH = 'esun_homepage/application/';
/**
* @var array<int, array<string, int|string>>|null
*/
private ?array $items = null;
public function __construct(
Context $context,
private readonly ImageProvider $imageProvider,
array $data = []
) {
parent::__construct($context, $data);
}
public function getSubtitle(): string
{
return trim((string) $this->getConfig('subtitle'));
}
public function getExploreAllUrl(): string
{
return trim((string) $this->getConfig('explore_all_url'));
}
/**
* @return array<int, array<string, int|string>>
*/
public function getItems(): array
{
if ($this->items === null) {
$this->items = $this->imageProvider->getImagesByCategoryId($this->getCategoryId());
}
return $this->items;
}
public function getCacheKeyInfo(): array
{
return [
'ESUN_HOMEPAGE_APPLICATION',
(int) $this->_storeManager->getStore()->getId(),
$this->getCategoryId(),
sha1($this->getSubtitle()),
sha1($this->getExploreAllUrl()),
];
}
public function getIdentities(): array
{
$identities = [];
$categoryId = $this->getCategoryId();
if ($categoryId > 0) {
$identities[] = Category::CACHE_TAG . '_' . $categoryId;
}
foreach ($this->getItems() as $item) {
$identities[] = Image::CACHE_TAG . '_' . (int) $item['id'];
}
return array_values(array_unique($identities));
}
private function getCategoryId(): int
{
return (int) $this->getConfig('category_id');
}
private function getConfig(string $field): mixed
{
return $this->_scopeConfig->getValue(
self::XML_PATH . $field,
ScopeInterface::SCOPE_STORE
);
}
}
@@ -0,0 +1,78 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block;
use Esun\ImageManager\Model\Category;
use Esun\ImageManager\Model\Image;
use Esun\ImageManager\Model\ImageProvider;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Magento\Store\Model\ScopeInterface;
class AwardsReviews extends Template implements IdentityInterface
{
private const XML_PATH_CATEGORY_ID = 'esun_homepage/awards_reviews/category_id';
/**
* @var array<int, array<string, int|string>>|null
*/
private ?array $items = null;
public function __construct(
Context $context,
private readonly ImageProvider $imageProvider,
array $data = []
) {
parent::__construct($context, $data);
}
/**
* @return array<int, array<string, int|string>>
*/
public function getItems(): array
{
if ($this->items === null) {
$this->items = array_values(array_filter(
$this->imageProvider->getImagesByCategoryId($this->getCategoryId()),
static fn (array $item): bool => trim((string) $item['thumbnail_url']) !== ''
));
}
return $this->items;
}
public function getCacheKeyInfo(): array
{
return [
'ESUN_HOMEPAGE_AWARDS_REVIEWS',
(int) $this->_storeManager->getStore()->getId(),
$this->getCategoryId(),
];
}
public function getIdentities(): array
{
$identities = [];
$categoryId = $this->getCategoryId();
if ($categoryId > 0) {
$identities[] = Category::CACHE_TAG . '_' . $categoryId;
}
foreach ($this->getItems() as $item) {
$identities[] = Image::CACHE_TAG . '_' . (int) $item['id'];
}
return array_values(array_unique($identities));
}
private function getCategoryId(): int
{
return (int) $this->_scopeConfig->getValue(
self::XML_PATH_CATEGORY_ID,
ScopeInterface::SCOPE_STORE
);
}
}
@@ -0,0 +1,392 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block;
use Esun\Catalog\Model\Product\CardPriceResolver;
use Magento\Catalog\Block\Product\AbstractProduct;
use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Visibility;
use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use Magento\Catalog\Pricing\Price\FinalPrice;
use Magento\CatalogRule\Model\Rule;
use Magento\CatalogRule\Model\RuleFactory;
use Magento\Customer\Model\Context as CustomerContext;
use Magento\Framework\App\Http\Context as HttpContext;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\Pricing\Render;
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
use Magento\Store\Model\ScopeInterface;
use Magento\Swatches\Helper\Data as SwatchHelper;
use Magento\Swatches\Helper\Media as SwatchMediaHelper;
use Magento\Swatches\Model\Swatch;
class CatalogRuleDeal extends AbstractProduct implements IdentityInterface
{
private const XML_PATH = 'esun_homepage/catalog_rule_deal/';
private const MAX_PRODUCTS = 12;
private ?Rule $rule = null;
private ?Collection $products = null;
public function __construct(
Context $context,
private readonly RuleFactory $ruleFactory,
private readonly CollectionFactory $productCollectionFactory,
private readonly ResourceConnection $resourceConnection,
private readonly Visibility $productVisibility,
private readonly HttpContext $httpContext,
private readonly TimezoneInterface $timezone,
private readonly SwatchHelper $swatchHelper,
private readonly SwatchMediaHelper $swatchMediaHelper,
private readonly PriceCurrencyInterface $priceCurrency,
private readonly CardPriceResolver $cardPriceResolver,
array $data = []
) {
parent::__construct($context, $data);
}
public function isAvailable(): bool
{
return $this->isEnabled()
&& $this->getRule() !== null
&& $this->isRuleCurrent($this->getRule())
&& $this->getProducts()->getSize() > 0;
}
public function getRule(): ?Rule
{
if ($this->rule !== null) {
return $this->rule->getId() ? $this->rule : null;
}
$ruleId = (int) $this->getConfig('rule_id');
$this->rule = $this->ruleFactory->create();
if ($ruleId > 0) {
$this->rule->load($ruleId);
}
return $this->rule->getId() ? $this->rule : null;
}
public function getProducts(): Collection
{
if ($this->products !== null) {
return $this->products;
}
$collection = $this->productCollectionFactory->create();
$collection->setStoreId((int) $this->_storeManager->getStore()->getId());
$productIds = $this->getIndexedProductIds();
if (!$productIds) {
$collection->addFieldToFilter('entity_id', ['in' => [0]]);
$this->products = $collection;
return $this->products;
}
$this->_addProductAttributesAndPrices($collection);
$collection->addStoreFilter();
$collection->addFieldToFilter('entity_id', ['in' => $productIds]);
$collection->addAttributeToFilter(
'visibility',
['in' => $this->productVisibility->getVisibleInSiteIds()]
);
$collection->addAttributeToFilter('status', Product\Attribute\Source\Status::STATUS_ENABLED);
$collection->setOrder('entity_id', 'DESC');
$collection->setPageSize($this->getProductsLimit());
$collection->setCurPage(1);
$this->products = $collection;
return $this->products;
}
public function getHeading(): string
{
$heading = trim((string) $this->getConfig('title'));
$rule = $this->getRule();
return $heading !== '' ? $heading : (string) ($rule?->getName() ?: '');
}
public function getAccentHeading(): string
{
return trim((string) $this->getConfig('accent_title'));
}
public function getCountdownEnd(): string
{
$toDate = (string) ($this->getRule()?->getToDate() ?: '');
if ($toDate === '') {
return '';
}
$date = $this->timezone->date($toDate . ' 23:59:59');
return $date->format(\DateTimeInterface::ATOM);
}
public function getProductDiscount(Product $product): int
{
$regularPrice = $this->getRegularPriceValue($product);
$finalPrice = $this->getFinalPriceValue($product);
if ($regularPrice <= 0 || $finalPrice >= $regularPrice) {
return 0;
}
return (int) round((1 - ($finalPrice / $regularPrice)) * 100);
}
public function getMaximumDiscount(): int
{
$maximum = 0;
foreach ($this->getProducts() as $product) {
$maximum = max($maximum, $this->getProductDiscount($product));
}
return $maximum;
}
public function getColorSwatches(Product $product): array
{
if ($product->getTypeId() !== 'configurable') {
return [];
}
$children = [];
$optionIds = [];
$childIdsByGroup = $product->getTypeInstance()->getChildrenIds((int) $product->getId());
$childIds = array_values(array_unique(array_map(
'intval',
array_merge(...array_values($childIdsByGroup ?: [[]]))
)));
if (!$childIds) {
return [];
}
$childCollection = $this->productCollectionFactory->create();
$childCollection->setStoreId((int) $this->_storeManager->getStore()->getId());
$childCollection->addIdFilter($childIds);
$childCollection->addAttributeToSelect(['color', 'sku', 'image', 'small_image', 'thumbnail']);
$childCollection->addAttributeToFilter(
'status',
Product\Attribute\Source\Status::STATUS_ENABLED
);
$childCollection->setOrder('entity_id', 'ASC');
foreach ($childCollection as $childProduct) {
$optionId = (int) $childProduct->getData('color');
if ($optionId <= 0) {
continue;
}
$children[] = [
'option_id' => $optionId,
'sku' => (string) $childProduct->getSku(),
'product' => $childProduct,
];
$optionIds[$optionId] = $optionId;
}
if (!$children) {
return [];
}
$swatchData = $this->swatchHelper->getSwatchesByOptionsId(array_values($optionIds));
$colorAttribute = null;
foreach ($product->getTypeInstance()->getConfigurableAttributes($product) as $attribute) {
if ($attribute->getProductAttribute()->getAttributeCode() === 'color') {
$colorAttribute = $attribute->getProductAttribute();
$colorAttribute->setStoreId((int) $this->_storeManager->getStore()->getId());
break;
}
}
$result = [];
foreach ($children as $child) {
$optionId = $child['option_id'];
$swatch = $swatchData[$optionId] ?? [];
$type = (int) ($swatch['type'] ?? Swatch::SWATCH_TYPE_EMPTY);
$value = (string) ($swatch['value'] ?? '');
$result[] = [
'id' => $optionId,
'sku' => $child['sku'],
'label' => $colorAttribute
? (string) $colorAttribute->getSource()->getOptionText($optionId)
: $child['sku'],
'type' => $type,
'value' => $value,
'product_image' => $this->getProductImageUrl($child['product']),
'image' => $type === Swatch::SWATCH_TYPE_VISUAL_IMAGE && $value !== ''
? $this->swatchMediaHelper->getSwatchAttributeImage(
Swatch::SWATCH_IMAGE_NAME,
$value
)
: '',
];
}
return $result;
}
public function getProductImageUrl(Product $product, string $imageId = 'category_page_grid'): string
{
return (string) $this->getImage($product, $imageId)->getImageUrl();
}
public function getFormattedFinalPrice(Product $product): string
{
return $this->formatPrice($this->getFinalPriceValue($product));
}
public function getFormattedRegularPrice(Product $product): string
{
return $this->formatPrice($this->getRegularPriceValue($product));
}
public function hasRegularPrice(Product $product): bool
{
return $this->getRegularPriceValue($product) > $this->getFinalPriceValue($product);
}
public function getProductPrice(Product $product): string
{
return $this->getProductPriceHtml(
$product,
FinalPrice::PRICE_CODE,
Render::ZONE_ITEM_LIST,
[
'include_container' => true,
'display_minimal_price' => true,
'list_category_page' => true,
]
);
}
public function getCacheKeyInfo(): array
{
return [
'ESUN_HOMEPAGE_CATALOG_RULE_DEAL',
(int) $this->_storeManager->getStore()->getId(),
(int) $this->httpContext->getValue(CustomerContext::CONTEXT_GROUP),
(int) ($this->getRule()?->getId() ?: 0),
];
}
public function getIdentities(): array
{
$identities = [];
$rule = $this->getRule();
if ($rule) {
$identities = array_merge($identities, $rule->getIdentities());
}
foreach ($this->getProducts() as $product) {
$identities = array_merge($identities, $product->getIdentities());
}
return array_values(array_unique($identities));
}
private function isEnabled(): bool
{
return $this->_scopeConfig->isSetFlag(
self::XML_PATH . 'enabled',
ScopeInterface::SCOPE_STORE
);
}
private function getConfig(string $field): mixed
{
return $this->_scopeConfig->getValue(
self::XML_PATH . $field,
ScopeInterface::SCOPE_STORE
);
}
private function getProductsLimit(): int
{
$limit = (int) $this->getConfig('products_limit');
return max(1, min(self::MAX_PRODUCTS, $limit ?: 4));
}
private function isRuleCurrent(Rule $rule): bool
{
if (!$rule->getIsActive()) {
return false;
}
$websiteId = (int) $this->_storeManager->getStore()->getWebsiteId();
if (!in_array($websiteId, array_map('intval', (array) $rule->getWebsiteIds()), true)) {
return false;
}
$today = $this->timezone->date()->format('Y-m-d');
$fromDate = (string) $rule->getFromDate();
$toDate = (string) $rule->getToDate();
return ($fromDate === '' || $fromDate <= $today)
&& ($toDate === '' || $toDate >= $today);
}
private function getIndexedProductIds(): array
{
$rule = $this->getRule();
if (!$rule) {
return [];
}
$connection = $this->resourceConnection->getConnection();
$table = $this->resourceConnection->getTableName('catalogrule_product');
$now = time();
$select = $connection->select()
->distinct()
->from($table, ['product_id'])
->where('rule_id = ?', (int) $rule->getId())
->where('website_id = ?', (int) $this->_storeManager->getStore()->getWebsiteId())
->where(
'customer_group_id = ?',
(int) $this->httpContext->getValue(CustomerContext::CONTEXT_GROUP)
)
->where('(from_time = 0 OR from_time <= ?)', $now)
->where('(to_time = 0 OR to_time >= ?)', $now);
$productIds = array_map('intval', $connection->fetchCol($select));
if (!$productIds) {
return [];
}
$parentSelect = $connection->select()
->distinct()
->from(
$this->resourceConnection->getTableName('catalog_product_super_link'),
['parent_id']
)
->where('product_id IN (?)', $productIds);
$parentIds = array_map('intval', $connection->fetchCol($parentSelect));
return array_values(array_unique(array_merge($productIds, $parentIds)));
}
private function getFinalPriceValue(Product $product): float
{
return $this->cardPriceResolver->getFinalPrice($product);
}
private function getRegularPriceValue(Product $product): float
{
return $this->cardPriceResolver->getRegularPrice($product);
}
private function formatPrice(float $price): string
{
return $this->priceCurrency->format(
$price,
false,
PriceCurrencyInterface::DEFAULT_PRECISION,
$this->_storeManager->getStore()
);
}
}
@@ -0,0 +1,210 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block;
use Esun\Catalog\Model\Product\CardPriceResolver;
use Esun\Video\Model\ResourceModel\Video\CollectionFactory as VideoCollectionFactory;
use Magento\Catalog\Block\Product\AbstractProduct;
use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Visibility;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollectionFactory;
use Magento\Customer\Model\Context as CustomerContext;
use Magento\Framework\App\Http\Context as HttpContext;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\Serialize\SerializerInterface;
use Magento\Framework\UrlInterface;
use Magento\Store\Model\ScopeInterface;
class CreateAnything extends AbstractProduct implements IdentityInterface
{
private const XML_PATH_ITEMS = 'esun_homepage/create_anything/items';
/**
* @var array<int, array<string, mixed>>|null
*/
private ?array $items = null;
public function __construct(
Context $context,
private readonly ProductCollectionFactory $productCollectionFactory,
private readonly VideoCollectionFactory $videoCollectionFactory,
private readonly Visibility $productVisibility,
private readonly PriceCurrencyInterface $priceCurrency,
private readonly SerializerInterface $serializer,
private readonly HttpContext $httpContext,
private readonly CardPriceResolver $cardPriceResolver,
array $data = []
) {
parent::__construct($context, $data);
}
/**
* @return array<int, array<string, mixed>>
*/
public function getItems(): array
{
if ($this->items !== null) {
return $this->items;
}
$configuredItems = $this->getConfiguredItems();
if (!$configuredItems) {
return $this->items = [];
}
$videoIds = [];
$skus = [];
foreach ($configuredItems as $item) {
$videoId = (int) ($item['video_id'] ?? 0);
$sku = trim((string) ($item['product_sku'] ?? ''));
if ($videoId > 0) {
$videoIds[$videoId] = $videoId;
}
if ($sku !== '') {
$skus[strtolower($sku)] = $sku;
}
}
$videosById = [];
if ($videoIds) {
$videoCollection = $this->videoCollectionFactory->create();
$videoCollection->addFieldToFilter('video_id', ['in' => array_values($videoIds)]);
$videoCollection->addFieldToFilter('status', 1);
foreach ($videoCollection as $video) {
$videosById[(int) $video->getId()] = $video;
}
}
$productsBySku = [];
if ($skus) {
$productCollection = $this->productCollectionFactory->create();
$productCollection->setStoreId((int) $this->_storeManager->getStore()->getId());
$this->_addProductAttributesAndPrices($productCollection);
$productCollection->addStoreFilter();
$productCollection->addAttributeToFilter('sku', ['in' => array_values($skus)]);
$productCollection->addAttributeToFilter(
'visibility',
['in' => $this->productVisibility->getVisibleInSiteIds()]
);
$productCollection->addAttributeToFilter(
'status',
Product\Attribute\Source\Status::STATUS_ENABLED
);
foreach ($productCollection as $product) {
$productsBySku[strtolower((string) $product->getSku())] = $product;
}
}
$mediaBaseUrl = $this->_storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_MEDIA);
$this->items = [];
foreach ($configuredItems as $item) {
$videoId = (int) ($item['video_id'] ?? 0);
$skuKey = strtolower(trim((string) ($item['product_sku'] ?? '')));
$video = $videosById[$videoId] ?? null;
$product = $productsBySku[$skuKey] ?? null;
if (!$video || !$product) {
continue;
}
$this->items[] = [
'title' => trim((string) ($item['title'] ?? '')),
'subtitle' => trim((string) ($item['subtitle'] ?? '')),
'sort_number' => (int) ($item['sort_number'] ?? 0),
'video_url' => $mediaBaseUrl . ltrim((string) $video->getData('video_path'), '/'),
'cover_url' => $mediaBaseUrl . ltrim((string) $video->getData('cover_path'), '/'),
'product' => $product,
];
}
return $this->items;
}
public function getFormattedFinalPrice(Product $product): string
{
return $this->formatPrice($this->getFinalPriceValue($product));
}
public function getFormattedRegularPrice(Product $product): string
{
return $this->formatPrice($this->getRegularPriceValue($product));
}
public function hasRegularPrice(Product $product): bool
{
return $this->getRegularPriceValue($product) > $this->getFinalPriceValue($product);
}
public function getCacheKeyInfo(): array
{
return [
'ESUN_HOMEPAGE_CREATE_ANYTHING',
(int) $this->_storeManager->getStore()->getId(),
(int) $this->httpContext->getValue(CustomerContext::CONTEXT_GROUP),
sha1((string) $this->_scopeConfig->getValue(
self::XML_PATH_ITEMS,
ScopeInterface::SCOPE_STORE
)),
];
}
public function getIdentities(): array
{
$identities = [];
foreach ($this->getItems() as $item) {
$product = $item['product'] ?? null;
if ($product instanceof Product) {
$identities = array_merge($identities, $product->getIdentities());
}
}
return array_values(array_unique($identities));
}
/**
* @return array<int, array<string, mixed>>
*/
private function getConfiguredItems(): array
{
$value = $this->_scopeConfig->getValue(
self::XML_PATH_ITEMS,
ScopeInterface::SCOPE_STORE
);
if (is_array($value)) {
return array_values($value);
}
if (!is_string($value) || trim($value) === '') {
return [];
}
try {
$items = $this->serializer->unserialize($value);
} catch (\InvalidArgumentException) {
return [];
}
return is_array($items) ? array_values($items) : [];
}
private function getFinalPriceValue(Product $product): float
{
return $this->cardPriceResolver->getFinalPrice($product);
}
private function getRegularPriceValue(Product $product): float
{
return $this->cardPriceResolver->getRegularPrice($product);
}
private function formatPrice(float $price): string
{
return $this->priceCurrency->format(
$price,
false,
PriceCurrencyInterface::DEFAULT_PRECISION,
$this->_storeManager->getStore()
);
}
}
@@ -0,0 +1,272 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block;
use Esun\Catalog\Model\Product\CardPriceResolver;
use Magento\Catalog\Block\Product\AbstractProduct;
use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Visibility;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use Magento\Framework\App\Http\Context as HttpContext;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Store\Model\ScopeInterface;
use Magento\Swatches\Helper\Data as SwatchHelper;
use Magento\Swatches\Helper\Media as SwatchMediaHelper;
use Magento\Swatches\Model\Swatch;
class HotSaleFilament extends AbstractProduct implements IdentityInterface
{
private const XML_PATH = 'esun_homepage/hot_sale_filament/';
/**
* @var Product[]|null
*/
private ?array $products = null;
/**
* @var array<int, array<int, array<string, int|string>>>
*/
private array $colorSwatches = [];
public function __construct(
Context $context,
private readonly CollectionFactory $productCollectionFactory,
private readonly Visibility $productVisibility,
private readonly SwatchHelper $swatchHelper,
private readonly SwatchMediaHelper $swatchMediaHelper,
private readonly PriceCurrencyInterface $priceCurrency,
private readonly HttpContext $httpContext,
private readonly CardPriceResolver $cardPriceResolver,
array $data = []
) {
parent::__construct($context, $data);
}
public function getSubtitle(): string
{
return trim((string) $this->getConfig('subtitle'));
}
public function getExploreAllUrl(): string
{
return trim((string) $this->getConfig('explore_all_url'));
}
/**
* @return Product[]
*/
public function getProducts(): array
{
if ($this->products !== null) {
return $this->products;
}
$skus = $this->getConfiguredSkus();
if (!$skus) {
return $this->products = [];
}
$collection = $this->productCollectionFactory->create();
$collection->setStoreId((int) $this->_storeManager->getStore()->getId());
$this->_addProductAttributesAndPrices($collection);
$collection->addAttributeToSelect(['short_description']);
$collection->addStoreFilter();
$collection->addAttributeToFilter('sku', ['in' => $skus]);
$collection->addAttributeToFilter(
'visibility',
['in' => $this->productVisibility->getVisibleInSiteIds()]
);
$collection->addAttributeToFilter(
'status',
Product\Attribute\Source\Status::STATUS_ENABLED
);
$productsBySku = [];
foreach ($collection as $product) {
$productsBySku[strtolower((string) $product->getSku())] = $product;
}
$this->products = [];
foreach ($skus as $sku) {
$key = strtolower($sku);
if (isset($productsBySku[$key])) {
$this->products[] = $productsBySku[$key];
}
}
return $this->products;
}
public function getShortDescription(Product $product): string
{
$description = html_entity_decode(
strip_tags((string) $product->getData('short_description')),
ENT_QUOTES | ENT_HTML5
);
return trim((string) preg_replace('/\s+/u', ' ', $description));
}
/**
* @return array<int, array<string, int|string>>
*/
public function getColorSwatches(Product $product): array
{
$productId = (int) $product->getId();
if (isset($this->colorSwatches[$productId])) {
return $this->colorSwatches[$productId];
}
if ($product->getTypeId() !== 'configurable') {
return $this->colorSwatches[$productId] = [];
}
$colorAttribute = null;
foreach ($product->getTypeInstance()->getConfigurableAttributes($product) as $attribute) {
if ($attribute->getProductAttribute()->getAttributeCode() === 'color') {
$colorAttribute = $attribute->getProductAttribute();
$colorAttribute->setStoreId((int) $this->_storeManager->getStore()->getId());
break;
}
}
if ($colorAttribute === null) {
return $this->colorSwatches[$productId] = [];
}
$childIdsByGroup = $product->getTypeInstance()->getChildrenIds($productId);
$childIds = array_values(array_unique(array_map(
'intval',
array_merge(...array_values($childIdsByGroup ?: [[]]))
)));
if (!$childIds) {
return $this->colorSwatches[$productId] = [];
}
$childCollection = $this->productCollectionFactory->create();
$childCollection->setStoreId((int) $this->_storeManager->getStore()->getId());
$childCollection->addIdFilter($childIds);
$childCollection->addAttributeToSelect(['color', 'sku', 'image', 'small_image', 'thumbnail']);
$childCollection->addAttributeToFilter(
'status',
Product\Attribute\Source\Status::STATUS_ENABLED
);
$childCollection->setOrder('entity_id', 'ASC');
$childrenByOption = [];
foreach ($childCollection as $childProduct) {
$optionId = (int) $childProduct->getData('color');
if ($optionId > 0 && !isset($childrenByOption[$optionId])) {
$childrenByOption[$optionId] = $childProduct;
}
}
if (!$childrenByOption) {
return $this->colorSwatches[$productId] = [];
}
$swatchData = $this->swatchHelper->getSwatchesByOptionsId(array_keys($childrenByOption));
$result = [];
foreach ($childrenByOption as $optionId => $childProduct) {
$swatch = $swatchData[$optionId] ?? [];
$type = (int) ($swatch['type'] ?? Swatch::SWATCH_TYPE_EMPTY);
$value = (string) ($swatch['value'] ?? '');
$result[] = [
'id' => $optionId,
'sku' => (string) $childProduct->getSku(),
'label' => (string) $colorAttribute->getSource()->getOptionText($optionId),
'type' => $type,
'value' => $value,
'product_image' => $this->getProductImageUrl($childProduct, 'category_page_grid'),
'product_image_large' => $this->getProductImageUrl($childProduct, 'product_page_image_large'),
'image' => $type === Swatch::SWATCH_TYPE_VISUAL_IMAGE && $value !== ''
? $this->swatchMediaHelper->getSwatchAttributeImage(
Swatch::SWATCH_IMAGE_NAME,
$value
)
: '',
];
}
return $this->colorSwatches[$productId] = $result;
}
public function getProductImageUrl(Product $product, string $imageId = 'category_page_grid'): string
{
return (string) $this->getImage($product, $imageId)->getImageUrl();
}
public function getFormattedFinalPrice(Product $product): string
{
return $this->formatPrice($this->getFinalPriceValue($product));
}
public function getFormattedRegularPrice(Product $product): string
{
return $this->formatPrice($this->getRegularPriceValue($product));
}
public function hasRegularPrice(Product $product): bool
{
return $this->getRegularPriceValue($product) > $this->getFinalPriceValue($product);
}
public function getCacheKeyInfo(): array
{
return [
'ESUN_HOMEPAGE_HOT_SALE_FILAMENT',
(int) $this->_storeManager->getStore()->getId(),
(string) $this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP),
sha1(implode('|', $this->getConfiguredSkus())),
sha1($this->getSubtitle()),
sha1($this->getExploreAllUrl()),
];
}
public function getIdentities(): array
{
$identities = [];
foreach ($this->getProducts() as $product) {
$identities = array_merge($identities, $product->getIdentities());
}
return array_values(array_unique($identities));
}
private function getConfiguredSkus(): array
{
$value = (string) $this->getConfig('skus');
$skus = preg_split('/[\s,;]+/', $value, -1, PREG_SPLIT_NO_EMPTY) ?: [];
return array_values(array_unique(array_map('trim', $skus)));
}
private function getConfig(string $field): mixed
{
return $this->_scopeConfig->getValue(
self::XML_PATH . $field,
ScopeInterface::SCOPE_STORE
);
}
private function getFinalPriceValue(Product $product): float
{
return $this->cardPriceResolver->getFinalPrice($product);
}
private function getRegularPriceValue(Product $product): float
{
return $this->cardPriceResolver->getRegularPrice($product);
}
private function formatPrice(float $price): string
{
return $this->priceCurrency->format(
$price,
false,
PriceCurrencyInterface::DEFAULT_PRECISION,
$this->_storeManager->getStore()
);
}
}
@@ -0,0 +1,78 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block;
use Esun\ImageManager\Model\Category;
use Esun\ImageManager\Model\Image;
use Esun\ImageManager\Model\ImageProvider;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Magento\Store\Model\ScopeInterface;
class InnovativeMaterials extends Template implements IdentityInterface
{
private const XML_PATH_CATEGORY_ID = 'esun_homepage/innovative_materials/category_id';
/**
* @var array<int, array<string, int|string>>|null
*/
private ?array $items = null;
public function __construct(
Context $context,
private readonly ImageProvider $imageProvider,
array $data = []
) {
parent::__construct($context, $data);
}
/**
* @return array<int, array<string, int|string>>
*/
public function getItems(): array
{
if ($this->items === null) {
$this->items = array_values(array_filter(
$this->imageProvider->getImagesByCategoryId($this->getCategoryId()),
static fn (array $item): bool => trim((string) $item['thumbnail_url']) !== ''
));
}
return $this->items;
}
public function getCacheKeyInfo(): array
{
return [
'ESUN_HOMEPAGE_INNOVATIVE_MATERIALS',
(int) $this->_storeManager->getStore()->getId(),
$this->getCategoryId(),
];
}
public function getIdentities(): array
{
$identities = [];
$categoryId = $this->getCategoryId();
if ($categoryId > 0) {
$identities[] = Category::CACHE_TAG . '_' . $categoryId;
}
foreach ($this->getItems() as $item) {
$identities[] = Image::CACHE_TAG . '_' . (int) $item['id'];
}
return array_values(array_unique($identities));
}
private function getCategoryId(): int
{
return (int) $this->_scopeConfig->getValue(
self::XML_PATH_CATEGORY_ID,
ScopeInterface::SCOPE_STORE
);
}
}
@@ -0,0 +1,154 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block;
use Esun\Catalog\Model\Product\CardPriceResolver;
use Esun\Video\Model\ResourceModel\Video\CollectionFactory as VideoCollectionFactory;
use Magento\Catalog\Block\Product\AbstractProduct;
use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Visibility;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollectionFactory;
use Magento\Customer\Model\Context as CustomerContext;
use Magento\Framework\App\Http\Context as HttpContext;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\UrlInterface;
use Magento\Store\Model\ScopeInterface;
class LandscapeVideo extends AbstractProduct implements IdentityInterface
{
private const XML_PATH = 'esun_homepage/landscape_video/';
/**
* @var array<string, mixed>|null
*/
private ?array $item = null;
public function __construct(
Context $context,
private readonly ProductCollectionFactory $productCollectionFactory,
private readonly VideoCollectionFactory $videoCollectionFactory,
private readonly Visibility $productVisibility,
private readonly PriceCurrencyInterface $priceCurrency,
private readonly HttpContext $httpContext,
private readonly CardPriceResolver $cardPriceResolver,
array $data = []
) {
parent::__construct($context, $data);
}
/**
* @return array<string, mixed>
*/
public function getItem(): array
{
if ($this->item !== null) {
return $this->item;
}
$videoId = (int) $this->getConfig('video_id');
$sku = trim((string) $this->getConfig('product_sku'));
if ($videoId <= 0 || $sku === '') {
return $this->item = [];
}
$videos = $this->videoCollectionFactory->create();
$videos->addFieldToFilter('video_id', $videoId);
$videos->addFieldToFilter('status', 1);
$videos->setPageSize(1);
$video = $videos->getFirstItem();
if (!$video->getId() || trim((string) $video->getData('cover_path')) === '') {
return $this->item = [];
}
$products = $this->productCollectionFactory->create();
$products->setStoreId((int) $this->_storeManager->getStore()->getId());
$this->_addProductAttributesAndPrices($products);
$products->addStoreFilter();
$products->addAttributeToFilter('sku', $sku);
$products->addAttributeToFilter(
'visibility',
['in' => $this->productVisibility->getVisibleInSiteIds()]
);
$products->addAttributeToFilter(
'status',
Product\Attribute\Source\Status::STATUS_ENABLED
);
$products->setPageSize(1);
$product = $products->getFirstItem();
if (!$product->getId()) {
return $this->item = [];
}
$mediaBaseUrl = $this->_storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_MEDIA);
return $this->item = [
'video_url' => $mediaBaseUrl . ltrim((string) $video->getData('video_path'), '/'),
'cover_url' => $mediaBaseUrl . ltrim((string) $video->getData('cover_path'), '/'),
'product' => $product,
];
}
public function getFormattedFinalPrice(Product $product): string
{
return $this->formatPrice($this->getFinalPriceValue($product));
}
public function getFormattedRegularPrice(Product $product): string
{
return $this->formatPrice($this->getRegularPriceValue($product));
}
public function hasRegularPrice(Product $product): bool
{
return $this->getRegularPriceValue($product) > $this->getFinalPriceValue($product);
}
public function getCacheKeyInfo(): array
{
return [
'ESUN_HOMEPAGE_LANDSCAPE_VIDEO',
(int) $this->_storeManager->getStore()->getId(),
(int) $this->httpContext->getValue(CustomerContext::CONTEXT_GROUP),
(int) $this->getConfig('video_id'),
sha1(trim((string) $this->getConfig('product_sku'))),
];
}
public function getIdentities(): array
{
$product = $this->getItem()['product'] ?? null;
return $product instanceof Product ? $product->getIdentities() : [];
}
private function getConfig(string $field): mixed
{
return $this->_scopeConfig->getValue(
self::XML_PATH . $field,
ScopeInterface::SCOPE_STORE
);
}
private function getFinalPriceValue(Product $product): float
{
return $this->cardPriceResolver->getFinalPrice($product);
}
private function getRegularPriceValue(Product $product): float
{
return $this->cardPriceResolver->getRegularPrice($product);
}
private function formatPrice(float $price): string
{
return $this->priceCurrency->format(
$price,
false,
PriceCurrencyInterface::DEFAULT_PRECISION,
$this->_storeManager->getStore()
);
}
}
+120
View File
@@ -0,0 +1,120 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block;
use Magento\Catalog\Block\Product\AbstractProduct;
use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Visibility;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use Magento\Cms\Model\Template\FilterProvider;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Store\Model\ScopeInterface;
class NewProduct extends AbstractProduct implements IdentityInterface
{
private const XML_PATH_SKUS = 'esun_homepage/new_product/skus';
private const FEATURE_ATTRIBUTE = 'homepage_feature_content';
private const GALLERY_ATTRIBUTE = 'homepage_gallery_content';
/**
* @var Product[]|null
*/
private ?array $products = null;
public function __construct(
Context $context,
private readonly CollectionFactory $productCollectionFactory,
private readonly Visibility $productVisibility,
private readonly FilterProvider $filterProvider,
array $data = []
) {
parent::__construct($context, $data);
}
/**
* @return Product[]
*/
public function getProducts(): array
{
if ($this->products !== null) {
return $this->products;
}
$skus = $this->getConfiguredSkus();
if (!$skus) {
return $this->products = [];
}
$collection = $this->productCollectionFactory->create();
$collection->setStoreId((int) $this->_storeManager->getStore()->getId());
$this->_addProductAttributesAndPrices($collection);
$collection->addAttributeToSelect([self::FEATURE_ATTRIBUTE, self::GALLERY_ATTRIBUTE]);
$collection->addStoreFilter();
$collection->addAttributeToFilter('sku', ['in' => $skus]);
$collection->addAttributeToFilter(
'visibility',
['in' => $this->productVisibility->getVisibleInSiteIds()]
);
$collection->addAttributeToFilter(
'status',
Product\Attribute\Source\Status::STATUS_ENABLED
);
$productsBySku = [];
foreach ($collection as $product) {
$productsBySku[strtolower((string) $product->getSku())] = $product;
}
$this->products = [];
foreach ($skus as $sku) {
$key = strtolower($sku);
if (isset($productsBySku[$key])) {
$this->products[] = $productsBySku[$key];
}
}
return $this->products;
}
public function getFeatureContent(Product $product): string
{
return $this->filterContent((string) $product->getData(self::FEATURE_ATTRIBUTE));
}
public function getGalleryContent(Product $product): string
{
return $this->filterContent((string) $product->getData(self::GALLERY_ATTRIBUTE));
}
public function getIdentities(): array
{
$identities = [];
foreach ($this->getProducts() as $product) {
$identities = array_merge($identities, $product->getIdentities());
}
return array_values(array_unique($identities));
}
private function getConfiguredSkus(): array
{
$value = (string) $this->_scopeConfig->getValue(
self::XML_PATH_SKUS,
ScopeInterface::SCOPE_STORE
);
$skus = preg_split('/[\s,;]+/', $value, -1, PREG_SPLIT_NO_EMPTY) ?: [];
return array_values(array_unique(array_map('trim', $skus)));
}
private function filterContent(string $content): string
{
if (trim($content) === '') {
return '';
}
return $this->filterProvider->getPageFilter()->filter($content);
}
}
@@ -0,0 +1,124 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block;
use Mageplaza\Blog\Block\Post\View;
use Mageplaza\Blog\Model\Post;
/**
* Provides chronological navigation for the current news post.
*/
class NewsPostNavigation extends View
{
/** @var bool */
private bool $navigationLoaded = false;
/** @var Post|null */
private ?Post $previousPost = null;
/** @var Post|null */
private ?Post $nextPost = null;
/**
* Get the news post immediately before the current post.
*
* @return Post|null
*/
public function getPreviousPost(): ?Post
{
$this->loadNavigation();
return $this->previousPost;
}
/**
* Get the news post immediately after the current post.
*
* @return Post|null
*/
public function getNextPost(): ?Post
{
$this->loadNavigation();
return $this->nextPost;
}
/**
* Get the active storefront ID.
*
* @return int
*/
public function getCurrentStoreId(): int
{
return (int) $this->store->getStore()->getId();
}
/**
* Resolve both navigation directions once per request.
*
* @return void
*/
private function loadNavigation(): void
{
if ($this->navigationLoaded) {
return;
}
$this->navigationLoaded = true;
$currentPost = $this->getPost();
$currentPostId = (int) $currentPost->getId();
$publishDate = (string) $currentPost->getData('publish_date');
if ($currentPostId <= 0 || $publishDate === '') {
return;
}
$this->previousPost = $this->findPost([
'publish_date' => ['eq' => $publishDate],
'post_id' => ['lt' => $currentPostId],
], 'DESC');
if ($this->previousPost === null) {
$this->previousPost = $this->findPost([
'publish_date' => ['lt' => $publishDate],
], 'DESC');
}
$this->nextPost = $this->findPost([
'publish_date' => ['eq' => $publishDate],
'post_id' => ['gt' => $currentPostId],
], 'ASC');
if ($this->nextPost === null) {
$this->nextPost = $this->findPost([
'publish_date' => ['gt' => $publishDate],
], 'ASC');
}
}
/**
* Get the closest published post matching the supplied filters.
*
* @param array $filters
* @param string $direction
* @return Post|null
*/
private function findPost(array $filters, string $direction): ?Post
{
$collection = $this->helperData->getPostList($this->getCurrentStoreId());
foreach ($filters as $field => $condition) {
$collection->addFieldToFilter($field, $condition);
}
$collection->setOrder('publish_date', $direction)
->setOrder('post_id', $direction)
->setPageSize(1)
->setCurPage(1);
$post = $collection->getFirstItem();
return $post instanceof Post && $post->getId() ? $post : null;
}
}
+169
View File
@@ -0,0 +1,169 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Magento\Store\Model\ScopeInterface;
use Mageplaza\Blog\Helper\Data as BlogHelper;
use Mageplaza\Blog\Helper\Image as BlogImageHelper;
use Mageplaza\Blog\Model\Post;
use Mageplaza\Blog\Model\ResourceModel\Post\CollectionFactory as PostCollectionFactory;
class NewsRoom extends Template implements IdentityInterface
{
private const XML_PATH_IDS = 'esun_homepage/news_room/ids';
/**
* @var array<int, array<string, mixed>>|null
*/
private ?array $items = null;
public function __construct(
Context $context,
private readonly PostCollectionFactory $postCollectionFactory,
private readonly BlogHelper $blogHelper,
private readonly TimezoneInterface $timezone,
array $data = []
) {
parent::__construct($context, $data);
}
/**
* @return array<int, array<string, mixed>>
*/
public function getItems(): array
{
if ($this->items === null) {
$ids = $this->getConfiguredIds();
$this->items = [];
if (!$ids) {
return $this->items;
}
$collection = $this->postCollectionFactory->create();
$collection->addFieldToFilter('post_id', ['in' => $ids])
->addFieldToFilter('enabled', 1)
->addFieldToFilter('publish_date', ['to' => $this->timezone->date()->format('Y-m-d H:i:s')])
->setOrder('publish_date', 'desc');
foreach ($collection as $post) {
$this->items[] = $this->preparePostItem($post);
}
}
return $this->items;
}
public function getCacheKeyInfo(): array
{
return [
'ESUN_HOMEPAGE_NEWS_ROOM',
(int) $this->_storeManager->getStore()->getId(),
implode('_', $this->getConfiguredIds()),
];
}
public function getIdentities(): array
{
$identities = [];
foreach ($this->getItems() as $item) {
$identities[] = Post::CACHE_TAG . '_' . (int) $item['id'];
}
return array_values(array_unique($identities));
}
/**
* @return array<int, int>
*/
private function getConfiguredIds(): array
{
$value = (string) $this->_scopeConfig->getValue(
self::XML_PATH_IDS,
ScopeInterface::SCOPE_STORE
);
if (trim($value) === '') {
return [];
}
$ids = preg_split('/[\s,;]+/', $value, -1, PREG_SPLIT_NO_EMPTY) ?: [];
$ids = array_map('intval', $ids);
$ids = array_filter($ids, static fn (int $id): bool => $id > 0);
return array_values(array_unique($ids));
}
/**
* @return array<string, mixed>
*/
private function preparePostItem(Post $post): array
{
$imageUrl = $this->getPostImageUrl((string) $post->getImage());
return [
'id' => (int) $post->getId(),
'title' => (string) $post->getName(),
'image_url' => $imageUrl,
'publish_date' => $this->formatPublishDate((string) $post->getData('publish_date')),
'publish_date_iso' => $this->formatPublishDateIso((string) $post->getData('publish_date')),
'tag_name' => $this->getFirstTagName($post) ?: $this->getFirstCategoryName($post),
'url' => (string) $post->getUrl((int) $this->_storeManager->getStore()->getId()),
];
}
private function getPostImageUrl(string $image): string
{
if ($image === '') {
return $this->getViewFileUrl('Mageplaza_Blog::media/images/mageplaza-logo-default.png');
}
return (string) $this->blogHelper->getImageHelper()->resizeImage(
$image,
'640x',
BlogImageHelper::TEMPLATE_MEDIA_TYPE_POST
);
}
private function formatPublishDate(string $date): string
{
if ($date === '') {
return '';
}
return $this->timezone->date(new \DateTime($date))->format('y.m.d');
}
private function formatPublishDateIso(string $date): string
{
if ($date === '') {
return '';
}
return $this->timezone->date(new \DateTime($date))->format('Y-m-d');
}
private function getFirstTagName(Post $post): string
{
foreach ($post->getSelectedTagsCollection() as $tag) {
return (string) $tag->getName();
}
return '';
}
private function getFirstCategoryName(Post $post): string
{
foreach ($post->getSelectedCategoriesCollection() as $category) {
return (string) $category->getName();
}
return '';
}
}
+280
View File
@@ -0,0 +1,280 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block;
use Esun\Catalog\Model\Product\CardPriceResolver;
use Magento\Catalog\Block\Product\AbstractProduct;
use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Visibility;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use Magento\Customer\Model\Context as CustomerContext;
use Magento\Framework\App\Http\Context as HttpContext;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\UrlInterface;
use Magento\Store\Model\ScopeInterface;
use Magento\Swatches\Helper\Data as SwatchHelper;
use Magento\Swatches\Helper\Media as SwatchMediaHelper;
use Magento\Swatches\Model\Swatch;
class Resin extends AbstractProduct implements IdentityInterface
{
private const XML_PATH = 'esun_homepage/resin/';
private const BACKGROUND_MEDIA_PATH = 'esun/homepage/resin/';
/**
* @var Product[]|null
*/
private ?array $products = null;
/**
* @var array<int, array<int, array<string, int|string>>>
*/
private array $colorSwatches = [];
public function __construct(
Context $context,
private readonly CollectionFactory $productCollectionFactory,
private readonly Visibility $productVisibility,
private readonly PriceCurrencyInterface $priceCurrency,
private readonly HttpContext $httpContext,
private readonly SwatchHelper $swatchHelper,
private readonly SwatchMediaHelper $swatchMediaHelper,
private readonly CardPriceResolver $cardPriceResolver,
array $data = []
) {
parent::__construct($context, $data);
}
/**
* @return Product[]
*/
public function getProducts(): array
{
if ($this->products !== null) {
return $this->products;
}
$skus = $this->getConfiguredSkus();
if (!$skus) {
return $this->products = [];
}
$collection = $this->productCollectionFactory->create();
$collection->setStoreId((int) $this->_storeManager->getStore()->getId());
$this->_addProductAttributesAndPrices($collection);
$collection->addAttributeToSelect('short_description');
$collection->addStoreFilter();
$collection->addAttributeToFilter('sku', ['in' => $skus]);
$collection->addAttributeToFilter(
'visibility',
['in' => $this->productVisibility->getVisibleInSiteIds()]
);
$collection->addAttributeToFilter(
'status',
Product\Attribute\Source\Status::STATUS_ENABLED
);
$productsBySku = [];
foreach ($collection as $product) {
$productsBySku[strtolower((string) $product->getSku())] = $product;
}
$this->products = [];
foreach ($skus as $sku) {
$key = strtolower($sku);
if (isset($productsBySku[$key])) {
$this->products[] = $productsBySku[$key];
}
}
return $this->products;
}
public function getBackgroundImageUrl(): string
{
$image = ltrim(trim((string) $this->getConfig('background_image')), '/');
if ($image === '') {
return '';
}
return $this->_storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_MEDIA)
. self::BACKGROUND_MEDIA_PATH
. $image;
}
public function getExploreAllUrl(): string
{
return trim((string) $this->getConfig('explore_all_url'));
}
public function getShortDescription(Product $product): string
{
return trim((string) preg_replace(
'/\s+/u',
' ',
strip_tags((string) $product->getData('short_description'))
));
}
/**
* @return array<int, array<string, int|string>>
*/
public function getColorSwatches(Product $product): array
{
$productId = (int) $product->getId();
if (isset($this->colorSwatches[$productId])) {
return $this->colorSwatches[$productId];
}
if ($product->getTypeId() !== 'configurable') {
return $this->colorSwatches[$productId] = [];
}
$colorAttribute = null;
foreach ($product->getTypeInstance()->getConfigurableAttributes($product) as $attribute) {
if ($attribute->getProductAttribute()->getAttributeCode() === 'color') {
$colorAttribute = $attribute->getProductAttribute();
$colorAttribute->setStoreId((int) $this->_storeManager->getStore()->getId());
break;
}
}
if ($colorAttribute === null) {
return $this->colorSwatches[$productId] = [];
}
$childIdsByGroup = $product->getTypeInstance()->getChildrenIds($productId);
$childIds = array_values(array_unique(array_map(
'intval',
array_merge(...array_values($childIdsByGroup ?: [[]]))
)));
if (!$childIds) {
return $this->colorSwatches[$productId] = [];
}
$childCollection = $this->productCollectionFactory->create();
$childCollection->setStoreId((int) $this->_storeManager->getStore()->getId());
$childCollection->addIdFilter($childIds);
$childCollection->addAttributeToSelect(['color', 'sku', 'image', 'small_image', 'thumbnail']);
$childCollection->addAttributeToFilter(
'status',
Product\Attribute\Source\Status::STATUS_ENABLED
);
$childCollection->setOrder('entity_id', 'ASC');
$childrenByOption = [];
foreach ($childCollection as $childProduct) {
$optionId = (int) $childProduct->getData('color');
if ($optionId > 0 && !isset($childrenByOption[$optionId])) {
$childrenByOption[$optionId] = $childProduct;
}
}
if (!$childrenByOption) {
return $this->colorSwatches[$productId] = [];
}
$swatchData = $this->swatchHelper->getSwatchesByOptionsId(array_keys($childrenByOption));
$result = [];
foreach ($childrenByOption as $optionId => $childProduct) {
$swatch = $swatchData[$optionId] ?? [];
$type = (int) ($swatch['type'] ?? Swatch::SWATCH_TYPE_EMPTY);
$value = (string) ($swatch['value'] ?? '');
$result[] = [
'id' => $optionId,
'sku' => (string) $childProduct->getSku(),
'label' => (string) $colorAttribute->getSource()->getOptionText($optionId),
'type' => $type,
'value' => $value,
'product_image' => $this->getProductImageUrl($childProduct),
'image' => $type === Swatch::SWATCH_TYPE_VISUAL_IMAGE && $value !== ''
? $this->swatchMediaHelper->getSwatchAttributeImage(
Swatch::SWATCH_IMAGE_NAME,
$value
)
: '',
];
}
return $this->colorSwatches[$productId] = $result;
}
public function getProductImageUrl(Product $product, string $imageId = 'category_page_grid'): string
{
return (string) $this->getImage($product, $imageId)->getImageUrl();
}
public function getFormattedFinalPrice(Product $product): string
{
return $this->formatPrice($this->getFinalPriceValue($product));
}
public function getFormattedRegularPrice(Product $product): string
{
return $this->formatPrice($this->getRegularPriceValue($product));
}
public function hasRegularPrice(Product $product): bool
{
return $this->getRegularPriceValue($product) > $this->getFinalPriceValue($product);
}
public function getCacheKeyInfo(): array
{
return [
'ESUN_HOMEPAGE_RESIN',
(int) $this->_storeManager->getStore()->getId(),
(int) $this->httpContext->getValue(CustomerContext::CONTEXT_GROUP),
sha1(implode('|', $this->getConfiguredSkus())),
sha1($this->getBackgroundImageUrl()),
sha1($this->getExploreAllUrl()),
];
}
public function getIdentities(): array
{
$identities = [];
foreach ($this->getProducts() as $product) {
$identities = array_merge($identities, $product->getIdentities());
}
return array_values(array_unique($identities));
}
private function getConfiguredSkus(): array
{
$value = (string) $this->getConfig('skus');
$skus = preg_split('/[\s,;]+/', $value, -1, PREG_SPLIT_NO_EMPTY) ?: [];
return array_values(array_unique(array_map('trim', $skus)));
}
private function getConfig(string $field): mixed
{
return $this->_scopeConfig->getValue(
self::XML_PATH . $field,
ScopeInterface::SCOPE_STORE
);
}
private function getFinalPriceValue(Product $product): float
{
return $this->cardPriceResolver->getFinalPrice($product);
}
private function getRegularPriceValue(Product $product): float
{
return $this->cardPriceResolver->getRegularPrice($product);
}
private function formatPrice(float $price): string
{
return $this->priceCurrency->format(
$price,
false,
PriceCurrencyInterface::DEFAULT_PRECISION,
$this->_storeManager->getStore()
);
}
}
@@ -0,0 +1,78 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Block;
use Esun\ImageManager\Model\Category;
use Esun\ImageManager\Model\Image;
use Esun\ImageManager\Model\ImageProvider;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Magento\Store\Model\ScopeInterface;
class ResourcesDownloads extends Template implements IdentityInterface
{
private const XML_PATH_CATEGORY_ID = 'esun_homepage/resources_downloads/category_id';
/**
* @var array<int, array<string, int|string>>|null
*/
private ?array $items = null;
public function __construct(
Context $context,
private readonly ImageProvider $imageProvider,
array $data = []
) {
parent::__construct($context, $data);
}
/**
* @return array<int, array<string, int|string>>
*/
public function getItems(): array
{
if ($this->items === null) {
$this->items = array_values(array_filter(
$this->imageProvider->getImagesByCategoryId($this->getCategoryId()),
static fn (array $item): bool => trim((string) $item['thumbnail_url']) !== ''
));
}
return $this->items;
}
public function getCacheKeyInfo(): array
{
return [
'ESUN_HOMEPAGE_RESOURCES_DOWNLOADS',
(int) $this->_storeManager->getStore()->getId(),
$this->getCategoryId(),
];
}
public function getIdentities(): array
{
$identities = [];
$categoryId = $this->getCategoryId();
if ($categoryId > 0) {
$identities[] = Category::CACHE_TAG . '_' . $categoryId;
}
foreach ($this->getItems() as $item) {
$identities[] = Image::CACHE_TAG . '_' . (int) $item['id'];
}
return array_values(array_unique($identities));
}
private function getCategoryId(): int
{
return (int) $this->_scopeConfig->getValue(
self::XML_PATH_CATEGORY_ID,
ScopeInterface::SCOPE_STORE
);
}
}
@@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Model\Config\Backend;
use Magento\Config\Model\Config\Backend\Serialized\ArraySerialized;
use Magento\Config\Model\ResourceModel\Config\Data as ConfigResource;
use Magento\Config\Model\ResourceModel\Config\Data\Collection as ConfigCollection;
class CreateAnythingItems extends ArraySerialized
{
protected function _construct(): void
{
$this->_setResourceModel(ConfigResource::class, ConfigCollection::class);
}
public function beforeSave()
{
$value = $this->getValue();
$items = [];
if (is_array($value)) {
unset($value['__empty']);
foreach ($value as $row) {
if (!is_array($row)) {
continue;
}
$title = trim((string) ($row['title'] ?? ''));
$subtitle = trim((string) ($row['subtitle'] ?? ''));
$videoId = (int) ($row['video_id'] ?? 0);
$productSku = trim((string) ($row['product_sku'] ?? ''));
$sortNumber = (int) ($row['sort_number'] ?? 0);
if ($title === '' || $videoId <= 0 || $productSku === '') {
continue;
}
$items[] = [
'title' => $title,
'subtitle' => $subtitle,
'video_id' => $videoId,
'product_sku' => $productSku,
'sort_number' => $sortNumber,
];
}
}
usort($items, static function (array $left, array $right): int {
return $left['sort_number'] <=> $right['sort_number'];
});
$this->setValue($items);
return parent::beforeSave();
}
}
@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Model\Config\Source;
use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory;
use Magento\Framework\Data\OptionSourceInterface;
class CatalogRule implements OptionSourceInterface
{
public function __construct(
private readonly CollectionFactory $collectionFactory
) {
}
public function toOptionArray(): array
{
$options = [
['value' => '', 'label' => __('-- Please Select --')],
];
$collection = $this->collectionFactory->create();
$collection->setOrder('name', 'ASC');
foreach ($collection as $rule) {
$status = $rule->getIsActive() ? __('Active') : __('Inactive');
$options[] = [
'value' => (int) $rule->getId(),
'label' => sprintf(
'#%d %s [%s]',
(int) $rule->getId(),
(string) $rule->getName(),
(string) $status
),
];
}
return $options;
}
}
@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Model\Config\Source;
use Esun\ImageManager\Model\ResourceModel\Category\CollectionFactory;
use Magento\Framework\Data\OptionSourceInterface;
class ImageCategory implements OptionSourceInterface
{
public function __construct(private readonly CollectionFactory $collectionFactory)
{
}
public function toOptionArray(): array
{
$options = [
['value' => '', 'label' => __('Please select')],
];
$collection = $this->collectionFactory->create()
->addFieldToFilter('status', 1)
->setOrder('sort_order', 'ASC')
->setOrder('name', 'ASC');
foreach ($collection as $category) {
$options[] = [
'value' => (int) $category->getId(),
'label' => (string) $category->getData('name'),
];
}
return $options;
}
}
@@ -0,0 +1,104 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Setup\Patch\Data;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Setup\CategorySetupFactory;
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;
class AddHomepageProductAttributes implements DataPatchInterface
{
private const ATTRIBUTE_GROUP = 'Homepage';
public function __construct(
private readonly ModuleDataSetupInterface $moduleDataSetup,
private readonly CategorySetupFactory $categorySetupFactory
) {
}
public function apply(): self
{
$this->moduleDataSetup->getConnection()->startSetup();
$catalogSetup = $this->categorySetupFactory->create(['setup' => $this->moduleDataSetup]);
$attributes = [
'homepage_feature_content' => [
'label' => 'New Product Feature Content',
'sort_order' => 10,
'note' => 'Build the upper-right feature panel, including the four icon/text items.',
],
'homepage_gallery_content' => [
'label' => 'New Product Gallery Content',
'sort_order' => 20,
'note' => 'Build the lower-right image area.',
],
];
foreach ($attributes as $attributeCode => $attributeData) {
if (!$catalogSetup->getAttributeId(Product::ENTITY, $attributeCode)) {
$catalogSetup->addAttribute(Product::ENTITY, $attributeCode, [
'type' => 'text',
'label' => $attributeData['label'],
'input' => 'textarea',
'required' => false,
'sort_order' => $attributeData['sort_order'],
'global' => ScopedAttributeInterface::SCOPE_STORE,
'visible' => true,
'user_defined' => true,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'is_html_allowed_on_front' => true,
'wysiwyg_enabled' => true,
'is_pagebuilder_enabled' => true,
'used_in_product_listing' => false,
'unique' => false,
'note' => $attributeData['note'],
]);
}
$catalogSetup->updateAttribute(Product::ENTITY, $attributeCode, [
'is_wysiwyg_enabled' => 1,
'is_pagebuilder_enabled' => 1,
'is_html_allowed_on_front' => 1,
]);
}
$entityTypeId = $catalogSetup->getEntityTypeId(Product::ENTITY);
foreach ($catalogSetup->getAllAttributeSetIds($entityTypeId) as $attributeSetId) {
$catalogSetup->addAttributeGroup(
$entityTypeId,
(int) $attributeSetId,
self::ATTRIBUTE_GROUP,
95
);
foreach ($attributes as $attributeCode => $attributeData) {
$catalogSetup->addAttributeToSet(
$entityTypeId,
(int) $attributeSetId,
self::ATTRIBUTE_GROUP,
$attributeCode,
$attributeData['sort_order']
);
}
}
$this->moduleDataSetup->getConnection()->endSetup();
return $this;
}
public static function getDependencies(): array
{
return [];
}
public function getAliases(): array
{
return [];
}
}
@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
namespace Esun\Homepage\Setup\Patch\Data;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Setup\CategorySetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;
class EnableHomepageProductPageBuilder implements DataPatchInterface
{
private const ATTRIBUTE_CODES = [
'homepage_feature_content',
'homepage_gallery_content',
];
public function __construct(
private readonly ModuleDataSetupInterface $moduleDataSetup,
private readonly CategorySetupFactory $categorySetupFactory
) {
}
public function apply(): self
{
$this->moduleDataSetup->getConnection()->startSetup();
$catalogSetup = $this->categorySetupFactory->create(['setup' => $this->moduleDataSetup]);
foreach (self::ATTRIBUTE_CODES as $attributeCode) {
$catalogSetup->updateAttribute(Product::ENTITY, $attributeCode, [
'is_wysiwyg_enabled' => 1,
'is_pagebuilder_enabled' => 1,
'is_html_allowed_on_front' => 1,
]);
}
$this->moduleDataSetup->getConnection()->endSetup();
return $this;
}
public static function getDependencies(): array
{
return [
AddHomepageProductAttributes::class,
];
}
public function getAliases(): array
{
return [];
}
}
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Magento_Backend::stores">
<resource id="Magento_Backend::stores_settings">
<resource id="Magento_Config::config">
<resource id="Esun_Homepage::config"
title="Esun Homepage Configuration"
sortOrder="80"/>
</resource>
</resource>
</resource>
</resource>
</resources>
</acl>
</config>
@@ -0,0 +1,164 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="esun" translate="label" sortOrder="300">
<label>Esun</label>
</tab>
<section id="esun_homepage" translate="label" type="text" sortOrder="910" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Homepage</label>
<tab>esun</tab>
<resource>Esun_Homepage::config</resource>
<group id="catalog_rule_deal" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Catalog Price Rule Deal</label>
<field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Module</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="rule_id" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Catalog Price Rule</label>
<comment>The rule must be active, assigned to the current website and indexed. It's To Date is used by the countdown. </comment>
<source_model>Esun\Homepage\Model\Config\Source\CatalogRule</source_model>
</field>
<field id="title" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Heading</label>
<comment>Falls back to the Catalog Price Rule name when left empty.</comment>
</field>
<field id="accent_title" translate="label comment" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Green Heading Text</label>
<comment>Optional highlighted text displayed after the heading.</comment>
</field>
<field id="products_limit" translate="label comment" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Number of Products</label>
<comment>Maximum: 12.</comment>
<validate>validate-number validate-greater-than-zero</validate>
</field>
</group>
<group id="hot_sale_filament" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Hot Sale Filament</label>
<field id="subtitle" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Subtitle</label>
<comment>Displayed below the Hot Sale Filaments heading.</comment>
</field>
<field id="explore_all_url" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Explore All URL</label>
<comment>URL used by the Explore All link. Leave empty to disable the link.</comment>
</field>
<field id="skus" translate="label comment" type="textarea" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Product SKUs</label>
<comment>Enter multiple SKUs separated by commas or new lines. Products are displayed in the entered order.</comment>
</field>
</group>
<group id="accessories" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Accessories</label>
<field id="background_image" translate="label comment" type="image" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Background Image</label>
<backend_model>Magento\Config\Model\Config\Backend\Image</backend_model>
<upload_dir config="system/filesystem/media" scope_info="1">esun/homepage/accessories</upload_dir>
<base_url type="media" scope_info="1">esun/homepage/accessories</base_url>
<comment>Allowed file types: jpg, jpeg, gif and png.</comment>
</field>
<field id="explore_all_url" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Explore All URL</label>
<comment>URL used by the Explore All link. Leave empty to disable the link.</comment>
</field>
<field id="skus" translate="label comment" type="textarea" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Product SKUs</label>
<comment>Enter multiple SKUs separated by commas or new lines. Products are displayed in the entered order.</comment>
</field>
</group>
<group id="resin" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
<label>3D Resin</label>
<field id="background_image" translate="label comment" type="image" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Background Image</label>
<backend_model>Magento\Config\Model\Config\Backend\Image</backend_model>
<upload_dir config="system/filesystem/media" scope_info="1">esun/homepage/resin</upload_dir>
<base_url type="media" scope_info="1">esun/homepage/resin</base_url>
<comment>Allowed file types: jpg, jpeg, gif and png.</comment>
</field>
<field id="explore_all_url" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Explore All URL</label>
<comment>URL used by the Explore All link. Leave empty to disable the link.</comment>
</field>
<field id="skus" translate="label comment" type="textarea" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Product SKUs</label>
<comment>Enter multiple SKUs separated by commas or new lines. Products are displayed in the entered order.</comment>
</field>
</group>
<group id="create_anything" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Create Anything You Imagine</label>
<field id="items" translate="label comment" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Items</label>
<frontend_model>Esun\Homepage\Block\Adminhtml\System\Config\Form\Field\CreateAnythingItems</frontend_model>
<backend_model>Esun\Homepage\Model\Config\Backend\CreateAnythingItems</backend_model>
<comment>Video ID refers to an enabled video in the Esun video library. Empty or invalid rows are not displayed.</comment>
</field>
</group>
<group id="application" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Application</label>
<field id="category_id" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Image Category</label>
<source_model>Esun\Homepage\Model\Config\Source\ImageCategory</source_model>
<comment>Select the Image Manager category used by the Application block.</comment>
</field>
<field id="subtitle" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Subtitle</label>
<comment>Displayed below the Application heading.</comment>
</field>
<field id="explore_all_url" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Explore All URL</label>
<comment>URL used by the Explore All link. Leave empty to disable the link.</comment>
</field>
</group>
<group id="innovative_materials" translate="label" type="text" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Innovative Materials</label>
<field id="category_id" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Image Category</label>
<source_model>Esun\Homepage\Model\Config\Source\ImageCategory</source_model>
<comment>Select the Image Manager category used by the Innovative Materials block.</comment>
</field>
</group>
<group id="landscape_video" translate="label" type="text" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Landscape Video</label>
<field id="video_id" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Video ID</label>
<comment>Enter the ID of an enabled video from Video Management.</comment>
<validate>validate-number validate-greater-than-zero</validate>
</field>
<field id="product_sku" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Product SKU</label>
<comment>Enter one enabled and visible product SKU.</comment>
</field>
</group>
<group id="awards_reviews" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Awards &amp; Reviews</label>
<field id="category_id" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Image Category</label>
<source_model>Esun\Homepage\Model\Config\Source\ImageCategory</source_model>
<comment>Select the Image Manager category used by the Awards &amp; Reviews block.</comment>
</field>
</group>
<group id="resources_downloads" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Resources &amp; Downloads</label>
<field id="category_id" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Image Category</label>
<source_model>Esun\Homepage\Model\Config\Source\ImageCategory</source_model>
<comment>Select the Image Manager category used by the Resources &amp; Downloads block.</comment>
</field>
</group>
<group id="news_room" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
<label>News Room</label>
<field id="ids" translate="label comment" type="textarea" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>News IDs</label>
<comment>Enter Mageplaza Blog post IDs separated by commas, spaces or new lines. Posts are displayed by Publish Date descending.</comment>
</field>
</group>
<group id="new_product" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="1">
<label>New Product</label>
<field id="skus" translate="label comment" type="textarea" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Product SKUs</label>
<comment>Enter multiple SKUs separated by commas or new lines. Products are displayed in the entered order.</comment>
</field>
</group>
</section>
</system>
</config>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<esun_homepage>
<catalog_rule_deal>
<enabled>0</enabled>
<title>Stock Up</title>
<accent_title>For Spring</accent_title>
<products_limit>4</products_limit>
</catalog_rule_deal>
</esun_homepage>
</default>
</config>
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Esun_Homepage">
<sequence>
<module name="Magento_Catalog"/>
<module name="Magento_CatalogRule"/>
<module name="Magento_Checkout"/>
<module name="Magento_Cms"/>
<module name="Magento_Config"/>
<module name="Magento_Customer"/>
<module name="Magento_PageBuilder"/>
<module name="Magento_Swatches"/>
<module name="Mageplaza_Blog"/>
<module name="Esun_Video"/>
<module name="Esun_ImageManager"/>
<module name="Esun_Catalog"/>
</sequence>
</module>
</config>
+10
View File
@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
use Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(
ComponentRegistrar::MODULE,
'Esun_Homepage',
__DIR__
);
@@ -0,0 +1,50 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="Esun_Homepage::css/catalog-rule-deal.css"/>
<css src="Esun_Homepage::css/hot-sale-filament.css"/>
<css src="Esun_Homepage::css/accessories.css"/>
<css src="Esun_Homepage::css/resin.css"/>
<css src="Esun_Homepage::css/create-anything.css"/>
<css src="Esun_Homepage::css/application.css"/>
<css src="Esun_Homepage::css/innovative-materials.css"/>
<css src="Esun_Homepage::css/landscape-video.css"/>
<css src="Esun_Homepage::css/awards-reviews.css"/>
<css src="Esun_Homepage::css/resources-downloads.css"/>
<css src="Esun_Homepage::css/news-room.css"/>
<css src="Esun_Homepage::css/new-product.css"/>
</head>
<body>
<referenceContainer name="content">
<block class="Esun\Homepage\Block\CatalogRuleDeal" name="esun.homepage.catalog.rule.deal" template="Esun_Homepage::catalog-rule-deal.phtml" after="cms_page" cacheable="true" ttl="600" />
<block class="Esun\Homepage\Block\NewProduct" name="esun.homepage.new.product" template="Esun_Homepage::new-product.phtml" after="esun.homepage.catalog.rule.deal" cacheable="true" ttl="600" />
<block class="Esun\Homepage\Block\HotSaleFilament" name="esun.homepage.hot.sale.filament" template="Esun_Homepage::hot-sale-filament.phtml" after="esun.homepage.new.product" cacheable="true" ttl="600" />
<block class="Esun\Homepage\Block\Accessories" name="esun.homepage.accessories" template="Esun_Homepage::accessories.phtml" after="esun.homepage.hot.sale.filament" cacheable="true" ttl="600" />
<block class="Esun\Homepage\Block\Resin" name="esun.homepage.resin" template="Esun_Homepage::resin.phtml" after="esun.homepage.accessories" cacheable="true" ttl="600" />
<container name="service-guarantee" as="service-guarantee" htmlTag="div" htmlClass="service-guarantee" after="esun.homepage.resin">
<block class="Magento\Cms\Block\Block" name="service_guarantee">
<arguments>
<argument name="block_id" xsi:type="string">service_guarantee</argument>
</arguments>
</block>
</container>
<block class="Esun\Homepage\Block\Application" name="esun.homepage.application" template="Esun_Homepage::application.phtml" after="service-guarantee" cacheable="true" ttl="600" />
<block class="Esun\Homepage\Block\CreateAnything" name="esun.homepage.create.anything" template="Esun_Homepage::create-anything.phtml" after="esun.homepage.application" cacheable="true" ttl="600" />
<block class="Esun\Homepage\Block\InnovativeMaterials" name="esun.homepage.innovative.materials" template="Esun_Homepage::innovative-materials.phtml" after="esun.homepage.create.anything" cacheable="true" ttl="600" />
<block class="Esun\Homepage\Block\LandscapeVideo" name="esun.homepage.landscape.video" template="Esun_Homepage::landscape-video.phtml" after="esun.homepage.innovative.materials" cacheable="true" ttl="600" />
<block class="Esun\Homepage\Block\AwardsReviews" name="esun.homepage.awards.reviews" template="Esun_Homepage::awards-reviews.phtml" after="esun.homepage.landscape.video" cacheable="true" ttl="600" />
<block class="Esun\Homepage\Block\ResourcesDownloads" name="esun.homepage.resources.downloads" template="Esun_Homepage::resources-downloads.phtml" after="esun.homepage.awards.reviews" cacheable="true" ttl="600" />
<block class="Esun\Homepage\Block\NewsRoom" name="esun.homepage.news.room" template="Esun_Homepage::news-room.phtml" after="esun.homepage.resources.downloads" cacheable="true" ttl="600" />
<container name="footer-esun_contactus" as="footer-esun_contactus" htmlTag="div" htmlClass="footer-esun_contactus" after="esun.homepage.news.room">
<block class="Magento\Cms\Block\Block" name="esun_contactus">
<arguments>
<argument name="block_id" xsi:type="string">esun_contactus</argument>
</arguments>
</block>
</container>
</referenceContainer>
</body>
</page>
@@ -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>
@@ -0,0 +1,288 @@
.esun-accessories {
--accessories-green: #12ad5c;
box-sizing: border-box;
margin: 76px auto 0;
max-width: 1360px;
padding: 0 20px;
position: relative;
}
.esun-accessories *,
.esun-accessories *::before,
.esun-accessories *::after {
box-sizing: border-box;
}
.esun-accessories__heading {
align-items: flex-start;
display: flex;
justify-content: space-between;
margin-bottom: 36px;
}
.esun-accessories__heading h2 {
color: #303030;
font-size: 36px;
font-weight: 700;
letter-spacing: 5px;
margin: 0;
position: relative;
text-transform: uppercase;
}
.esun-accessories__heading h2::after {
background: var(--accessories-green);
bottom: -20px;
content: "";
height: 2px;
left: 0;
position: absolute;
width: 56px;
}
.esun-accessories__explore {
align-items: center;
color: var(--accessories-green);
display: inline-flex;
flex: 0 0 auto;
font-size: 14px;
font-weight: 700;
gap: 12px;
margin-top: 35px;
text-decoration: none;
}
.esun-accessories__explore:hover,
.esun-accessories__explore:focus {
color: #0c914c;
text-decoration: none;
}
.esun-accessories__explore span {
font-size: 18px;
line-height: 1;
}
.esun-accessories__banner {
background-color: #d7e5eb;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
border-radius: 40px;
min-height: 240px;
overflow: hidden;
padding: 38px 42px 38px 42%;
}
.esun-accessories__products {
display: flex;
gap: 16px;
list-style: none;
margin: 0;
overflow-x: auto;
padding: 0 0 3px;
scrollbar-width: thin;
}
.esun-accessories__item {
flex: 0 0 calc((100% - 16px) / 2);
min-width: 330px;
margin: 0;
}
.esun-accessories__card {
background: #fff;
border-radius: 24px;
display: grid;
grid-template-columns: 130px minmax(0, 1fr);
min-height: 174px;
overflow: hidden;
padding: 22px 22px 22px 28px;
}
.esun-accessories__image {
align-self: center;
display: block;
height: 130px;
overflow: hidden;
border-radius: 10px;
position: relative;
}
.esun-accessories__image .product-image-container,
.esun-accessories__image .product-image-wrapper {
height: 100%;
width: 100% !important;
}
.esun-accessories__image .product-image-wrapper {
padding-bottom: 0 !important;
}
.esun-accessories__image .product-image-photo {
height: 100%;
inset: 0;
margin: auto;
max-height: none;
object-fit: cover;
position: absolute;
width: 100%;
}
.esun-accessories__details {
min-width: 0;
padding: 4px 0 0 22px;
position: relative;
}
.esun-accessories__details h3 {
font-size: 18px;
font-weight: 600;
margin: 0 0 15px;
padding-right: 4px;
}
.esun-accessories__details h3 a {
color: #333;
text-decoration: none;
}
.esun-accessories__details h3 a:hover,
.esun-accessories__details h3 a:focus {
color: var(--accessories-green);
text-decoration: none;
}
.esun-accessories__price {
align-items: baseline;
display: flex;
flex-wrap: wrap;
gap: 8px;
padding-right: 48px;
}
.esun-accessories__final-price {
color: var(--accessories-green);
font-size: 22px;
font-weight: 600;
}
.esun-accessories__regular-price {
color: #98a5ae;
font-size: 12px;
text-decoration: line-through;
}
.esun-accessories__cart {
align-items: center;
background: var(--accessories-green);
border-radius: 50%;
bottom: 0;
color: #fff;
display: inline-flex;
height: 40px;
justify-content: center;
position: absolute;
right: 0;
text-decoration: none;
width: 40px;
}
.esun-accessories__cart:hover,
.esun-accessories__cart:focus {
background: #0c914c;
color: #fff;
text-decoration: none;
}
.esun-accessories__cart svg {
fill: none;
height: 20px;
stroke: #fff;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.7;
width: 20px;
}
.esun-accessories__visually-hidden {
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
@media (max-width: 1199px) {
.esun-accessories__banner {
padding-left: 34%;
}
.esun-accessories__item {
flex-basis: 390px;
}
}
@media (max-width: 899px) {
.esun-accessories__banner {
background-position: left center;
padding-left: 28%;
}
.esun-accessories__item {
flex-basis: 360px;
}
}
@media (max-width: 639px) {
.esun-accessories {
margin-top: 48px;
padding: 0 15px;
}
.esun-accessories__heading {
margin-bottom: 42px;
}
.esun-accessories__heading h2 {
font-size: 28px;
letter-spacing: 3px;
}
.esun-accessories__explore {
font-size: 13px;
margin-top: 12px;
}
.esun-accessories__banner {
background-position: center left;
background-size: cover;
border-radius: 28px;
padding: 210px 16px 20px;
}
.esun-accessories__item {
flex-basis: min(330px, calc(100vw - 62px));
min-width: min(330px, calc(100vw - 62px));
}
.esun-accessories__card {
grid-template-columns: 105px minmax(0, 1fr);
min-height: 150px;
padding: 18px;
}
.esun-accessories__image {
height: 110px;
}
.esun-accessories__details {
padding-left: 16px;
}
.esun-accessories__details h3 {
font-size: 18px;
}
}
@@ -0,0 +1,328 @@
.esun-application {
--application-green: #12ad5c;
box-sizing: border-box;
margin: 84px auto 0;
max-width: 1360px;
padding: 0 20px;
}
.esun-application *,
.esun-application *::before,
.esun-application *::after {
box-sizing: border-box;
}
.esun-application__heading {
margin-bottom: 70px;
}
.esun-application__heading h2 {
color: #303030;
font-size: 36px;
font-weight: 700;
letter-spacing: 5px;
margin: 0 0 46px;
position: relative;
text-transform: uppercase;
}
.esun-application__heading h2::after {
background: var(--application-green);
bottom: -20px;
content: "";
height: 2px;
left: 0;
position: absolute;
width: 70px;
}
.esun-application__heading-row {
align-items: center;
display: flex;
gap: 24px;
justify-content: space-between;
}
.esun-application__heading p {
color: #94a8c3;
font-size: 17px;
font-weight: 600;
margin: 0;
}
.esun-application__explore-all {
align-items: center;
color: #18a957 !important;
display: inline-flex;
flex: 0 0 auto;
font-size: 14px;
font-weight: 700;
gap: 12px;
text-decoration: none;
}
.esun-application__explore-all:hover,
.esun-application__explore-all:focus {
color: #000 !important;
text-decoration: none;
}
.esun-application__items {
display: flex;
gap: 16px;
min-height: 590px;
overflow: hidden;
}
.esun-application__item {
background: #252525;
border-radius: 34px;
flex-basis: 0;
flex-grow: 1;
flex-shrink: 1;
min-width: 0;
overflow: hidden;
position: relative;
transition:
flex-basis 0.48s ease,
flex-grow 0.48s ease,
filter 0.4s ease,
opacity 0.4s ease;
}
.esun-application__thumbnail,
.esun-application__hover-image {
height: 100%;
inset: 0;
object-fit: cover;
position: absolute;
transition:
opacity 0.4s ease,
transform 0.65s ease;
width: 100%;
}
.esun-application__hover-image {
opacity: 0;
transform: scale(1.04);
}
.esun-application__shade {
background: linear-gradient(
180deg,
rgba(0, 0, 0, 0.08) 38%,
rgba(0, 0, 0, 0.78)
);
inset: 0;
position: absolute;
transition: background 0.4s ease;
}
.esun-application__default-copy {
align-items: center;
bottom: 38px;
color: #fff;
display: flex;
flex-direction: column;
left: 16px;
position: absolute;
right: 16px;
text-align: center;
transition:
opacity 0.25s ease,
transform 0.35s ease;
z-index: 2;
}
.esun-application__icon {
align-items: center;
background: rgba(45, 45, 45, 0.38);
border: 1px solid rgba(255, 255, 255, 0.35);
border-radius: 50%;
display: flex;
height: 78px;
justify-content: center;
margin-bottom: 22px;
padding: 17px;
width: 78px;
}
.esun-application__icon img {
height: 100%;
object-fit: contain;
width: 100%;
}
.esun-application__default-copy h3,
.esun-application__hover-copy h3 {
color: #fff;
font-size: 21px;
font-weight: 700;
line-height: 1.2;
margin: 0;
}
.esun-application__hover-copy {
bottom: 48px;
left: 48px;
opacity: 0;
position: absolute;
transform: translateY(18px);
transition:
opacity 0.3s ease 0.12s,
transform 0.4s ease 0.08s;
visibility: hidden;
z-index: 3;
}
.esun-application__hover-copy h3 {
font-size: 30px;
letter-spacing: 2px;
margin-bottom: 34px;
}
.esun-application__explore {
align-items: center;
background: var(--application-green);
border-radius: 26px;
color: #fff !important;
display: inline-flex;
font-size: 15px;
font-weight: 700;
height: 52px;
justify-content: center;
min-width: 160px;
padding: 0 28px;
text-decoration: none;
}
.esun-application__explore:hover,
.esun-application__explore:focus {
background: #0c914c;
color: #fff;
text-decoration: none;
}
.esun-application__items.has-active-item .esun-application__item {
flex-basis: 0;
flex-grow: 0.48;
flex-shrink: 1;
filter: blur(2px);
opacity: 0.8;
}
.esun-application__items .esun-application__item--interactive.is-active {
flex-basis: 0;
flex-grow: 3.2;
flex-shrink: 1;
filter: none;
opacity: 1;
outline: none;
}
.esun-application__item--interactive.is-active .esun-application__thumbnail,
.esun-application__item--interactive:hover .esun-application__thumbnail,
.esun-application__item--interactive:focus .esun-application__thumbnail {
opacity: 0;
}
.esun-application__item--interactive.is-active .esun-application__hover-image,
.esun-application__item--interactive:hover .esun-application__hover-image,
.esun-application__item--interactive:focus .esun-application__hover-image {
opacity: 1;
transform: scale(1);
}
.esun-application__item--interactive.is-active .esun-application__shade,
.esun-application__item--interactive:hover .esun-application__shade,
.esun-application__item--interactive:focus .esun-application__shade {
background: linear-gradient(180deg, transparent 48%, rgba(0, 0, 0, 0.65));
}
.esun-application__item--interactive.is-active .esun-application__default-copy,
.esun-application__item--interactive:hover .esun-application__default-copy,
.esun-application__item--interactive:focus .esun-application__default-copy {
opacity: 0;
transform: translateY(20px);
}
.esun-application__item--interactive.is-active .esun-application__hover-copy,
.esun-application__item--interactive:hover .esun-application__hover-copy,
.esun-application__item--interactive:focus .esun-application__hover-copy {
opacity: 1;
transform: translateY(0);
visibility: visible;
}
@media (max-width: 1023px) {
.esun-application__items {
min-height: 520px;
overflow-x: auto;
}
.esun-application__item {
flex: 0 0 260px;
}
.esun-application__items.has-active-item .esun-application__item {
flex: 0 0 180px;
}
.esun-application__items .esun-application__item--interactive.is-active {
flex-basis: 620px;
}
}
@media (max-width: 639px) {
.esun-application {
margin-top: 56px;
padding: 0 15px;
}
.esun-application__heading {
margin-bottom: 48px;
}
.esun-application__heading h2 {
font-size: 28px;
letter-spacing: 3px;
}
.esun-application__heading-row {
align-items: flex-start;
}
.esun-application__heading p {
font-size: 15px;
}
.esun-application__explore-all {
font-size: 12px;
text-align: right;
}
.esun-application__items {
min-height: 470px;
}
.esun-application__item,
.esun-application__items.has-active-item .esun-application__item {
flex: 0 0 min(78vw, 310px);
filter: none;
opacity: 1;
}
.esun-application__items .esun-application__item--interactive.is-active {
flex-basis: min(90vw, 410px);
}
.esun-application__hover-copy {
bottom: 34px;
left: 28px;
}
.esun-application__hover-copy h3 {
font-size: 24px;
margin-bottom: 24px;
}
}
@@ -0,0 +1,267 @@
.esun-awards-reviews {
--awards-green: #12ad5c;
box-sizing: border-box;
overflow: hidden;
padding: 0 0 74px;
max-width: 1920px;
margin: 90px auto 0;
}
/*.esun-awards-reviews *,*/
/*.esun-awards-reviews *::before,*/
/*.esun-awards-reviews *::after {*/
/* box-sizing: border-box;*/
/*}*/
.esun-awards-reviews__heading {
align-items: flex-start;
display: flex;
justify-content: space-between;
margin: 0 auto 58px;
max-width: 1440px;
padding: 0 24px;
}
.esun-awards-reviews__heading h2 {
color: #303030;
font-size: 38px;
font-weight: 700;
letter-spacing: 6px;
margin: 0;
position: relative;
text-transform: uppercase;
}
.esun-awards-reviews__heading h2::after {
background: var(--awards-green);
bottom: -24px;
content: "";
height: 2px;
left: 0;
position: absolute;
width: 70px;
}
.esun-awards-reviews__navigation {
display: flex;
gap: 16px;
}
.esun-awards-reviews__previous {
padding-right: 9px;
background: #fff;
}
.esun-awards-reviews__previous {
padding-right: 9px;
}
.esun-awards-reviews__next {
padding-left: 9px;
}
.esun-awards-reviews__previous:hover,
.esun-awards-reviews__next:hover {
background: #18a957;
color: #fff;
}
.esun-awards-reviews__previous:hover .arrow-left {
border-color: #fff;
}
.esun-awards-reviews__previous,
.esun-awards-reviews__next {
align-items: center;
border: 1px solid var(--awards-green);
border-radius: 50%;
box-shadow: none;
color: var(--awards-green);
display: flex;
font-size: 34px;
height: 52px;
justify-content: center;
line-height: 1;
width: 52px;
}
.esun-awards-reviews__next {
background: var(--awards-green);
color: #fff;
}
.esun-awards-reviews__slider {
overflow: visible;
padding: 28px 0 48px;
}
.esun-awards-reviews__slide {
align-items: center;
display: flex;
height: 450px;
opacity: 0.35;
transition: opacity 0.45s ease;
}
.esun-awards-reviews__slide.swiper-slide-active {
opacity: 1;
z-index: 2;
}
.esun-awards-reviews__card {
border-radius: 34px;
box-shadow: none;
height: 270px;
overflow: visible;
position: relative;
transition:
height 0.45s ease,
box-shadow 0.45s ease,
transform 0.45s ease;
width: 100%;
}
.esun-awards-reviews__slide.swiper-slide-active .esun-awards-reviews__card {
box-shadow: 0 24px 48px rgba(36, 68, 50, 0.2);
height: 450px;
transform: translateY(-12px);
}
.esun-awards-reviews__thumbnail,
.esun-awards-reviews__image {
border-radius: 34px;
height: 100%;
inset: 0;
object-fit: cover;
position: absolute;
transition: opacity 0.4s ease;
width: 100%;
}
.esun-awards-reviews__image {
opacity: 0;
}
.esun-awards-reviews__slide.swiper-slide-active
.esun-awards-reviews__thumbnail {
opacity: 0;
}
.esun-awards-reviews__slide.swiper-slide-active .esun-awards-reviews__image {
opacity: 1;
}
.esun-awards-reviews__copy {
background: rgba(255, 255, 255, 0.94);
border-radius: 34px;
box-shadow: 0 18px 44px rgba(0, 0, 0, 0.08);
opacity: 0;
padding: 38px 42px;
position: absolute;
right: -72px;
top: 50%;
transform: translate(20px, -50%);
transition:
opacity 0.35s ease 0.12s,
transform 0.4s ease 0.08s;
visibility: hidden;
width: min(450px, 48%);
z-index: 3;
}
.esun-awards-reviews__slide.swiper-slide-active .esun-awards-reviews__copy {
opacity: 1;
transform: translate(0, -50%);
visibility: visible;
}
.esun-awards-reviews__copy h3 {
color: #191919;
font-size: 24px;
font-weight: 700;
line-height: 1.15;
margin: 0 0 42px;
position: relative;
}
.esun-awards-reviews__copy h3::after {
background: var(--awards-green);
bottom: -22px;
content: "";
height: 2px;
left: 0;
position: absolute;
width: 58px;
}
.esun-awards-reviews__description {
color: #667084;
font-size: 16px;
}
@media (max-width: 767px) {
.esun-awards-reviews {
background: linear-gradient(180deg, #fff 35%, #f3faf5 100%);
margin-top: 56px;
padding-bottom: 90px;
}
.esun-awards-reviews__heading {
margin-bottom: 42px;
padding: 0 15px;
}
.esun-awards-reviews__heading h2 {
font-size: 27px;
letter-spacing: 3px;
}
.esun-awards-reviews__previous,
.esun-awards-reviews__next {
font-size: 28px;
height: 42px;
width: 42px;
}
.esun-awards-reviews__slide {
height: clamp(460px, 76vw, 550px);
}
.esun-awards-reviews__card {
height: clamp(300px, 52vw, 375px);
}
.esun-awards-reviews__slide.swiper-slide-active .esun-awards-reviews__card {
height: clamp(360px, 62vw, 450px);
transform: none;
}
.esun-awards-reviews__card,
.esun-awards-reviews__thumbnail,
.esun-awards-reviews__image {
border-radius: 24px;
}
.esun-awards-reviews__copy {
bottom: clamp(-100px, -14vw, -56px);
left: 7%;
padding: clamp(20px, 4vw, 28px);
right: 7%;
top: auto;
transform: translateY(18px);
width: auto;
}
.esun-awards-reviews__slide.swiper-slide-active .esun-awards-reviews__copy {
transform: translateY(0);
}
.esun-awards-reviews__copy h3 {
font-size: clamp(18px, 3.4vw, 24px);
line-height: 1.35;
margin-bottom: 34px;
}
.esun-awards-reviews__description {
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
display: -webkit-box;
font-size: clamp(13px, 2.2vw, 16px);
line-height: 1.45;
overflow: hidden;
}
}
@@ -0,0 +1,360 @@
.esun-create-anything {
--create-green: #12ad5c;
box-sizing: border-box;
margin: 84px auto 0;
max-width: 1360px;
padding: 0 20px;
}
.esun-create-anything *,
.esun-create-anything *::before,
.esun-create-anything *::after {
box-sizing: border-box;
}
.esun-create-anything__heading {
color: #303030;
font-size: 38px;
font-weight: 700;
letter-spacing: 7px;
margin: 0 0 72px;
position: relative;
text-align: center;
text-transform: uppercase;
}
.esun-create-anything__heading::after {
background: var(--create-green);
bottom: -22px;
content: "";
height: 2px;
left: 50%;
position: absolute;
transform: translateX(-50%);
width: 92px;
}
.esun-create-anything__slider {
padding-bottom: 76px;
}
.esun-create-anything__slide {
height: auto;
}
.esun-create-anything__media {
background: #101010;
border-radius: 34px;
height: 100%;
min-height: 560px;
overflow: hidden;
position: relative;
}
.esun-create-anything__cover,
.esun-create-anything__video {
height: 100%;
inset: 0;
object-fit: cover;
position: absolute;
width: 100%;
}
.esun-create-anything__media::after {
background: linear-gradient(
180deg,
rgba(0, 0, 0, 0.32),
transparent 28%,
transparent 58%,
rgba(0, 0, 0, 0.82)
);
content: "";
inset: 0;
pointer-events: none;
position: absolute;
z-index: 1;
}
.esun-create-anything__copy {
color: #fff;
left: 20px;
position: absolute;
right: 20px;
text-align: center;
top: 30px;
z-index: 2;
}
.esun-create-anything__copy h3 {
font-size: 23px;
font-weight: 700;
line-height: 1.2;
margin: 0 0 5px;
}
.esun-create-anything__copy p {
font-size: 14px;
letter-spacing: 1.5px;
margin: 0;
}
.esun-create-anything__product {
align-items: center;
bottom: 22px;
color: #fff;
display: flex;
left: 22px;
position: absolute;
right: 22px;
text-decoration: none;
z-index: 2;
}
.esun-create-anything__product:hover,
.esun-create-anything__product:focus {
color: #fff;
text-decoration: none;
}
.esun-create-anything__product-image {
background: #fff;
border-radius: 22px;
flex: 0 0 66px;
height: 66px;
overflow: hidden;
padding: 5px;
width: 66px;
position: relative;
}
.esun-create-anything__product-image .product-image-container,
.esun-create-anything__product-image .product-image-wrapper {
height: 100%;
width: 100% !important;
}
.esun-create-anything__product-image .product-image-wrapper {
padding-bottom: 0 !important;
}
.esun-create-anything__product-image .product-image-photo {
height: 100%;
inset: 0;
margin: auto;
object-fit: contain;
position: absolute;
width: 100%;
}
.esun-create-anything__product-copy {
display: flex;
flex-direction: column;
min-width: 0;
padding-left: 14px;
}
.esun-create-anything__product-copy strong {
font-size: 15px;
line-height: 1.2;
margin-bottom: 8px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.esun-create-anything__price {
align-items: baseline;
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.esun-create-anything__final-price {
color: var(--create-green);
font-size: 17px;
font-weight: 700;
}
.esun-create-anything__regular-price {
color: #aaa;
font-size: 13px;
text-decoration: line-through;
}
.esun-create-anything__media.is-playing .esun-create-anything__cover {
display: none;
}
.esun-create-anything__video {
background: #000;
opacity: 0;
pointer-events: none;
z-index: 0;
}
.esun-create-anything__media.is-playing .esun-create-anything__video {
opacity: 1;
}
.esun-create-anything__controls {
align-items: center;
bottom: 0;
display: flex;
justify-content: center;
left: 50%;
position: absolute;
transform: translateX(-50%);
width: min(560px, 90%);
z-index: 5;
}
.esun-create-anything__previous,
.esun-create-anything__next {
align-items: center;
border: 1px solid var(--create-green);
border-radius: 50%;
box-shadow: none;
display: flex;
flex: 0 0 52px;
font-size: 36px;
height: 52px;
justify-content: center;
line-height: 1;
padding: 0 0 4px;
width: 52px;
}
.esun-create-anything__previous {
background: #fff;
color: var(--create-green);
}
.esun-create-anything__next {
background: var(--create-green);
color: #fff;
}
.esun-create-anything__pagination {
align-items: center;
bottom: auto !important;
display: flex;
flex: 1;
justify-content: center;
position: static;
}
.esun-create-anything__pagination .swiper-pagination-bullet {
background: #edf2f0;
border-radius: 2px;
height: 4px;
margin: 0 4px;
opacity: 1;
width: 42px;
}
.esun-create-anything__pagination .swiper-pagination-bullet-active {
background: var(--create-green);
}
.esun-create-anything .swiper-button-disabled {
opacity: 0.35;
}
@media (max-width: 1023px) {
.esun-create-anything__media {
min-height: 520px;
}
}
@media (max-width: 639px) {
.esun-create-anything {
margin-top: 56px;
padding: 0 15px;
}
.esun-create-anything__heading {
font-size: 27px;
letter-spacing: 4px;
line-height: 1.25;
margin-bottom: 58px;
text-align: left;
}
.esun-create-anything__heading::after {
left: 0;
transform: none;
width: 48px;
}
.esun-create-anything__media {
border-radius: 28px;
min-height: 500px;
}
.esun-create-anything__slider {
margin-right: 0;
overflow-x: auto;
padding-bottom: 0;
scrollbar-width: none;
scroll-snap-type: x mandatory;
}
.esun-create-anything__slider::-webkit-scrollbar {
display: none;
}
.esun-create-anything__slider .swiper-wrapper {
gap: 12px;
transform: none !important;
transition: none !important;
width: auto !important;
}
.esun-create-anything__slider .esun-create-anything__slide {
flex: 0 0 79%;
scroll-snap-align: start;
width: 79% !important;
}
.esun-create-anything__controls {
display: none;
}
.esun-create-anything__copy h3 {
font-size: 20px;
}
.esun-create-anything__product {
bottom: 16px;
left: 16px;
right: 16px;
}
.esun-create-anything__product-image {
border-radius: 12px;
flex-basis: 52px;
height: 52px;
width: 52px;
}
.esun-create-anything__product-copy {
padding-left: 10px;
}
.esun-create-anything__product-copy strong {
font-size: 14px;
margin-bottom: 5px;
}
.esun-create-anything__price {
gap: 8px;
}
.esun-create-anything__final-price {
font-size: 16px;
}
.esun-create-anything__regular-price {
font-size: 12px;
}
}
@@ -0,0 +1,517 @@
.cms-home .esun-hot-sale {
margin-top: 0 !important;
padding-top: 30px;
}
.esun-hot-sale {
--hot-sale-green: #12ad5c;
box-sizing: border-box;
margin: 76px auto 0;
max-width: 1360px;
padding: 0 20px;
}
.esun-hot-sale *,
.esun-hot-sale *::before,
.esun-hot-sale *::after {
box-sizing: border-box;
}
.esun-hot-sale__heading {
margin-bottom: 64px;
}
.esun-hot-sale__heading h2 {
color: #303030;
font-size: 36px;
font-weight: 700;
letter-spacing: 5px;
margin: 0 0 34px;
position: relative;
text-transform: uppercase;
}
.esun-hot-sale__heading h2::after {
background: var(--hot-sale-green);
bottom: -18px;
content: "";
height: 2px;
left: 0;
position: absolute;
width: 70px;
}
.esun-hot-sale__heading-row {
align-items: center;
display: flex;
gap: 24px;
justify-content: space-between;
}
.esun-hot-sale__heading p {
color: #666;
font-size: 17px;
font-weight: 600;
margin: 0;
}
.esun-hot-sale__explore {
align-items: center;
color: var(--hot-sale-green);
display: inline-flex;
flex: 0 0 auto;
font-size: 14px;
font-weight: 600;
gap: 12px;
text-decoration: none;
}
.esun-hot-sale__explore:hover,
.esun-hot-sale__explore:focus {
color: #0c914c;
text-decoration: none;
}
.esun-hot-sale__explore span {
font-size: 18px;
line-height: 1;
}
.esun-hot-sale__slider {
padding-bottom: 54px;
}
.esun-hot-sale__page {
height: auto;
}
.esun-hot-sale__grid {
display: grid;
gap: 28px;
grid-template-columns: repeat(4, minmax(0, 1fr));
list-style: none;
margin: 0;
padding: 0;
}
.esun-hot-sale__item {
min-width: 0;
}
.esun-hot-sale__item--featured {
grid-column: span 2;
}
.esun-hot-sale__card {
background: #fff;
border: 1px solid #f1f1f1;
border-radius: 30px;
box-shadow: 0 8px 28px rgba(23, 50, 36, 0.06);
display: flex;
flex-direction: column;
height: 100%;
min-height: 510px;
overflow: hidden;
}
.esun-hot-sale__image {
display: block;
height: 310px;
overflow: hidden;
padding: 18px 18px 0;
position: relative;
}
.esun-hot-sale__image .product-image-container,
.esun-hot-sale__image .product-image-wrapper {
height: 100%;
width: 100% !important;
}
.esun-hot-sale__image .product-image-wrapper {
padding-bottom: 0 !important;
}
.esun-hot-sale__image .product-image-photo {
height: 100%;
inset: 0;
margin: auto;
max-height: none;
object-fit: contain;
position: absolute;
width: 100%;
}
.esun-hot-sale__details {
display: flex;
flex: 1;
flex-direction: column;
min-width: 0;
padding: 22px 24px 20px;
}
.esun-hot-sale__details h3 {
font-size: 18px;
font-weight: 600;
margin: 0 0 16px;
}
.esun-hot-sale__details h3 a {
color: #242424;
text-decoration: none;
}
.esun-hot-sale__details h3 a:hover,
.esun-hot-sale__details h3 a:focus {
color: var(--hot-sale-green);
text-decoration: none;
}
.esun-hot-sale__description {
color: #747474;
display: -webkit-box;
font-size: 15px;
line-height: 1.45;
margin: 0 0 24px;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 5;
}
.esun-hot-sale__swatches {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: 9px;
margin-bottom: 20px;
min-height: 40px;
}
.esun-hot-sale__swatch {
background: #fff;
border: 1px solid #e1e1e1;
border-radius: 50%;
display: inline-flex;
height: 18px;
overflow: hidden;
padding: 2px;
width: 18px;
}
.esun-hot-sale__swatch > span,
.esun-hot-sale__swatch img {
border-radius: 50%;
height: 100%;
object-fit: cover;
width: 100%;
}
.esun-hot-sale__swatch-more {
color: #4b4b4b;
font-size: 13px;
line-height: 18px;
}
.esun-hot-sale__footer {
align-items: center;
border-top: 1px solid #f2f2f2;
display: flex;
justify-content: space-between;
margin-top: auto;
padding-top: 18px;
}
.esun-hot-sale__price {
align-items: baseline;
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.esun-hot-sale__final-price {
color: var(--hot-sale-green);
font-size: 24px;
font-weight: 600;
}
.esun-hot-sale__regular-price {
color: #a5a5a5;
font-size: 14px;
text-decoration: line-through;
}
.esun-hot-sale__cart {
align-items: center;
background: var(--hot-sale-green);
border-radius: 50%;
color: #fff;
display: inline-flex;
flex: 0 0 48px;
height: 48px;
justify-content: center;
text-decoration: none;
width: 48px;
}
.esun-hot-sale__cart:hover,
.esun-hot-sale__cart:focus {
background: #0c914c;
color: #fff;
text-decoration: none;
}
.esun-hot-sale__cart svg {
fill: none;
height: 23px;
stroke: #fff;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.7;
width: 23px;
}
.esun-hot-sale__item--featured .esun-hot-sale__card {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.esun-hot-sale__item--featured .esun-hot-sale__image {
height: 100%;
padding: 28px 0 28px 28px;
}
.esun-hot-sale__item--featured .esun-hot-sale__details {
padding: 48px 38px 28px;
}
.esun-hot-sale__item--featured .esun-hot-sale__details h3 {
font-size: 24px;
margin-bottom: 24px;
}
.esun-hot-sale__item--featured .esun-hot-sale__swatches {
margin-bottom: 24px;
}
.esun-hot-sale__pagination {
bottom: 0 !important;
}
.esun-hot-sale__pagination .swiper-pagination-bullet {
background: #bfe4ce;
height: 8px;
opacity: 1;
transition:
width 0.2s ease,
background 0.2s ease;
width: 8px;
}
.esun-hot-sale__pagination .swiper-pagination-bullet-active {
background: var(--hot-sale-green);
border-radius: 5px;
width: 26px;
}
.esun-hot-sale__visually-hidden {
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
@media (max-width: 1199px) {
.esun-hot-sale__grid {
gap: 20px;
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.esun-hot-sale__item--featured {
grid-column: span 2;
}
}
@media (max-width: 899px) {
.esun-hot-sale__grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.esun-hot-sale__item--featured {
grid-column: span 2;
}
}
@media (max-width: 639px) {
.esun-hot-sale__image .product-image-photo {
height: auto;
}
.esun-hot-sale {
margin-top: 48px;
padding: 0 15px;
}
.esun-hot-sale__heading {
margin-bottom: 30px;
}
.esun-hot-sale__heading h2 {
font-size: 28px;
letter-spacing: 3px;
margin-bottom: 28px;
}
.esun-hot-sale__heading h2::after {
bottom: -12px;
width: 48px;
}
.esun-hot-sale__heading-row {
align-items: center;
gap: 10px;
}
.esun-hot-sale__heading p {
flex: 1 1 auto;
font-size: 12px;
font-weight: 400;
line-height: 1.35;
}
.esun-hot-sale__explore {
font-size: 13px;
gap: 6px;
}
.esun-hot-sale__grid {
gap: 18px 12px;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.esun-hot-sale__item--featured {
grid-column: 1 / -1;
}
.esun-hot-sale__card,
.esun-hot-sale__item--featured .esun-hot-sale__card {
display: flex;
min-height: 0;
}
.esun-hot-sale__card {
border-radius: 18px;
}
.esun-hot-sale__item--featured .esun-hot-sale__image {
height: clamp(290px, 72vw, 360px);
padding: 14px 14px 0;
}
.esun-hot-sale__item--featured .esun-hot-sale__details {
padding: 18px 20px 20px;
}
.esun-hot-sale__item--featured .esun-hot-sale__details h3 {
font-size: 20px;
margin-bottom: 10px;
}
.esun-hot-sale__item--featured .esun-hot-sale__description {
font-size: 14px;
margin-bottom: 14px;
-webkit-line-clamp: 2;
}
.esun-hot-sale__item--featured .esun-hot-sale__swatches {
margin-bottom: 14px;
}
.esun-hot-sale__item:not(.esun-hot-sale__item--featured)
.esun-hot-sale__image {
height: clamp(155px, 43vw, 210px);
padding: 8px 8px 0;
}
.esun-hot-sale__item:not(.esun-hot-sale__item--featured)
.esun-hot-sale__details {
padding: 12px 10px 14px;
}
.esun-hot-sale__item:not(.esun-hot-sale__item--featured)
.esun-hot-sale__details
h3 {
display: -webkit-box;
font-size: 16px;
line-height: 1.25;
margin-bottom: 8px;
min-height: 40px;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.esun-hot-sale__item:not(.esun-hot-sale__item--featured)
.esun-hot-sale__swatches {
flex-wrap: nowrap;
gap: 6px;
margin-bottom: 12px;
min-height: 20px;
overflow: hidden;
}
.esun-hot-sale__item:not(.esun-hot-sale__item--featured)
.esun-hot-sale__swatch {
flex: 0 0 18px;
}
.esun-hot-sale__item:not(.esun-hot-sale__item--featured)
.esun-hot-sale__swatch-more {
flex: 0 0 auto;
font-size: 11px;
}
.esun-hot-sale__item:not(.esun-hot-sale__item--featured)
.esun-hot-sale__footer {
gap: 6px;
padding-top: 12px;
}
.esun-hot-sale__item:not(.esun-hot-sale__item--featured)
.esun-hot-sale__price {
gap: 4px;
min-width: 0;
}
.esun-hot-sale__item:not(.esun-hot-sale__item--featured)
.esun-hot-sale__final-price {
font-size: 18px;
}
.esun-hot-sale__item:not(.esun-hot-sale__item--featured)
.esun-hot-sale__regular-price {
font-size: 11px;
}
.esun-hot-sale__item:not(.esun-hot-sale__item--featured)
.esun-hot-sale__cart {
flex-basis: 40px;
height: 40px;
width: 40px;
}
.esun-hot-sale__item:not(.esun-hot-sale__item--featured)
.esun-hot-sale__cart
svg {
height: 19px;
width: 19px;
}
}
@media (max-width: 359px) {
.esun-hot-sale__item:not(.esun-hot-sale__item--featured)
.esun-hot-sale__regular-price {
display: none;
}
}
@@ -0,0 +1,175 @@
.esun-innovative-materials {
background:
radial-gradient(
circle at 22% 12%,
rgba(33, 189, 107, 0.07),
transparent 31%
),
linear-gradient(90deg, #fbfefb, #fff 52%, #fbfefb);
box-sizing: border-box;
margin-top: 10px;
overflow: hidden;
padding: 52px 24px 42px;
position: relative;
}
.esun-innovative-materials::before,
.esun-innovative-materials::after {
border: 2px solid rgba(34, 190, 108, 0.2);
border-bottom-color: transparent;
border-left-color: transparent;
border-radius: 50%;
content: "";
pointer-events: none;
position: absolute;
}
.esun-innovative-materials::before {
height: 620px;
left: -350px;
top: -375px;
transform: rotate(28deg);
width: 760px;
}
.esun-innovative-materials::after {
border-style: dashed;
height: 330px;
right: -90px;
top: 80px;
transform: rotate(-24deg);
width: 430px;
}
.esun-innovative-materials *,
.esun-innovative-materials *::before,
.esun-innovative-materials *::after {
box-sizing: border-box;
}
.esun-innovative-materials__inner {
margin: 0 auto;
position: relative;
z-index: 1;
max-width: 1360px;
padding: 0 20px;
}
.esun-innovative-materials h2 {
color: #13ad5c;
font-size: 50px;
font-style: italic;
font-weight: 400;
line-height: 1.12;
margin: 0 0 70px;
}
.esun-innovative-materials__items {
display: flex;
gap: 28px;
height: 360px;
}
.esun-innovative-materials__item {
border-radius: 22px;
flex-basis: 0;
flex-grow: 1;
flex-shrink: 1;
min-width: 0;
overflow: hidden;
position: relative;
transition:
flex-grow 0.48s ease,
filter 0.4s ease,
opacity 0.4s ease;
}
.esun-innovative-materials__thumbnail,
.esun-innovative-materials__hover-image {
height: 100%;
inset: 0;
object-fit: cover;
position: absolute;
transition:
opacity 0.4s ease,
transform 0.6s ease;
width: 100%;
}
.esun-innovative-materials__hover-image {
opacity: 0;
transform: scale(1.035);
}
.esun-innovative-materials__items.has-active-item
.esun-innovative-materials__item {
flex-grow: 0.72;
}
.esun-innovative-materials__items.has-active-item
.esun-innovative-materials__item--interactive.is-active {
flex-grow: 2.55;
outline: none;
}
.esun-innovative-materials__item--interactive.is-active
.esun-innovative-materials__thumbnail {
opacity: 0;
}
.esun-innovative-materials__item--interactive.is-active
.esun-innovative-materials__hover-image {
opacity: 1;
transform: scale(1);
}
@media (max-width: 1023px) {
.esun-innovative-materials h2 {
font-size: 38px;
margin-bottom: 52px;
}
.esun-innovative-materials__items {
gap: 18px;
height: 270px;
overflow-x: auto;
}
.esun-innovative-materials__item,
.esun-innovative-materials__items.has-active-item
.esun-innovative-materials__item {
flex: 0 0 260px;
}
.esun-innovative-materials__items.has-active-item
.esun-innovative-materials__item--interactive.is-active {
flex-basis: 560px;
}
}
@media (max-width: 639px) {
.esun-innovative-materials {
margin-top: 56px;
padding: 40px 15px 32px;
}
.esun-innovative-materials h2 {
font-size: 30px;
margin-bottom: 40px;
}
.esun-innovative-materials__items {
height: 240px;
}
.esun-innovative-materials__item,
.esun-innovative-materials__items.has-active-item
.esun-innovative-materials__item {
flex-basis: min(76vw, 290px);
}
.esun-innovative-materials__items.has-active-item
.esun-innovative-materials__item--interactive.is-active {
flex-basis: min(90vw, 390px);
}
}
@@ -0,0 +1,234 @@
.esun-landscape-video {
--landscape-green: #12ad5c;
box-sizing: border-box;
margin: 72px auto 0;
max-width: 1360px;
padding: 0 20px;
}
.esun-landscape-video *,
.esun-landscape-video *::before,
.esun-landscape-video *::after {
box-sizing: border-box;
}
.esun-landscape-video__media {
aspect-ratio: 16 / 9;
background: #151515;
border-radius: 38px;
overflow: hidden;
position: relative;
}
.esun-landscape-video__media::after {
background: linear-gradient(90deg, rgba(0, 0, 0, .58), transparent 56%);
content: "";
inset: 0;
pointer-events: none;
position: absolute;
z-index: 1;
}
.esun-landscape-video__cover,
.esun-landscape-video__video {
height: 100%;
inset: 0;
object-fit: cover;
position: absolute;
width: 100%;
}
.esun-landscape-video__video {
background: #000;
opacity: 0;
pointer-events: none;
z-index: 2;
}
.esun-landscape-video__media.is-playing .esun-landscape-video__video {
opacity: 1;
}
.esun-landscape-video__media.is-playing .esun-landscape-video__cover,
.esun-landscape-video__media.is-playing::after {
display: none;
}
.esun-landscape-video__product {
align-items: center;
backdrop-filter: blur(16px);
background: rgba(31, 34, 35, .72);
border: 1px solid rgba(255, 255, 255, .18);
border-radius: 22px;
bottom: 52px;
display: flex;
min-height: 112px;
padding: 14px 20px;
position: absolute;
right: 50px;
width: min(470px, calc(100% - 48px));
z-index: 4;
}
.esun-landscape-video__product-image {
background: #fff;
border-radius: 22px;
flex: 0 0 76px;
height: 76px;
overflow: hidden;
padding: 5px;
width: 76px;
position: relative;
}
.esun-landscape-video__product-image .product-image-container,
.esun-landscape-video__product-image .product-image-wrapper {
height: 100%;
width: 100% !important;
}
.esun-landscape-video__product-image .product-image-wrapper {
padding-bottom: 0 !important;
}
.esun-landscape-video__product-image .product-image-photo {
height: 100%;
inset: 0;
margin: auto;
object-fit: contain;
position: absolute;
width: 100%;
}
.esun-landscape-video__product-copy {
flex: 1 1 auto;
min-width: 0;
padding: 0 20px;
}
.esun-landscape-video__product-name {
color: #fff;
display: block;
font-size: 18px;
font-weight: 700;
margin-bottom: 12px;
overflow: hidden;
text-decoration: none;
text-overflow: ellipsis;
white-space: nowrap;
}
.esun-landscape-video__product-name:hover,
.esun-landscape-video__product-name:focus {
color: #fff;
text-decoration: none;
}
.esun-landscape-video__price {
align-items: baseline;
display: flex;
flex-wrap: wrap;
gap: 16px;
}
.esun-landscape-video__final-price {
color: var(--landscape-green);
font-size: 20px;
font-weight: 700;
}
.esun-landscape-video__regular-price {
color: #aaa;
font-size: 15px;
text-decoration: line-through;
}
.esun-landscape-video__cart {
align-items: center;
background: var(--landscape-green);
border-radius: 50%;
color: #fff;
display: flex;
flex: 0 0 58px;
height: 58px;
justify-content: center;
text-decoration: none;
width: 58px;
}
.esun-landscape-video__cart:hover,
.esun-landscape-video__cart:focus {
background: #0c914c;
color: #fff;
text-decoration: none;
}
.esun-landscape-video__cart svg {
fill: none;
height: 27px;
stroke: currentColor;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.7;
width: 27px;
}
.esun-landscape-video__visually-hidden {
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
@media (max-width: 767px) {
.esun-landscape-video {
margin-top: 48px;
padding: 0 15px;
}
.esun-landscape-video__media {
aspect-ratio: 4 / 3;
border-radius: 24px;
}
.esun-landscape-video__product {
bottom: 18px;
min-height: 88px;
padding: 10px 12px;
right: 18px;
width: calc(100% - 36px);
}
.esun-landscape-video__product-image {
border-radius: 16px;
flex-basis: 62px;
height: 62px;
width: 62px;
}
.esun-landscape-video__product-copy {
padding: 0 12px;
}
.esun-landscape-video__product-name {
font-size: 14px;
margin-bottom: 7px;
}
.esun-landscape-video__final-price {
font-size: 16px;
}
.esun-landscape-video__regular-price {
font-size: 12px;
}
.esun-landscape-video__cart {
flex-basis: 46px;
height: 46px;
width: 46px;
}
}
@@ -0,0 +1,478 @@
.esun-new-product {
--esun-new-product-green: #28ad5f;
box-sizing: border-box;
margin: 76px auto 0;
max-width: 1360px;
padding: 0 20px;
}
.esun-new-product *,
.esun-new-product *::before,
.esun-new-product *::after {
box-sizing: border-box;
}
.esun-new-product__title {
padding-top: 50px;
color: #303030;
font-size: 36px;
font-weight: 700;
letter-spacing: 4px;
margin: 0 0 62px;
position: relative;
text-align: center;
text-transform: uppercase;
}
.esun-new-product__title::after {
background: var(--esun-new-product-green);
bottom: -20px;
content: "";
height: 2px;
left: 50%;
position: absolute;
transform: translateX(-50%);
width: 70px;
}
.esun-new-product__slider {
padding-bottom: 56px;
}
.esun-new-product__slide {
display: grid;
gap: 24px;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
height: auto;
}
.esun-new-product__product-card,
.esun-new-product__features {
background: #fff;
border: 1px solid #e8e8e8;
border-radius: 34px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.esun-new-product__features table tr {
display: flex;
width: 280px;
align-items: center;
}
.esun-new-product__features table tr td:first-child {
width: 75px;
}
.esun-new-product__features table tr td:last-child {
width: 75%;
}
.esun-new-product__features table tr td h3 {
font-size: 18px;
font-weight: 600;
margin: 0;
color: #333;
}
.esun-new-product__features table tr td {
color: #999;
}
.esun-new-product__features table tr td p {
margin: 0 0 5px;
}
.esun-new-product__features table tr td img {
width: 48px;
height: 48px;
}
.esun-new-product__product-card {
display: grid;
grid-template-columns: 40% 60%;
min-height: 400px;
overflow: hidden;
position: relative;
}
.esun-new-product__copy {
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 40px 0 40px 40px;
position: relative;
z-index: 2;
}
.esun-new-product__series {
color: var(--esun-new-product-green);
display: block;
font-size: 14px;
font-weight: 700;
margin-bottom: 16px;
}
.esun-new-product__copy h3 {
font-size: 26px;
font-weight: 700;
line-height: 1.2;
margin: 0;
}
.esun-new-product__copy h3 a {
color: #080808;
text-decoration: none;
}
.esun-new-product__image {
align-items: center;
display: flex;
justify-content: center;
min-width: 0;
position: relative;
z-index: 1;
}
.esun-new-product__image .product-image-container,
.esun-new-product__image .product-image-wrapper {
height: 100%;
width: 100% !important;
}
.esun-new-product__image .product-image-wrapper {
padding-bottom: 0 !important;
}
.esun-new-product__image .product-image-photo {
height: 100%;
inset: 0;
margin: auto;
max-height: 500px;
max-width: none;
object-fit: contain;
position: absolute;
width: 100%;
}
.esun-new-product__actions {
align-items: center;
display: flex;
gap: 20px;
}
.esun-new-product__actions form {
margin: 0;
}
.esun-new-product__buy,
.esun-new-product__cart {
align-items: center;
background: var(--esun-new-product-green);
border: 0;
box-shadow: none;
color: #fff;
display: inline-flex;
justify-content: center;
text-decoration: none;
}
.esun-new-product__buy {
border-radius: 24px;
font-size: 16px;
font-weight: 600;
height: 48px;
letter-spacing: 2px;
min-width: 150px;
padding: 0 28px;
color: #fff !important;
}
.esun-new-product__cart {
border-radius: 50%;
cursor: pointer;
height: 48px;
padding: 0;
width: 48px;
}
.esun-new-product__buy:hover,
.esun-new-product__buy:focus,
.esun-new-product__cart:hover,
.esun-new-product__cart:focus {
background: #208f4e;
color: #fff;
text-decoration: none;
}
.esun-new-product__cart svg {
fill: none;
height: 23px;
stroke: currentColor;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.7;
width: 23px;
}
.esun-new-product__content {
display: grid;
gap: 20px;
grid-template-rows: minmax(185px, auto) 1fr;
min-width: 0;
}
.esun-new-product__features {
min-height: 175px;
overflow: hidden;
padding: 30px 20px;
}
.esun-new-product__gallery
[data-content-type="row"][data-appearance="contained"] {
width: 100%;
}
.esun-new-product__features [data-content-type="row"],
.esun-new-product__features [data-content-type="row"] > div,
.esun-new-product__features [data-content-type="columns"],
.esun-new-product__features .pagebuilder-column-line {
min-height: 100%;
}
.esun-new-product__features .pagebuilder-column-line {
align-items: center;
}
.esun-new-product__gallery {
min-height: auto;
overflow: hidden;
}
.esun-new-product__gallery p {
margin-bottom: 0;
}
.esun-new-product__gallery > [data-content-type="row"],
.esun-new-product__gallery > [data-content-type="row"] > div,
.esun-new-product__gallery [data-content-type="columns"],
.esun-new-product__gallery .pagebuilder-column-line {
height: 100%;
}
.esun-new-product__gallery .pagebuilder-column-line {
gap: 20px;
}
.esun-new-product__gallery .pagebuilder-column {
border-radius: 32px;
overflow: hidden;
}
.esun-new-product__gallery figure,
.esun-new-product__gallery [data-content-type="image"] {
height: 100%;
margin: 0;
}
.esun-new-product__gallery img {
height: 100%;
object-fit: cover;
width: 100%;
display: block;
}
.esun-new-product__pagination {
bottom: 0 !important;
}
.esun-new-product__pagination .swiper-pagination-bullet {
background: #bfe4ce;
height: 8px;
opacity: 1;
transition:
width 0.2s ease,
background 0.2s ease;
width: 8px;
}
.esun-new-product__pagination .swiper-pagination-bullet-active {
background: var(--esun-new-product-green);
border-radius: 5px;
width: 26px;
}
.esun-new-product__previous,
.esun-new-product__next {
display: none;
}
.esun-new-product__visually-hidden {
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
.esun-new-product .product-image-wrapper {
overflow: hidden;
display: block;
}
.esun-new-product .product-image-photo {
transition: all 0.35s ease;
}
.esun-new-product .product-image-container:hover .product-image-photo {
transform: scale(1.08) translateY(-5px);
}
@media (max-width: 1023px) {
.esun-new-product__slide {
grid-template-columns: 1fr;
}
.esun-new-product__product-card {
min-height: 460px;
}
}
@media (max-width: 639px) {
.esun-new-product {
margin-top: 48px;
padding: 0 15px;
}
.esun-new-product__title {
font-size: 28px;
padding-top: 10px;
margin-bottom: 48px;
}
.esun-new-product__product-card {
border-radius: 24px;
grid-template-columns: 40% 60%;
min-height: 350px;
}
.esun-new-product__copy {
padding: 34px 0 30px 34px;
}
.esun-new-product__image {
bottom: 0;
height: 285px;
position: absolute;
right: -4%;
width: 64%;
}
.esun-new-product__actions {
gap: 12px;
}
.esun-new-product__buy {
min-width: 130px;
font-size: 14px;
}
.esun-new-product__features {
border-radius: 24px;
min-height: auto;
padding: 20px 16px;
}
.esun-new-product__content {
gap: 24px;
grid-template-rows: minmax(130px, auto) 250px;
}
.esun-new-product__features .pagebuilder-column-line {
display: grid !important;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.esun-new-product__features .pagebuilder-column {
min-width: 0;
width: 100% !important;
}
.esun-new-product__features table tr td {
padding: 4px 0;
}
.esun-new-product__features table tr td:first-child {
width: 42px;
}
.esun-new-product__features table tr td:last-child {
min-width: 0;
width: auto;
}
.esun-new-product__features table tr td img {
height: 34px !important;
width: 34px !important;
}
.esun-new-product__features table tr td h3 {
font-size: 15px;
line-height: 1.2;
}
.esun-new-product__features table tr td p {
font-size: 12px;
line-height: 1.2;
}
.esun-new-product__gallery {
min-height: 250px;
}
.esun-new-product__gallery .pagebuilder-column-line {
display: grid !important;
gap: 12px;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.esun-new-product__gallery .pagebuilder-column {
border-radius: 24px;
min-height: 250px;
width: 100% !important;
}
.esun-new-product__slider {
padding-bottom: 70px;
}
.esun-new-product__pagination {
bottom: 11px !important;
}
.esun-new-product__previous {
padding-right: 9px;
}
.esun-new-product__next {
padding-left: 9px;
}
.esun-new-product__previous,
.esun-new-product__next {
align-items: center;
border: 1px solid var(--esun-new-product-green);
border-radius: 50%;
bottom: 0;
box-shadow: none;
display: flex;
font-size: 28px;
height: 42px;
justify-content: center;
line-height: 1;
position: absolute;
width: 42px;
z-index: 11;
}
.esun-new-product__previous {
background: #fff;
color: var(--esun-new-product-green);
left: calc(50% - 130px);
}
.esun-new-product__next {
background: var(--esun-new-product-green);
color: #fff;
right: calc(50% - 130px);
}
}
@@ -0,0 +1,313 @@
.esun-news-room {
--news-green: #12ad5c;
box-sizing: border-box;
margin: 88px auto 0;
max-width: 1360px;
padding: 0 20px 80px;
}
/*.esun-news-room *,*/
/*.esun-news-room *::before,*/
/*.esun-news-room *::after {*/
/* box-sizing: border-box;*/
/*}*/
.esun-news-room__heading {
align-items: flex-start;
display: flex;
justify-content: space-between;
margin-bottom: 68px;
}
.esun-news-room__heading h2 {
color: #303030;
font-size: 38px;
font-weight: 700;
letter-spacing: 6px;
line-height: 1.1;
margin: 0;
position: relative;
text-transform: uppercase;
}
.esun-news-room__heading h2::after {
background: var(--news-green);
bottom: -24px;
content: "";
height: 2px;
left: 0;
position: absolute;
width: 70px;
}
.esun-news-room__navigation {
display: flex;
gap: 16px;
}
.esun-news-room__previous {
padding-right: 9px;
}
.esun-news-room__next {
padding-left: 9px;
}
.esun-news-room__previous,
.esun-news-room__next {
align-items: center;
background: #fff;
border: 1px solid rgba(18, 173, 92, 0.55);
border-radius: 50%;
box-shadow: none;
color: var(--news-green);
display: flex;
font-size: 34px;
height: 52px;
justify-content: center;
line-height: 1;
transition:
background 0.25s ease,
color 0.25s ease,
border-color 0.25s ease;
width: 52px;
}
.esun-news-room__previous:hover .arrow-left {
border-color: #fff;
}
.esun-news-room__next,
.esun-news-room__previous:hover,
.esun-news-room__next:hover {
background: var(--news-green);
border-color: var(--news-green);
color: #fff;
}
.esun-news-room__slider {
overflow: hidden;
padding-bottom: 54px;
}
.esun-news-room__page {
height: auto;
}
.esun-news-room__grid {
display: grid;
gap: 36px;
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.esun-news-room__card {
color: #1f1f1f;
display: block;
text-decoration: none;
}
.esun-news-room__card:visited,
.esun-news-room__card:hover,
.esun-news-room__card:focus,
.esun-news-room__card:active,
.esun-news-room__card:hover *,
.esun-news-room__card:focus *,
.esun-news-room__card:active * {
color: inherit;
text-decoration: none;
}
.esun-news-room__image-wrap {
border-radius: 22px;
display: block;
overflow: hidden;
position: relative;
}
.esun-news-room__image-wrap::before {
content: "";
display: block;
padding-top: 56.5%;
}
.esun-news-room__image {
height: 100%;
inset: 0;
object-fit: cover;
position: absolute;
transition: transform 0.35s ease;
width: 100%;
}
.esun-news-room__card:hover .esun-news-room__image {
transform: scale(1.04);
}
.esun-news-room__meta {
align-items: center;
display: grid;
gap: 14px;
grid-template-columns: auto minmax(0, 1fr);
margin: 20px 0 7px;
}
.esun-news-room__meta time {
color: var(--news-green);
font-size: 16px;
font-weight: 500;
letter-spacing: 0.5px;
}
.esun-news-room__category {
border: 1px solid #dfe7ef;
border-radius: 999px;
color: #738095;
display: inline-block;
font-size: 15px;
font-weight: 700;
justify-self: end;
letter-spacing: 2px;
line-height: 1.2;
max-width: 100%;
overflow: hidden;
padding: 3px 16px 4px;
text-overflow: ellipsis;
white-space: nowrap;
}
.esun-news-room__title {
color: #1f1f1f;
display: block;
font-size: 18px;
font-weight: 500;
line-height: 1.2;
}
.esun-news-room__pagination {
align-items: center;
bottom: 0;
display: flex;
gap: 18px;
justify-content: center;
position: absolute;
width: 100%;
}
.esun-news-room__pagination .swiper-pagination-bullet {
background: rgba(18, 173, 92, 0.25);
border-radius: 999px;
height: 8px;
margin: 0;
opacity: 1;
transition:
width 0.25s ease,
background 0.25s ease;
width: 8px;
}
.esun-news-room__pagination .swiper-pagination-bullet-active {
background: var(--news-green);
width: 32px;
}
@media (max-width: 1023px) {
.esun-news-room {
margin-top: 64px;
}
.esun-news-room__heading {
margin-bottom: 54px;
}
.esun-news-room__grid {
gap: 28px 22px;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 639px) {
.cms-home .esun-news-room {
margin-top: 56px;
padding: 0 0 56px;
}
.esun-news-room__heading {
align-items: center;
margin-bottom: 48px;
}
.esun-news-room__heading h2 {
font-size: 28px;
letter-spacing: 4px;
}
.esun-news-room__heading h2::after {
bottom: -16px;
width: 56px;
}
.esun-news-room__navigation {
display: flex;
gap: 12px;
}
.esun-news-room__previous,
.esun-news-room__next {
font-size: 28px;
height: 42px;
width: 42px;
}
.esun-news-room__slider {
padding-bottom: 46px;
}
.esun-news-room__grid {
gap: 28px;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.esun-news-room__image-wrap {
border-radius: 24px;
}
.esun-news-room__meta {
align-items: flex-start;
display: flex;
flex-direction: column;
gap: 9px;
margin: 14px 7px 12px;
}
.esun-news-room__meta time {
font-size: 14px;
}
.esun-news-room__category {
font-size: 13px;
font-weight: 400;
justify-self: auto;
letter-spacing: 0;
padding: 3px 10px;
}
.esun-news-room__title {
display: -webkit-box;
font-size: 16px;
font-weight: 600;
line-height: 1.45;
margin: 0 7px;
min-height: 46px;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.esun-news-room__pagination {
gap: 14px;
}
.esun-news-room__pagination .swiper-pagination-bullet {
height: 7px;
width: 7px;
}
.esun-news-room__pagination .swiper-pagination-bullet-active {
width: 27px;
}
}
@@ -0,0 +1,387 @@
.esun-resin {
--resin-green: #12ad5c;
box-sizing: border-box;
margin: 76px auto 0;
max-width: 1360px;
padding: 0 20px;
position: relative;
}
.esun-resin *,
.esun-resin *::before,
.esun-resin *::after {
box-sizing: border-box;
}
.esun-resin__heading {
align-items: flex-start;
display: flex;
justify-content: space-between;
margin-bottom: 36px;
}
.esun-resin__heading h2 {
color: #303030;
font-size: 36px;
font-weight: 700;
letter-spacing: 5px;
margin: 0;
position: relative;
text-transform: uppercase;
}
.esun-resin__heading h2::after {
background: var(--resin-green);
bottom: -20px;
content: "";
height: 2px;
left: 0;
position: absolute;
width: 56px;
}
.esun-resin__explore {
align-items: center;
color: var(--resin-green);
display: inline-flex;
flex: 0 0 auto;
font-size: 14px;
font-weight: 700;
gap: 12px;
margin-top: 35px;
text-decoration: none;
}
.esun-resin__explore:hover,
.esun-resin__explore:focus {
color: #0c914c;
text-decoration: none;
}
.esun-resin__explore span {
font-size: 18px;
line-height: 1;
}
.esun-resin__banner {
background-color: #e3f7fb;
background-position: left center;
background-repeat: no-repeat;
background-size: auto 100%;
border-radius: 40px;
min-height: 445px;
overflow: hidden;
padding: 42px 42px 42px 42%;
}
.esun-resin__products {
display: grid;
gap: 16px;
grid-template-columns: repeat(2, minmax(330px, 1fr));
list-style: none;
margin: 0;
overflow-x: auto;
padding: 0 0 3px;
}
.esun-resin__card {
background: #fff;
border-radius: 24px;
display: grid;
grid-template-columns: 130px minmax(0, 1fr);
min-height: 174px;
overflow: hidden;
padding: 22px 22px 22px 28px;
}
.esun-resin__image {
align-self: center;
display: block;
height: 130px;
overflow: hidden;
border-radius: 10px;
position: relative;
}
.esun-resin__image .product-image-container,
.esun-resin__image .product-image-wrapper {
height: 100%;
width: 100% !important;
}
.esun-resin__image .product-image-wrapper {
padding-bottom: 0 !important;
}
.esun-resin__image .product-image-photo {
height: 100%;
inset: 0;
margin: auto;
max-height: none;
object-fit: cover;
position: absolute;
width: 100%;
}
.esun-resin__details {
display: flex;
flex-direction: column;
min-width: 0;
padding: 2px 0 0 22px;
}
.esun-resin__details h3 {
font-size: 18px;
font-weight: 600;
margin: 0 0 10px;
}
.esun-resin__details h3 a {
color: #333;
text-decoration: none;
}
.esun-resin__details h3 a:hover,
.esun-resin__details h3 a:focus {
color: var(--resin-green);
text-decoration: none;
}
.esun-resin__description {
color: #252525;
display: -webkit-box;
font-size: 13px;
line-height: 1.25;
margin: 0 0 8px;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
}
.esun-resin__price {
align-items: baseline;
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.esun-resin__final-price {
color: var(--resin-green);
font-size: 22px;
font-weight: 600;
}
.esun-resin__regular-price {
color: #98a5ae;
font-size: 14px;
text-decoration: line-through;
}
.esun-resin__footer {
align-items: center;
display: flex;
justify-content: space-between;
margin-top: auto;
min-height: 40px;
padding-top: 10px;
}
.esun-resin__swatches {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: 8px;
min-width: 0;
}
.esun-resin__swatch {
background: #fff;
border: 1px solid #cfcfcf;
border-radius: 50%;
display: inline-flex;
height: 16px;
overflow: hidden;
padding: 1px;
width: 16px;
}
.esun-resin__swatch > span,
.esun-resin__swatch img {
border-radius: 50%;
height: 100%;
object-fit: cover;
width: 100%;
}
.esun-resin__swatch-more {
color: #a4a4a4;
font-size: 12px;
line-height: 16px;
}
.esun-resin__cart {
align-items: center;
background: var(--resin-green);
border-radius: 50%;
color: #fff !important;
display: inline-flex;
flex: 0 0 40px;
height: 40px;
justify-content: center;
margin-left: 12px;
text-decoration: none;
width: 40px;
}
.esun-resin__cart:hover,
.esun-resin__cart:focus {
background: #0c914c;
color: #fff;
text-decoration: none;
}
.esun-resin__cart svg {
fill: none;
height: 20px;
stroke: currentColor;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.7;
width: 20px;
}
.esun-resin__visually-hidden {
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
@media (max-width: 1199px) {
.esun-resin__banner {
padding-left: 34%;
}
.esun-resin__products {
grid-template-columns: repeat(2, minmax(360px, 1fr));
}
}
@media (max-width: 899px) {
.esun-resin__banner {
padding-left: 28%;
}
}
@media (max-width: 992px) {
.esun-resin {
margin-top: 48px;
padding: 0 15px;
}
.esun-resin__heading {
align-items: center;
margin-bottom: 42px;
}
.esun-resin__heading h2 {
font-size: 28px;
letter-spacing: 3px;
}
.esun-resin__explore {
font-size: 13px;
gap: 7px;
margin-top: 0;
}
.esun-resin__banner {
background-position: center left;
background-size: cover;
border-radius: 28px;
min-height: 0;
padding: clamp(170px, 30vw, 205px) 0 28px 30px;
}
.esun-resin__products {
display: grid;
gap: 28px;
grid-auto-columns: min(466px, calc(100vw - 90px));
grid-auto-flow: column;
grid-template-columns: none;
grid-template-rows: repeat(2, minmax(0, 1fr));
overscroll-behavior-inline: contain;
padding-right: 30px;
scrollbar-width: none;
scroll-snap-type: x proximity;
-webkit-overflow-scrolling: touch;
}
.esun-resin__products::-webkit-scrollbar {
display: none;
}
.esun-resin__item {
min-width: 0;
scroll-snap-align: start;
}
.esun-resin__card {
grid-template-columns: clamp(105px, 24vw, 155px) minmax(0, 1fr);
height: 100%;
min-height: clamp(160px, 30vw, 205px);
padding: clamp(16px, 3vw, 22px);
}
.esun-resin__image {
height: clamp(115px, 23vw, 155px);
}
.esun-resin__details {
padding-left: clamp(14px, 3vw, 22px);
}
.esun-resin__details h3 {
font-size: clamp(18px, 3.6vw, 24px);
margin-bottom: 5px;
}
.esun-resin__description {
font-size: clamp(13px, 2.5vw, 17px);
margin-bottom: 6px;
}
.esun-resin__final-price {
font-size: clamp(20px, 3.6vw, 24px);
}
.esun-resin__regular-price {
font-size: clamp(12px, 2.3vw, 15px);
}
.esun-resin__footer {
padding-top: 7px;
}
.esun-resin__swatches {
flex-wrap: nowrap;
gap: clamp(6px, 1.6vw, 10px);
overflow: hidden;
}
.esun-resin__swatch {
flex: 0 0 clamp(18px, 4.5vw, 32px);
height: clamp(18px, 4.5vw, 32px);
width: clamp(18px, 4.5vw, 32px);
}
.esun-resin__cart {
flex-basis: clamp(40px, 7.5vw, 54px);
height: clamp(40px, 7.5vw, 54px);
margin-left: 8px;
width: clamp(40px, 7.5vw, 54px);
}
}
@@ -0,0 +1,169 @@
@keyframes bounce {
0% {
transform: translateY(0);
}
30% {
transform: translateY(-10px);
}
50% {
transform: translateY(0);
}
70% {
transform: translateY(-5px);
}
100% {
transform: translateY(0);
}
}
.esun-resources-downloads {
--resources-green: #12ad5c;
box-sizing: border-box;
margin: 88px auto 0;
max-width: 1360px;
padding: 0 20px 70px;
}
.esun-resources-downloads *,
.esun-resources-downloads *::before,
.esun-resources-downloads *::after {
box-sizing: border-box;
}
.esun-resources-downloads h2 {
color: #303030;
font-size: 38px;
font-weight: 700;
letter-spacing: 6px;
margin: 0 0 96px;
position: relative;
text-transform: uppercase;
}
.esun-resources-downloads h2::after {
background: var(--resources-green);
bottom: -24px;
content: "";
height: 2px;
left: 0;
position: absolute;
width: 70px;
}
.esun-resources-downloads__items {
display: grid;
gap: 28px;
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.esun-resources-downloads__item {
align-items: center;
background: #eff9f1;
border: 1px solid #d9ecdc;
border-radius: 12px;
display: flex;
flex-direction: column;
height: 250px;
justify-content: flex-end;
overflow: hidden;
padding: 28px 26px 34px;
position: relative;
}
.esun-resources-downloads__link {
align-items: center;
background: #fff;
border-radius: 50%;
color: #111;
display: flex;
font-size: 25px;
height: 48px;
justify-content: center;
line-height: 1;
position: absolute;
right: 18px;
text-decoration: none;
top: 18px;
width: 48px;
z-index: 2;
transition: all 0.5s ease-in-out;
}
.esun-resources-downloads__link:hover,
.esun-resources-downloads__link:focus {
text-decoration: none;
transform: rotate(45deg);
background-color: #18a957;
color: #fff;
}
.esun-resources-downloads__link--disabled {
cursor: default;
}
.esun-resources-downloads__image {
height: 145px;
margin-bottom: 10px;
max-width: 82%;
object-fit: contain;
width: auto;
}
img.esun-resources-downloads__image:hover {
animation: bounce 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}
.esun-resources-downloads__item h3 {
color: var(--resources-green);
font-size: 21px;
font-weight: 700;
line-height: 1.2;
margin: 0;
text-align: center;
}
@media (max-width: 1023px) {
.esun-resources-downloads__items {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 639px) {
.esun-resources-downloads {
margin-top: 56px;
padding: 0 15px 48px;
}
.esun-resources-downloads h2 {
font-size: 27px;
letter-spacing: 3px;
margin-bottom: 68px;
}
.esun-resources-downloads__items {
gap: 12px;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.esun-resources-downloads__item {
border-radius: 10px;
height: clamp(160px, 48vw, 190px);
padding: 18px 10px 20px;
}
.esun-resources-downloads__link {
font-size: 18px;
height: 34px;
right: 10px;
top: 10px;
width: 34px;
}
.esun-resources-downloads__image {
height: clamp(85px, 27vw, 120px);
margin-bottom: 6px;
max-width: 88%;
}
.esun-resources-downloads__item h3 {
font-size: clamp(13px, 3.5vw, 17px);
line-height: 1.15;
}
}
@@ -0,0 +1,50 @@
define([], function () {
'use strict';
return function (config, element) {
var activeItem = null;
var interactiveItems = element.querySelectorAll(
'.esun-application__item--interactive'
);
function activate(item) {
if (activeItem && activeItem !== item) {
activeItem.classList.remove('is-active');
}
activeItem = item;
element.classList.add('has-active-item');
item.classList.add('is-active');
}
function deactivate(item) {
if (activeItem !== item) {
return;
}
item.classList.remove('is-active');
element.classList.remove('has-active-item');
activeItem = null;
}
interactiveItems.forEach(function (item) {
item.addEventListener('mouseenter', function () {
activate(item);
});
item.addEventListener('mouseleave', function () {
deactivate(item);
});
item.addEventListener('focusin', function () {
activate(item);
});
item.addEventListener('focusout', function (event) {
if (!item.contains(event.relatedTarget)) {
deactivate(item);
}
});
});
};
});
@@ -0,0 +1,36 @@
define([
'Swiper'
], function (Swiper) {
'use strict';
return function (config, element) {
var hasNavigation = element.getAttribute('data-has-navigation') === 'true';
new Swiper(element, {
centeredSlides: true,
initialSlide: 0,
loop: hasNavigation,
slidesPerView: 1.12,
spaceBetween: 0,
observer: true,
observeParents: true,
watchOverflow: true,
breakpoints: {
640: {
slidesPerView: 1.35,
spaceBetween: 0
},
1024: {
slidesPerView: 1.72,
spaceBetween: 0
}
},
navigation: hasNavigation ? {
nextEl: element.closest('.esun-awards-reviews')
.querySelector('.esun-awards-reviews__next'),
prevEl: element.closest('.esun-awards-reviews')
.querySelector('.esun-awards-reviews__previous')
} : {}
});
};
});
@@ -0,0 +1,35 @@
define([], function () {
'use strict';
return function (config, element) {
var end = new Date(element.getAttribute('data-end')).getTime();
var timer;
function setValue(unit, value) {
var target = element.querySelector('[data-time="' + unit + '"]');
if (target) {
target.textContent = String(Math.max(0, value)).padStart(2, '0');
}
}
function update() {
var distance = Math.max(0, end - Date.now());
setValue('days', Math.floor(distance / 86400000));
setValue('hours', Math.floor((distance % 86400000) / 3600000));
setValue('minutes', Math.floor((distance % 3600000) / 60000));
setValue('seconds', Math.floor((distance % 60000) / 1000));
if (distance === 0 && timer) {
window.clearInterval(timer);
}
}
if (!Number.isFinite(end)) {
return;
}
update();
timer = window.setInterval(update, 1000);
};
});
@@ -0,0 +1,39 @@
define([
'Swiper'
], function (Swiper) {
'use strict';
return function (config, element) {
var hasNavigation = element.getAttribute('data-has-navigation') === 'true';
if (window.matchMedia('(max-width: 639px)').matches) {
return;
}
new Swiper(element, {
slidesPerView: 1.26,
spaceBetween: 12,
observer: true,
observeParents: true,
watchOverflow: true,
breakpoints: {
768: {
slidesPerView: 2,
spaceBetween: 20
},
1024: {
slidesPerView: 4,
spaceBetween: 28
}
},
navigation: hasNavigation ? {
nextEl: element.querySelector('.esun-create-anything__next'),
prevEl: element.querySelector('.esun-create-anything__previous')
} : {},
pagination: hasNavigation ? {
el: element.querySelector('.esun-create-anything__pagination'),
clickable: true
} : {}
});
};
});
@@ -0,0 +1,22 @@
define([
'Swiper'
], function (Swiper) {
'use strict';
return function (config, element) {
if (element.getAttribute('data-has-pagination') !== 'true') {
return;
}
new Swiper(element, {
autoHeight: true,
allowTouchMove: true,
observer: true,
observeParents: true,
pagination: {
el: element.querySelector('.esun-hot-sale__pagination'),
clickable: true
}
});
};
});
@@ -0,0 +1,50 @@
define([], function () {
'use strict';
return function (config, element) {
var activeItem = null;
var interactiveItems = element.querySelectorAll(
'.esun-innovative-materials__item--interactive'
);
function activate(item) {
if (activeItem && activeItem !== item) {
activeItem.classList.remove('is-active');
}
activeItem = item;
element.classList.add('has-active-item');
item.classList.add('is-active');
}
function deactivate(item) {
if (activeItem !== item) {
return;
}
item.classList.remove('is-active');
element.classList.remove('has-active-item');
activeItem = null;
}
interactiveItems.forEach(function (item) {
item.addEventListener('mouseenter', function () {
activate(item);
});
item.addEventListener('mouseleave', function () {
deactivate(item);
});
item.addEventListener('focusin', function () {
activate(item);
});
item.addEventListener('focusout', function (event) {
if (!item.contains(event.relatedTarget)) {
deactivate(item);
}
});
});
};
});
@@ -0,0 +1,40 @@
define([], function () {
'use strict';
return function (config, element) {
var video = element.querySelector('video');
if (!video) {
return;
}
function playVideo() {
try {
video.currentTime = 0;
} catch (error) {}
element.classList.add('is-playing');
video.play().catch(function () {});
}
function stopVideo() {
video.pause();
element.classList.remove('is-playing');
}
element.addEventListener('mouseenter', playVideo);
element.addEventListener('mouseleave', stopVideo);
element.addEventListener('click', function (event) {
if (event.target.closest('a')) {
return;
}
if (video.paused) {
playVideo();
} else {
stopVideo();
}
});
};
});
@@ -0,0 +1,22 @@
define([
'Swiper'
], function (Swiper) {
'use strict';
return function (config, element) {
new Swiper(element, {
autoHeight: true,
loop: element.querySelectorAll('.swiper-slide').length > 1,
observer: true,
observeParents: true,
navigation: {
nextEl: element.querySelector('.esun-new-product__next'),
prevEl: element.querySelector('.esun-new-product__previous')
},
pagination: {
el: element.querySelector('.esun-new-product__pagination'),
clickable: true
}
});
};
});
@@ -0,0 +1,27 @@
define([
'Swiper'
], function (Swiper) {
'use strict';
return function (config, element) {
var hasNavigation = element.getAttribute('data-has-navigation') === 'true';
var container = element.closest('.esun-news-room');
new Swiper(element, {
slidesPerView: 1,
slidesPerGroup: 1,
spaceBetween: 36,
observer: true,
observeParents: true,
watchOverflow: true,
navigation: hasNavigation ? {
nextEl: container.querySelector('.esun-news-room__next'),
prevEl: container.querySelector('.esun-news-room__previous')
} : {},
pagination: hasNavigation ? {
el: element.querySelector('.esun-news-room__pagination'),
clickable: true
} : {}
});
};
});
@@ -0,0 +1,125 @@
define([], function () {
'use strict';
function getImage(card) {
var imageWrap = card.querySelector('[data-role=esun-product-image]');
return imageWrap ? imageWrap.querySelector('img') : null;
}
function rememberDefaultImage(image) {
if (!image || image.getAttribute('data-default-src')) {
return;
}
image.setAttribute('data-default-src', image.getAttribute('src') || '');
image.setAttribute('data-default-srcset', image.getAttribute('srcset') || '');
}
function setImage(image, url) {
if (!image || !url) {
return;
}
rememberDefaultImage(image);
image.setAttribute('src', url);
image.removeAttribute('srcset');
}
function restoreImage(image) {
var defaultSrc;
var defaultSrcset;
if (!image) {
return;
}
defaultSrc = image.getAttribute('data-default-src') || '';
defaultSrcset = image.getAttribute('data-default-srcset') || '';
if (defaultSrc) {
image.setAttribute('src', defaultSrc);
}
if (defaultSrcset) {
image.setAttribute('srcset', defaultSrcset);
} else {
image.removeAttribute('srcset');
}
}
return function (config, element) {
element.querySelectorAll('[data-role=esun-product-card]').forEach(function (card) {
var image = getImage(card);
var handledSwatches = new WeakSet();
if (!image) {
return;
}
rememberDefaultImage(image);
card.querySelectorAll('[data-role=esun-product-swatches]').forEach(function (swatches) {
swatches.querySelectorAll('[data-child-image], [data-product-image]').forEach(function (swatch) {
handledSwatches.add(swatch);
swatch.addEventListener('mouseenter', function () {
setImage(
image,
swatch.getAttribute('data-child-image') ||
swatch.getAttribute('data-product-image')
);
});
swatch.addEventListener('focus', function () {
setImage(
image,
swatch.getAttribute('data-child-image') ||
swatch.getAttribute('data-product-image')
);
});
});
swatches.addEventListener('mouseleave', function () {
restoreImage(image);
});
swatches.addEventListener('focusout', function (event) {
if (!event.relatedTarget || !swatches.contains(event.relatedTarget)) {
restoreImage(image);
}
});
});
card.querySelectorAll('[data-child-image], [data-product-image]').forEach(function (swatch) {
if (handledSwatches.has(swatch)) {
return;
}
swatch.addEventListener('mouseenter', function () {
setImage(
image,
swatch.getAttribute('data-child-image') ||
swatch.getAttribute('data-product-image')
);
});
swatch.addEventListener('focus', function () {
setImage(
image,
swatch.getAttribute('data-child-image') ||
swatch.getAttribute('data-product-image')
);
});
swatch.addEventListener('mouseleave', function () {
restoreImage(image);
});
swatch.addEventListener('blur', function () {
restoreImage(image);
});
});
});
};
});
@@ -0,0 +1,74 @@
define([], function () {
'use strict';
return function (config, element) {
var video = element.querySelector('video');
var isPlaying = false;
if (!video || element.getAttribute('data-video-hover-bound') === 'true') {
return;
}
element.setAttribute('data-video-hover-bound', 'true');
video.muted = true;
video.playsInline = true;
video.setAttribute('muted', 'muted');
video.setAttribute('playsinline', 'playsinline');
function playVideo() {
if (isPlaying) {
return;
}
isPlaying = true;
try {
video.currentTime = 0;
} catch (error) {}
element.classList.add('is-playing');
video.play().catch(function () {
isPlaying = false;
element.classList.remove('is-playing');
});
}
function stopVideo() {
isPlaying = false;
video.pause();
try {
video.currentTime = 0;
} catch (error) {}
element.classList.remove('is-playing');
}
element.addEventListener('mouseover', function (event) {
if (element.contains(event.relatedTarget)) {
return;
}
playVideo();
});
element.addEventListener('mouseout', function (event) {
if (element.contains(event.relatedTarget)) {
return;
}
stopVideo();
});
element.addEventListener('pointerenter', playVideo);
element.addEventListener('pointerleave', stopVideo);
element.addEventListener('touchstart', function (event) {
if (event.target.closest('a')) {
return;
}
playVideo();
}, {passive: true});
};
});