init
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/** @var \Magento\Checkout\Block\Cart\Shipping $block */
|
||||
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
|
||||
|
||||
$script = sprintf(
|
||||
'window.checkoutConfig = %s; window.customerData = window.checkoutConfig.customerData; window.isCustomerLoggedIn = window.checkoutConfig.isCustomerLoggedIn;',
|
||||
$block->getSerializedCheckoutConfig()
|
||||
);
|
||||
?>
|
||||
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $script, false) ?>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Coupon form displayed immediately above the cart checkout button.
|
||||
*
|
||||
* @var \Esun\Cart\Block\Cart\Coupon $block
|
||||
* @var \Magento\Framework\Escaper $escaper
|
||||
*/
|
||||
$couponCode = (string)$block->getCouponCode();
|
||||
$hasCouponCode = $couponCode !== '';
|
||||
?>
|
||||
<div class="esun-coupon esun-coupon--cart">
|
||||
<div class="esun-coupon__title"><?= $escaper->escapeHtml(__('Discount Code')) ?></div>
|
||||
<form class="esun-coupon__form"
|
||||
data-role="esun-coupon-form"
|
||||
data-save-url="<?= $escaper->escapeUrl($block->getUrl('esun_cart/coupon/save')) ?>">
|
||||
<?= /* @noEscape */ $block->getBlockHtml('formkey') ?>
|
||||
<?php if (!$hasCouponCode): ?>
|
||||
<label class="esun-coupon__label" for="esun-cart-coupon-code">
|
||||
<span><?= $escaper->escapeHtml(__('Enter discount code')) ?></span>
|
||||
</label>
|
||||
<div class="esun-coupon__controls">
|
||||
<input class="input-text esun-coupon__input"
|
||||
id="esun-cart-coupon-code"
|
||||
name="coupon_code"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
maxlength="255"
|
||||
placeholder="<?= $escaper->escapeHtmlAttr(__('Enter discount code')) ?>"/>
|
||||
<button class="action esun-coupon__button" type="submit">
|
||||
<span><?= $escaper->escapeHtml(__('Apply')) ?></span>
|
||||
</button>
|
||||
<button class="action esun-coupon__picker-button"
|
||||
type="button"
|
||||
aria-haspopup="dialog"
|
||||
data-role="open-coupon-picker">
|
||||
<span><?= $escaper->escapeHtml(__('My Coupons')) ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="esun-coupon__applied">
|
||||
<span>
|
||||
<?= $escaper->escapeHtml(__('Applied:')) ?>
|
||||
<strong><?= $escaper->escapeHtml($couponCode) ?></strong>
|
||||
</span>
|
||||
<button class="action esun-coupon__remove"
|
||||
type="submit"
|
||||
name="remove"
|
||||
value="1">
|
||||
<span><?= $escaper->escapeHtml(__('Cancel')) ?></span>
|
||||
</button>
|
||||
<button class="action esun-coupon__picker-button"
|
||||
type="button"
|
||||
aria-haspopup="dialog"
|
||||
data-role="open-coupon-picker">
|
||||
<span><?= $escaper->escapeHtml(__('My Coupons')) ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="esun-coupon__message" data-role="esun-coupon-message" aria-live="polite"></div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/** @var \Magento\Checkout\Block\Cart\Item\Renderer $block */
|
||||
$_item = $block->getItem();
|
||||
$product = $_item->getProduct();
|
||||
/** @var \Magento\Msrp\Helper\Data $msrpHelper */
|
||||
$msrpHelper = $this->helper(\Magento\Msrp\Helper\Data::class);
|
||||
$canApplyMsrp = $msrpHelper->isShowBeforeOrderConfirm($product)
|
||||
&& $msrpHelper->isMinimalPriceLessMsrp($product);
|
||||
$isFreeGift = (bool)$_item->getData('is_esun_free_gift');
|
||||
?>
|
||||
<tbody class="cart item esun-cart-page-item<?= $isFreeGift ? ' esun-cart-page-item--free-gift' : '' ?>">
|
||||
<tr class="item-info">
|
||||
<td colspan="4" class="esun-cart-page-item__cell">
|
||||
<article class="esun-cart-page-item__card">
|
||||
<?php if ($block->hasProductUrl() && !$isFreeGift): ?>
|
||||
<a href="<?= $block->escapeUrl($block->getProductUrl()) ?>"
|
||||
title="<?= $block->escapeHtmlAttr($block->getProductName()) ?>"
|
||||
class="esun-cart-page-item__photo">
|
||||
<?php else: ?>
|
||||
<span class="esun-cart-page-item__photo">
|
||||
<?php endif; ?>
|
||||
<?= $block->getImage($block->getProductForThumbnail(), 'cart_page_product_thumbnail')->toHtml() ?>
|
||||
<?php if ($block->hasProductUrl() && !$isFreeGift): ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="esun-cart-page-item__details">
|
||||
<strong class="esun-cart-page-item__name">
|
||||
<?php if ($block->hasProductUrl() && !$isFreeGift): ?>
|
||||
<a href="<?= $block->escapeUrl($block->getProductUrl()) ?>">
|
||||
<?= $block->escapeHtml($block->getProductName()) ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<?= $block->escapeHtml($block->getProductName()) ?>
|
||||
<?php endif; ?>
|
||||
</strong>
|
||||
|
||||
<?php if ($isFreeGift): ?>
|
||||
<span class="esun-free-gift-label"><?= $block->escapeHtml(__('Free Gift')) ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($_options = $block->getOptionList()): ?>
|
||||
<dl class="esun-cart-page-item__options">
|
||||
<?php foreach ($_options as $_option): ?>
|
||||
<?php $_formattedOptionValue = $block->getFormatedOptionValue($_option); ?>
|
||||
<div class="esun-cart-page-item__option">
|
||||
<dt><?= $block->escapeHtml($_option['label']) ?>:</dt>
|
||||
<dd>
|
||||
<?php if (isset($_formattedOptionValue['full_view'])): ?>
|
||||
<?= $block->escapeHtml($_formattedOptionValue['full_view'], ['span', 'a']) ?>
|
||||
<?php else: ?>
|
||||
<?= $block->escapeHtml($_formattedOptionValue['value'], ['span', 'a']) ?>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</dl>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($messages = $block->getMessages()): ?>
|
||||
<?php foreach ($messages as $message): ?>
|
||||
<div class="message <?= $block->escapeHtmlAttr($message['type']) ?>">
|
||||
<div><?= $block->escapeHtml($message['text']) ?></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($isFreeGift): ?>
|
||||
<div class="esun-cart-page-item__qty esun-cart-page-item__qty--locked">
|
||||
<span><?= $block->escapeHtml(__('Qty')) ?>:</span>
|
||||
<strong><?= $block->escapeHtml($block->getQty()) ?></strong>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="esun-cart-page-item__qty" data-role="qty-box">
|
||||
<button type="button"
|
||||
class="esun-cart-page-item__qty-button"
|
||||
data-esun-qty-change="-1"
|
||||
aria-label="<?= $block->escapeHtmlAttr(__('Decrease quantity')) ?>">−</button>
|
||||
<input id="cart-<?= $block->escapeHtmlAttr($_item->getId()) ?>-qty"
|
||||
name="cart[<?= $block->escapeHtmlAttr($_item->getId()) ?>][qty]"
|
||||
data-cart-item-id="<?= $block->escapeHtmlAttr($_item->getSku()) ?>"
|
||||
value="<?= $block->escapeHtmlAttr($block->getQty()) ?>"
|
||||
type="number"
|
||||
min="1"
|
||||
step="any"
|
||||
title="<?= $block->escapeHtmlAttr(__('Qty')) ?>"
|
||||
class="input-text qty"
|
||||
data-validate="{required:true,'validate-greater-than-zero':true}"
|
||||
data-item-qty="<?= $block->escapeHtmlAttr($block->getQty()) ?>"
|
||||
data-role="cart-item-qty"/>
|
||||
<button type="button"
|
||||
class="esun-cart-page-item__qty-button"
|
||||
data-esun-qty-change="1"
|
||||
aria-label="<?= $block->escapeHtmlAttr(__('Increase quantity')) ?>">+</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="esun-cart-page-item__actions">
|
||||
<?php if (!$isFreeGift): ?>
|
||||
<?= /* @noEscape */ $block->getActions($_item) ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="esun-cart-page-item__price">
|
||||
<?php if ($isFreeGift): ?>
|
||||
<strong><?= $block->escapeHtml(__('Free')) ?></strong>
|
||||
<?php elseif ($canApplyMsrp): ?>
|
||||
<span><?= $block->escapeHtml(__('See price before order confirmation.')) ?></span>
|
||||
<?php else: ?>
|
||||
<?= /* @noEscape */ $block->getRowTotalHtml($_item) ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</article>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/** @var \Magento\Checkout\Block\Cart\Sidebar $block */
|
||||
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
|
||||
?>
|
||||
<div data-block="minicart" class="minicart-wrapper esun-cart-wrapper">
|
||||
<button type="button"
|
||||
class="action showcart"
|
||||
data-bind="scope: 'minicart_content'"
|
||||
aria-haspopup="dialog"
|
||||
aria-expanded="false"
|
||||
aria-label="<?= $block->escapeHtmlAttr(__('Open shopping cart')) ?>">
|
||||
<span class="text"><?= $block->escapeHtml(__('My Cart')) ?></span>
|
||||
<span class="counter qty empty"
|
||||
data-bind="css: { empty: !getCartParam('summary_count') && !isLoading() }, blockLoader: isLoading">
|
||||
<span class="counter-number">
|
||||
<!-- ko if: getCartParam('summary_count') -->
|
||||
<!-- ko text: getCartParam('summary_count').toLocaleString(window.LOCALE) --><!-- /ko -->
|
||||
<!-- /ko -->
|
||||
</span>
|
||||
<span class="counter-label">
|
||||
<!-- ko i18n: 'items' --><!-- /ko -->
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
|
||||
<button type="button"
|
||||
class="esun-cart-backdrop"
|
||||
data-role="esun-cart-backdrop"
|
||||
aria-label="<?= $block->escapeHtmlAttr(__('Close shopping cart')) ?>"></button>
|
||||
<div class="block block-minicart esun-cart-drawer"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="esun-cart-title"
|
||||
data-role="dropdownDialog"
|
||||
data-mage-init='{"dropdownDialog":{"appendTo":"[data-block=minicart]","triggerTarget":".showcart","timeout":"2000","closeOnMouseLeave":false,"closeOnEscape":true,"triggerClass":"active","parentClass":"active","buttons":[]}}'>
|
||||
<div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<?= $block->getChildHtml('minicart.addons') ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php
|
||||
$scriptString = <<<script
|
||||
require(['jquery'], function ($) {
|
||||
$('a.action.showcart').on('click', function () {
|
||||
$(document.body).trigger('processStart');
|
||||
});
|
||||
});
|
||||
script;
|
||||
?>
|
||||
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= /* @noEscape */ $secureRenderer->renderTag(
|
||||
'script',
|
||||
[],
|
||||
'window.checkout = ' . $block->getSerializedConfig(),
|
||||
false
|
||||
) ?>
|
||||
<script type="text/x-magento-init">
|
||||
{
|
||||
"[data-block='minicart']": {
|
||||
"Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?>
|
||||
},
|
||||
"*": {
|
||||
"Magento_Ui/js/block-loader": "<?= $block->escapeJs(
|
||||
$block->escapeUrl($block->getViewFileUrl('images/loader-1.gif'))
|
||||
) ?>"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/** @var \Magento\Framework\View\Element\Template $block */
|
||||
?>
|
||||
<div class="esun-cart-page-services">
|
||||
<section class="esun-cart-page-service esun-cart-page-service--payment">
|
||||
<h2><?= $block->escapeHtml(__('Payment & Security')) ?></h2>
|
||||
<?= /* @noEscape */ $block->getChildHtml('payment_security') ?>
|
||||
</section>
|
||||
<div class="esun-cart-page-service--delivery esun-product-accordion">
|
||||
<details class="esun-product-accordion__item" open>
|
||||
<summary class="esun-product-accordion__summary">
|
||||
<span><?= $block->escapeHtml(__('Delivery and Shipping')) ?></span>
|
||||
</summary>
|
||||
<div class="esun-product-accordion__content">
|
||||
<?= /* @noEscape */ $block->getChildHtml('delivery_shipping') ?>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/** @var \Magento\Checkout\Block\Cart $block */
|
||||
$itemsSummaryQty = (float)$block->getItemsSummaryQty();
|
||||
$displayQty = fmod($itemsSummaryQty, 1.0) === 0.0
|
||||
? (string)(int)$itemsSummaryQty
|
||||
: (string)$itemsSummaryQty;
|
||||
?>
|
||||
<div class="esun-cart-page">
|
||||
<header class="esun-cart-page__header">
|
||||
<h1><?= $block->escapeHtml(__('My Shopping Cart')) ?> <span>(<?= $block->escapeHtml($displayQty) ?>)</span></h1>
|
||||
<a class="esun-cart-page__continue"
|
||||
href="<?= $block->escapeUrl($block->getContinueShoppingUrl()) ?>">
|
||||
<?= $block->escapeHtml(__('Continue Shopping')) ?>
|
||||
</a>
|
||||
</header>
|
||||
|
||||
<?= /* @noEscape */ $block->getChildHtml('vat_prompt') ?>
|
||||
|
||||
<?php if ($block->getItemsCount()): ?>
|
||||
<?= /* @noEscape */ $block->getChildHtml('with-items') ?>
|
||||
<?php else: ?>
|
||||
<?= /* @noEscape */ $block->getChildHtml('no-items') ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= /* @noEscape */ $block->getChildHtml('recommended_products') ?>
|
||||
</div>
|
||||
|
||||
<script type="text/x-magento-init">
|
||||
{
|
||||
".esun-cart-page": {
|
||||
"Esun_Cart/js/cart-page": {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/** @var \Esun\Cart\Block\Cart\RecommendedProducts $block */
|
||||
/** @var \Magento\Framework\Escaper $escaper */
|
||||
|
||||
use Magento\Framework\App\ActionInterface;
|
||||
|
||||
$items = $block->getRecommendedItems();
|
||||
$urlEncodedParamName = ActionInterface::PARAM_NAME_URL_ENCODED;
|
||||
/** @var \Esun\Catalog\ViewModel\Category\ProductCard|null $cardViewModel */
|
||||
$cardViewModel = $block->getData('cardViewModel');
|
||||
/** @var \Magento\Catalog\ViewModel\Product\OptionsData|null $optionsViewModel */
|
||||
$optionsViewModel = $block->getData('viewModel');
|
||||
?>
|
||||
<?php if ($items): ?>
|
||||
<section class="esun-cart-recommended esun-recommended-products"
|
||||
aria-labelledby="cart-recommendations-title"
|
||||
data-mage-init='{"Esun_Cart/js/recommendations-carousel":{},"esunCategoryCard":{}}'>
|
||||
<div class="esun-recommended-products__heading">
|
||||
<h2 id="cart-recommendations-title"><?= $escaper->escapeHtml(__('You may also like')) ?></h2>
|
||||
<div class="esun-recommended-products__navigation"
|
||||
aria-label="<?= $escaper->escapeHtmlAttr(__('Recommendation navigation')) ?>">
|
||||
<button class="esun-recommended-products__previous" type="button"
|
||||
aria-label="<?= $escaper->escapeHtmlAttr(__('Previous products')) ?>">‹</button>
|
||||
<button class="esun-recommended-products__next" type="button"
|
||||
aria-label="<?= $escaper->escapeHtmlAttr(__('Next products')) ?>">›</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="esun-recommended-products__slider" tabindex="0">
|
||||
<div class="esun-recommended-products__wrapper">
|
||||
<?php foreach ($items as $item): ?>
|
||||
<?php
|
||||
$productUrl = $block->getProductUrl($item);
|
||||
$discountPercent = $block->getDiscountPercent($item);
|
||||
$colorSwatches = $cardViewModel ? $cardViewModel->getColorSwatches($item) : [];
|
||||
$visibleSwatches = array_slice($colorSwatches, 0, 11);
|
||||
$remainingSwatches = max(0, count($colorSwatches) - count($visibleSwatches));
|
||||
$categoryLabels = $cardViewModel
|
||||
? array_slice($cardViewModel->getCategoryLabels($item), 0, 2)
|
||||
: [];
|
||||
?>
|
||||
<article class="product-item-info esun-category-card esun-recommended-products__item">
|
||||
<a class="product photo product-item-photo esun-category-card__image
|
||||
esun-recommended-products__image"
|
||||
href="<?= $escaper->escapeUrl($productUrl) ?>"
|
||||
aria-label="<?= $escaper->escapeHtmlAttr($item->getName()) ?>">
|
||||
<?php if ($discountPercent !== null): ?>
|
||||
<span class="esun-category-card__badge">
|
||||
<?= (int)$discountPercent ?>% <?= $escaper->escapeHtml(__('OFF')) ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?= /* @noEscape */ $block->getImage($item, 'category_page_grid')->toHtml() ?>
|
||||
</a>
|
||||
<div class="product details product-item-details esun-category-card__details
|
||||
esun-recommended-products__body">
|
||||
<h3 class="product name product-item-name esun-category-card__name
|
||||
esun-recommended-products__name">
|
||||
<a class="product-item-link" href="<?= $escaper->escapeUrl($productUrl) ?>">
|
||||
<?= $escaper->escapeHtml($item->getName()) ?>
|
||||
</a>
|
||||
</h3>
|
||||
<?php if ($categoryLabels): ?>
|
||||
<div class="esun-category-card__tags">
|
||||
<?php foreach ($categoryLabels as $categoryLabel): ?>
|
||||
<span><?= $escaper->escapeHtml($categoryLabel) ?></span>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($colorSwatches): ?>
|
||||
<div class="esun-category-card__swatches"
|
||||
aria-label="<?= $escaper->escapeHtmlAttr(__('Available Colors')) ?>">
|
||||
<?php foreach ($visibleSwatches as $swatch): ?>
|
||||
<?php
|
||||
$swatchLabel = $swatch['label'];
|
||||
$swatchImage = $swatch['image'];
|
||||
$swatchValue = $swatch['value'];
|
||||
$swatchProductImage = $swatch['product_image'];
|
||||
?>
|
||||
<button class="esun-category-card__swatch"
|
||||
type="button"
|
||||
title="<?= $escaper->escapeHtmlAttr($swatchLabel) ?>"
|
||||
aria-label="<?= $escaper->escapeHtmlAttr($swatchLabel) ?>"
|
||||
data-product-image="<?= $escaper->escapeUrl($swatchProductImage) ?>">
|
||||
<?php if ($swatchImage): ?>
|
||||
<img src="<?= $escaper->escapeUrl($swatchImage) ?>"
|
||||
alt="<?= $escaper->escapeHtmlAttr($swatchLabel) ?>">
|
||||
<?php elseif ($swatchValue): ?>
|
||||
<span style="background-color:
|
||||
<?= $escaper->escapeHtmlAttr($swatchValue) ?>"></span>
|
||||
<?php else: ?>
|
||||
<span></span>
|
||||
<?php endif; ?>
|
||||
</button>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($remainingSwatches > 0): ?>
|
||||
<span class="esun-category-card__swatch-more">
|
||||
+<?= (int)$remainingSwatches ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="product-item-inner esun-category-card__inner">
|
||||
<div class="esun-category-card__footer">
|
||||
<div class="esun-category-card__price">
|
||||
<span class="esun-category-card__final-price">
|
||||
<?= $escaper->escapeHtml($block->getFormattedFinalPrice($item)) ?>
|
||||
</span>
|
||||
<?php if ($block->hasOldPrice($item)): ?>
|
||||
<span class="esun-category-card__regular-price">
|
||||
<?= $escaper->escapeHtml($block->getFormattedRegularPrice($item)) ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="product actions product-item-actions
|
||||
esun-recommended-products__actions">
|
||||
<?php if ($block->canAddDirectly($item)): ?>
|
||||
<?php
|
||||
$postParams = $block->getAddToCartPostParams($item);
|
||||
$urlEncodedValue = $postParams['data'][$urlEncodedParamName];
|
||||
$options = $optionsViewModel
|
||||
? $optionsViewModel->getOptionsData($item)
|
||||
: [];
|
||||
?>
|
||||
<form data-role="tocart-form"
|
||||
data-product-sku="<?= $escaper->escapeHtmlAttr($item->getSku()) ?>"
|
||||
action="<?= $escaper->escapeUrl($postParams['action']) ?>"
|
||||
method="post">
|
||||
<?php foreach ($options as $option): ?>
|
||||
<input type="hidden"
|
||||
name="<?= $escaper->escapeHtmlAttr($option['name']) ?>"
|
||||
value="<?= $escaper->escapeHtmlAttr($option['value']) ?>">
|
||||
<?php endforeach; ?>
|
||||
<input type="hidden" name="product"
|
||||
value="<?= (int)$postParams['data']['product'] ?>">
|
||||
<input type="hidden"
|
||||
name="<?= /* @noEscape */ $urlEncodedParamName ?>"
|
||||
value="<?= $escaper->escapeHtmlAttr($urlEncodedValue) ?>">
|
||||
<?= $block->getBlockHtml('formkey') ?>
|
||||
<button class="action tocart primary esun-category-card__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.7
|
||||
a2 2 0 0 0 2-1.6L20 8H7"/>
|
||||
<circle cx="9" cy="20" r="1"/>
|
||||
<circle cx="17" cy="20" r="1"/>
|
||||
</svg>
|
||||
<span><?= $escaper->escapeHtml(__('Add to Cart')) ?></span>
|
||||
</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<a class="action tocart primary esun-category-card__cart"
|
||||
href="<?= $escaper->escapeUrl($productUrl) ?>"
|
||||
title="<?= $escaper->escapeHtmlAttr(__('Select Options')) ?>">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M3 4h2l2.2 10.2a2 2 0 0 0 2 1.6h7.7
|
||||
a2 2 0 0 0 2-1.6L20 8H7"/>
|
||||
<circle cx="9" cy="20" r="1"/>
|
||||
<circle cx="17" cy="20" r="1"/>
|
||||
</svg>
|
||||
<span><?= $escaper->escapeHtml(__('Select Options')) ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/** @var \Magento\Framework\View\Element\Template $block */
|
||||
?>
|
||||
<div class="esun-cart-services" data-bind="visible: getCartParam('summary_count')">
|
||||
<section class="esun-cart-service esun-cart-service--payment">
|
||||
<h3><?= $block->escapeHtml(__('Payment & Security')) ?></h3>
|
||||
<?= /* @noEscape */ $block->getChildHtml('payment_security') ?>
|
||||
</section>
|
||||
<section class="esun-cart-service esun-cart-service--delivery">
|
||||
<h3><?= $block->escapeHtml(__('Delivery and Shipping')) ?></h3>
|
||||
<?= /* @noEscape */ $block->getChildHtml('delivery_shipping') ?>
|
||||
</section>
|
||||
</div>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/** @var \Magento\Checkout\Block\Cart\Totals $block */
|
||||
$totals = $block->getTotals();
|
||||
$getTotalValue = static function (string $code) use ($totals): float {
|
||||
return isset($totals[$code]) ? (float)$totals[$code]->getValue() : 0.0;
|
||||
};
|
||||
$formatPrice = static function (float $amount) use ($block): string {
|
||||
return $block->getQuote()->getStore()->getCurrentCurrency()->format($amount, [], false);
|
||||
};
|
||||
$rewardPointsUsed = (int)$block->getQuote()->getData('reward_points_used');
|
||||
?>
|
||||
<div id="cart-totals" class="cart-totals esun-cart-page-totals">
|
||||
<div class="esun-cart-page-total-row">
|
||||
<span><?= $block->escapeHtml(__('Subtotal')) ?></span>
|
||||
<strong><?= $block->escapeHtml($formatPrice($getTotalValue('subtotal'))) ?></strong>
|
||||
</div>
|
||||
<div class="esun-cart-page-total-row">
|
||||
<span><?= $block->escapeHtml(__('Discount')) ?></span>
|
||||
<strong><?= $block->escapeHtml($formatPrice($getTotalValue('discount'))) ?></strong>
|
||||
</div>
|
||||
<?php if ($getTotalValue('reward_discount') != 0.0): ?>
|
||||
<div class="esun-cart-page-total-row">
|
||||
<span><?= $block->escapeHtml(__('Points Discount (%1 points)', $rewardPointsUsed)) ?></span>
|
||||
<strong><?= $block->escapeHtml($formatPrice($getTotalValue('reward_discount'))) ?></strong>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="esun-cart-page-total-row">
|
||||
<span><?= $block->escapeHtml(__('Estimated Shipping')) ?></span>
|
||||
<strong><?= $block->escapeHtml($formatPrice($getTotalValue('shipping'))) ?></strong>
|
||||
</div>
|
||||
<div class="esun-cart-page-total-row esun-cart-page-total-row--grand">
|
||||
<span><?= $block->escapeHtml(__('Total')) ?></span>
|
||||
<strong><?= $block->escapeHtml($formatPrice($getTotalValue('grand_total'))) ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user