init
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user