Commit b8e9efa3 by lmf

优化购物车列表产品样式

parent 47197900
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var $block \Magento\Catalog\Block\Product\View */
?>
<?php $_product = $block->getProduct(); ?>
<?php $buttonTitle = __('Update Cart'); ?>
<?php if ($_product->isSaleable()) :?>
<div class="box-tocart update">
<fieldset class="fieldset">
<?php if ($block->shouldRenderQuantity()) :?>
<div class="field qty">
<label class="label" for="qty"><span><?= $block->escapeHtml(__('Qty')) ?></span></label>
<div class="control">
<input type="number"
name="qty"
id="qty"
min="0"
value=""
title="<?= $block->escapeHtmlAttr(__('Qty')) ?>"
class="input-text qty"
data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"/>
</div>
</div>
<?php endif; ?>
<div class="actions">
<button type="submit"
title="<?= $block->escapeHtmlAttr($buttonTitle) ?>"
class="action primary tocart"
id="product-updatecart-button">
<span><?= $block->escapeHtml($buttonTitle) ?></span>
</button>
<?= $block->getChildHtml('', true) ?>
</div>
</fieldset>
</div>
<script type="text/x-magento-init">
{
"#product_addtocart_form": {
"validation": {},
"addToCart": {
"cartButtonId": "#product-updatecart-button",
"cartForm": "#product_addtocart_form"
}
}
}
</script>
<?php endif; ?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate
// phpcs:disable Magento2.Files.LineLength.MaxExceeded
/** @var $block \Magento\Checkout\Block\Cart\Item\Renderer */
$_item = $block->getItem();
$product = $_item->getProduct();
$isVisibleProduct = $product->isVisibleInSiteVisibility();
/** @var \Magento\Msrp\Helper\Data $helper */
$helper = $this->helper(Magento\Msrp\Helper\Data::class);
$canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinimalPriceLessMsrp($product);
?>
<tbody class="cart item">
<tr class="item-info">
<td data-th="<?= $block->escapeHtml(__('Item')) ?>" class="col item">
<?php if ($block->hasProductUrl()) :?>
<a href="<?= $block->escapeUrl($block->getProductUrl()) ?>"
title="<?= $block->escapeHtml($block->getProductName()) ?>"
tabindex="-1"
class="product-item-photo">
<?php else :?>
<span class="product-item-photo">
<?php endif;?>
<?= $block->getImage($block->getProductForThumbnail(), 'cart_page_product_thumbnail')->toHtml() ?>
<?php if ($block->hasProductUrl()) :?>
</a>
<?php else :?>
</span>
<?php endif; ?>
<div class="product-item-details">
<strong class="product-item-name">
<?php if ($block->hasProductUrl()) :?>
<a href="<?= $block->escapeUrl($block->getProductUrl()) ?>"><?= $block->escapeHtml($block->getProductName()) ?></a>
<?php else :?>
<?= $block->escapeHtml($block->getProductName()) ?>
<?php endif; ?>
</strong>
<?php if ($_options = $block->getOptionList()) :?>
<dl class="item-options" style="margin-top: 10%;">
<?php foreach ($_options as $_option) :?>
<?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?>
<dt style="width: 15%;float: left"><?= $block->escapeHtml($_option['label']) ?></dt>
<dd>
<?php if (isset($_formatedOptionValue['full_view'])) :?>
<?= $block->escapeHtml($_formatedOptionValue['full_view']) ?>
<?php else :?>
<?= $block->escapeHtml($_formatedOptionValue['value'], ['span', 'a']) ?>
<?php endif; ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif;?>
<?php if ($messages = $block->getMessages()) :?>
<?php foreach ($messages as $message) :?>
<div class= "cart item message <?= $block->escapeHtmlAttr($message['type']) ?>">
<div><?= $block->escapeHtml($message['text']) ?></div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php $addInfoBlock = $block->getProductAdditionalInformationBlock(); ?>
<?php if ($addInfoBlock) :?>
<?= $addInfoBlock->setItem($_item)->toHtml() ?>
<?php endif;?>
</div>
</td>
<?php if ($canApplyMsrp) :?>
<td class="col msrp" data-th="<?= $block->escapeHtml(__('Price')) ?>">
<span class="pricing msrp">
<span class="msrp notice"><?= $block->escapeHtml(__('See price before order confirmation.')) ?></span>
<?php $helpLinkId = 'cart-msrp-help-' . $_item->getId(); ?>
<a href="#" class="action help map"
id="<?= ($block->escapeHtmlAttr($helpLinkId)) ?>"
data-mage-init='{"addToCart":{
"helpLinkId": "#<?= $block->escapeJs($block->escapeHtml($helpLinkId)) ?>",
"productName": "<?= $block->escapeJs($block->escapeHtml($product->getName())) ?>",
"showAddToCart": false
}
}'
>
<span><?= $block->escapeHtml(__("What's this?")) ?></span>
</a>
</span>
</td>
<?php else :?>
<td class="col price" data-th="<?= $block->escapeHtml(__('Price')) ?>">
<?= $block->getUnitPriceHtml($_item) ?>
</td>
<?php endif; ?>
<td class="col qty" data-th="<?= $block->escapeHtml(__('Qty')) ?>">
<div class="field qty">
<div class="control qty">
<label for="cart-<?= $block->escapeHtmlAttr($_item->getId()) ?>-qty">
<span class="label"><?= $block->escapeHtml(__('Qty')) ?></span>
<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"
size="4"
step="any"
title="<?= $block->escapeHtmlAttr(__('Qty')) ?>"
class="input-text qty"
data-validate="{required:true,'validate-greater-than-zero':true}"
data-role="cart-item-qty"/>
</label>
</div>
</div>
</td>
<td class="col subtotal" data-th="<?= $block->escapeHtml(__('Subtotal')) ?>">
<?php if ($canApplyMsrp) :?>
<span class="cart msrp subtotal">--</span>
<?php else :?>
<?= $block->getRowTotalHtml($_item) ?>
<?php endif; ?>
</td>
</tr>
<tr class="item-actions">
<td colspan="4">
<div class="actions-toolbar">
<?= /* @noEscape */ $block->getActions($_item) ?>
</div>
</td>
</tr>
</tbody>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate
/** @var $block \Magento\Checkout\Block\Item\Price\Renderer */
?>
<?php $_item = $block->getItem() ?>
<div class="price-container">
<span class="price-label"><?= $block->escapeHtml(__('Price')) ?></span>
<span class="price-wrapper">
<?= $block->escapeHtml(
$this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_item->getCalculationPrice()),
['span']
) ?>
</span>
</div>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var $block \Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit */
?>
<?php if ($block->isProductVisibleInSiteVisibility()) :?>
<a class="action action-edit"
href="<?= $block->escapeUrl($block->getConfigureUrl()) ?>"
title="<?= $block->escapeHtmlAttr(__('Edit item parameters')) ?>">
<span><?= $block->escapeHtml(__('Edit')) ?></span>
</a>
<?php endif ?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var $block \Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove */
?>
<a href="#"
title="<?= $block->escapeHtml(__('Remove item')) ?>"
class="action action-delete"
data-post='<?= /* @noEscape */ $block->getDeletePostJson() ?>'>
<span>
<?= $block->escapeHtml(__('Remove item')) ?>
</span>
</a>
......@@ -2256,7 +2256,6 @@ strong.subtitle.empty{
.checkout.checkout-methods-items li{
width: 100%;
background-color: #ffc439;
height: 52px;
padding-top: 3px;
font-weight: 700;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment