Commit 309071f1 by lmf

优化产品详情页面材质和描述位置和尺寸

增加产品列表和详情折扣标签
parent 6e8fb1f4
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php
/** @var \Magento\Catalog\Pricing\Render\FinalPriceBox $block */
/** ex: \Magento\Catalog\Pricing\Price\RegularPrice */
/** @var \Magento\Framework\Pricing\Price\PriceInterface $priceModel */
$priceModel = $block->getPriceType('regular_price');
/** ex: \Magento\Catalog\Pricing\Price\FinalPrice */
/** @var \Magento\Framework\Pricing\Price\PriceInterface $finalPriceModel */
$finalPriceModel = $block->getPriceType('final_price');
$idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : '';
$schema = ($block->getZone() == 'item_view') ? true : false;
?>
<?php if ($block->hasSpecialPrice()) :?>
<span class="special-price">
<?= /* @noEscape */ $block->renderAmount($finalPriceModel->getAmount(), [
'display_label' => '',
'price_id' => $block->getPriceId('product-price-' . $idSuffix),
'price_type' => 'finalPrice',
'include_container' => false,
'schema' => $schema
]); ?>
</span>
<span class="old-price">
<?= /* @noEscape */ $block->renderAmount($priceModel->getAmount(), [
'display_label' => '',
'price_id' => $block->getPriceId('old-price-' . $idSuffix),
'price_type' => 'oldPrice',
'include_container' => true,
'skip_adjustments' => true
]); ?>
</span>
<?php
$seller = number_format((1 - number_format($finalPriceModel->getAmount()->getValue() / $priceModel->getAmount()->getValue(),2)) *100,0) ?>
<?php if (!$block->isProductList()) :?>
<span style="background-color: #ee0000;height: 20px;color: #ffffff;font-size: 16px;font-weight: 600;margin-left: 10px;padding: 2px;">SAVE <?=$seller?>%</span>
<?php else :?>
<span style="position: absolute;left: 15px;top: 15px;z-index: 1;color: #ffffff;background-color: #ee0000;font-size: 16px;font-weight: 600;">SAVE <?=$seller?>%</span>
<?php endif; ?>
<?php else :?>
<?= /* @noEscape */ $block->renderAmount($finalPriceModel->getAmount(), [
'price_id' => $block->getPriceId('product-price-' . $idSuffix),
'price_type' => 'finalPrice',
'include_container' => true,
'schema' => $schema
]); ?>
<?php endif; ?>
<?php if ($block->showMinimalPrice()) :?>
<?php if ($block->getUseLinkForAsLowAs()) :?>
<a href="<?= $block->escapeUrl($block->getSaleableItem()->getProductUrl()) ?>" class="minimal-price-link">
<?= /* @noEscape */ $block->renderAmountMinimal() ?>
</a>
<?php else :?>
<span class="minimal-price-link">
<?= /* @noEscape */ $block->renderAmountMinimal() ?>
</span>
<?php endif?>
<?php endif; ?>
...@@ -191,10 +191,12 @@ ...@@ -191,10 +191,12 @@
.joshine-desction .desction-info p{ .joshine-desction .desction-info p{
word-wrap: break-word; word-wrap: break-word;
} }
@media (min-width: 780px){ @media (min-width: 780px){
.joshine-desction #description{ .product-view-description{
max-height: 450px; max-height: 450px;
overflow: auto; overflow: auto;
width: 100%;
} }
} }
...@@ -204,6 +206,9 @@ ...@@ -204,6 +206,9 @@
} }
</style> </style>
<div class="product-view-description">
<?php <?php
$short_description = $this->helper(Magento\Catalog\Helper\Output::class)->productAttribute( $short_description = $this->helper(Magento\Catalog\Helper\Output::class)->productAttribute(
$block->getShortDescription(), $block->getShortDescription(),
...@@ -245,7 +250,7 @@ if ($short_description) : ...@@ -245,7 +250,7 @@ if ($short_description) :
<div class="joshine-desction"> <div class="joshine-desction">
<div id="accordion" data-mage-init='{ <div id="accordion" data-mage-init='{
"accordion":{ "accordion":{
"active": [1, 2], "active": [0],
"collapsible": true, "collapsible": true,
"openedState": "active", "openedState": "active",
"multipleCollapsible": true "multipleCollapsible": true
...@@ -253,10 +258,10 @@ if ($short_description) : ...@@ -253,10 +258,10 @@ if ($short_description) :
<div data-role="collapsible"> <div data-role="collapsible">
<div data-role="trigger" class="short_description-button"> <div data-role="trigger" class="short_description-button">
<a class="desction-left short_description info-desc" href="#">Material</a> <a class="desction-left short_description info-desc" href="#">Material</a>
<a class="desction-right short_description info-desc" href="#">+</a> <a class="desction-right short_description info-desc" href="#">-</a>
</div> </div>
</div> </div>
<div data-role="content" id="description"> <div data-role="content" id="material">
<div class="desction-info"> <div class="desction-info">
<?php echo $short_description;?> <?php echo $short_description;?>
</div> </div>
...@@ -265,7 +270,7 @@ if ($short_description) : ...@@ -265,7 +270,7 @@ if ($short_description) :
</div> </div>
<?php endif; <?php endif;
?> ?>
</div>
<script> <script>
require([ require([
'jquery' 'jquery'
......
...@@ -12,6 +12,7 @@ $finalPriceModel = $block->getPriceType('final_price'); ...@@ -12,6 +12,7 @@ $finalPriceModel = $block->getPriceType('final_price');
$idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : ''; $idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : '';
$schema = ($block->getZone() == 'item_view') ? true : false; $schema = ($block->getZone() == 'item_view') ? true : false;
?> ?>
<span class="normal-price"> <span class="normal-price">
<?= /* @noEscape */ $block->renderAmount($finalPriceModel->getAmount(), [ <?= /* @noEscape */ $block->renderAmount($finalPriceModel->getAmount(), [
'display_label' => __(''), 'display_label' => __(''),
...@@ -32,19 +33,25 @@ $schema = ($block->getZone() == 'item_view') ? true : false; ...@@ -32,19 +33,25 @@ $schema = ($block->getZone() == 'item_view') ? true : false;
'skip_adjustments' => true 'skip_adjustments' => true
]); ?> ]); ?>
</span> </span>
<?php
$seller = number_format((1 - number_format($finalPriceModel->getAmount()->getValue() / $priceModel->getAmount()->getValue(),2)) *100,0) ?>
<span style="position: absolute;left: 15px;top: 15px;z-index: 1;color: #ffffff;background-color: #ee0000;font-size: 16px;font-weight: 600;">SAVE <?=$seller?>%</span>
<?php endif; ?> <?php endif; ?>
<?php if (!$block->isProductList() && $block->hasSpecialPrice()) : ?> <?php if (!$block->isProductList() && $block->hasSpecialPrice()) : ?>
<span class="old-price sly-old-price no-display"> <span class="old-price sly-old-price no-display">
<?= /* @noEscape */ $block->renderAmount($priceModel->getAmount(), [ <?= /* @noEscape */ $block->renderAmount($priceModel->getAmount(), [
'display_label' => __('Regular Price'), 'display_label' => __('Regular Price2'),
'price_id' => $block->getPriceId('old-price-' . $idSuffix), 'price_id' => $block->getPriceId('old-price-' . $idSuffix),
'price_type' => 'oldPrice', 'price_type' => 'oldPrice',
'include_container' => true, 'include_container' => true,
'skip_adjustments' => true 'skip_adjustments' => true
]); ?> ]); ?>
</span> </span>
<?php
$seller = number_format((1 - number_format($finalPriceModel->getAmount()->getValue() / $priceModel->getAmount()->getValue(),2)) *100,0) ?>
<span style="background-color: #ee0000;height: 20px;color: #ffffff;font-size: 16px;font-weight: 600;margin-left: 10px;padding: 2px;">SAVE <?=$seller?>%</span>
<?php endif; ?> <?php endif; ?>
<?php if ($block->showMinimalPrice()) : ?> <?php if ($block->showMinimalPrice()) : ?>
......
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