Commit c84e8451 by lmf

添加产品模板文件

parent 7effe964
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var $block \Magento\Catalog\Block\Product\View\Additional */
?>
<?php foreach ($block->getChildHtmlList() as $_html) :?>
<?= /* @noEscape */ $_html ?>
<?php endforeach; ?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
/**
* Product view template
*
* @var $block \Magento\Catalog\Block\Product\View\Description
*/
?>
<?php
$_helper = $this->helper(Magento\Catalog\Helper\Output::class);
$_product = $block->getProduct();
if (!$_product instanceof \Magento\Catalog\Model\Product) {
return;
}
$_call = $block->getAtCall();
$_code = $block->getAtCode();
$_className = $block->getCssClass();
$_attributeLabel = $block->getAtLabel();
$_attributeType = $block->getAtType();
$_attributeAddAttribute = $block->getAddAttribute();
$renderLabel = true;
// if defined as 'none' in layout, do not render
if ($_attributeLabel == 'none') {
$renderLabel = false;
}
if ($_attributeLabel && $_attributeLabel == 'default') {
$_attributeLabel = $_product->getResource()->getAttribute($_code)->getStoreLabel();
}
if ($_attributeType && $_attributeType == 'text') {
$_attributeValue = ($_helper->productAttribute($_product, $_product->$_call(), $_code))
? $_product->getAttributeText($_code)
: '';
} else {
$_attributeValue = $_helper->productAttribute($_product, $_product->$_call(), $_code);
}
?>
<style>
.joshine-desction{
width:100%;
}
.joshine-desction .desction-left{
width: 90%;
flot: left;
font-size: small;
font-weight: bolder;
color: #000;
}
.joshine-desction .desction-right{
width: 10%;
float: right;
text-align: end;
font-size: larger;
color: #000;
font-weight: 600;
}
.joshine-desction .desction-info{
padding: 10px;
margin: 10px;
font-size: small;
}
</style>
<?php if ($_attributeValue) :?>
<?php
//print_r($_attributeAddAttribute);
?>
<div class="product attribute <?= $block->escapeHtmlAttr($_className) ?>">
<?php if ($renderLabel) :?>
<strong class="type"><?= $block->escapeHtml($_attributeLabel) ?></strong>
<?php endif; ?>
<div class="value" <?= /* @noEscape */ $_attributeAddAttribute ?>>
<!--商品描述部分-->
<?php if($_attributeAddAttribute == 'itemprop="description"'): ?>
<div class="joshine-desction">
<div id="accordion" data-mage-init='{
"accordion":{
"active": [1, 2],
"collapsible": true,
"openedState": "active",
"multipleCollapsible": true
}}'>
<div data-role="collapsible">
<div data-role="trigger">
<a class="desction-left info-desc" href="#">Description</a>
<a class="desction-right info-desc" href="#">+</a>
</div>
</div>
<div data-role="content">
<div class="desction-info">
<?= /* @noEscape */ $_attributeValue ?>
<?= /* @noEscape */ $this->helper(Magento\Catalog\Helper\Output::class)->productAttribute(
$block->getProduct(),
$block->getProduct()->getDescription(),
'description'
) ?>
</div>
</div>
</div>
</div>
<?php else:?>
<?= /* @noEscape */ $_attributeValue ?>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<script>
require([
'jquery'
], function ($) {
$(".info-desc").click(function () {
$(".desction-right").html("-");
})
});
</script>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
/**
* Product additional attributes template
*
* @var $block \Magento\Catalog\Block\Product\View\Attributes
*/
?>
<?php
$_helper = $this->helper(Magento\Catalog\Helper\Output::class);
$_product = $block->getProduct();
?>
<?php if ($_additional = $block->getAdditionalData()) :?>
<div class="additional-attributes-wrapper table-wrapper">
<table class="data table additional-attributes" id="product-attribute-specs-table">
<caption class="table-caption"><?= $block->escapeHtml(__('More Information')) ?></caption>
<tbody>
<?php foreach ($_additional as $_data) :?>
<tr>
<th class="col label" scope="row"><?= $block->escapeHtml($_data['label']) ?></th>
<td class="col data" data-th="<?= $block->escapeHtmlAttr($_data['label']) ?>"><?= /* @noEscape */ $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif;?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Product viewed counter template
*
* @var $block \Magento\Catalog\Block\Ui\ProductViewCounter
*/
?>
<script type="text/x-magento-init">
{
"*": {
"Magento_Catalog/js/product/view/provider": {
"data": <?= /* @noEscape */ $block->getCurrentProductData() ?>
}
}
}
</script>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
/**
* Product description template
*
* @var $block \Magento\Catalog\Block\Product\View\Description
*/
?>
<?= /* @noEscape */ $this->helper(Magento\Catalog\Helper\Output::class)->productAttribute(
$block->getProduct(),
$block->getProduct()->getDescription(),
'description'
) ?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var \Magento\Catalog\Block\Product\View\Details $block */
?>
<?php if ($detailedInfoGroup = $block->getGroupSortedChildNames('detailed_info', 'getChildHtml')) :?>
<div class="product info detailed">
<?php $layout = $block->getLayout(); ?>
<div class="product data items" data-mage-init='{"tabs":{"openedState":"active"}}'>
<?php foreach ($detailedInfoGroup as $name) :?>
<?php
if ($name == "product.info.description"){
continue;
}
$html = $layout->renderElement($name);
if (!trim($html)) {
continue;
}
$alias = $layout->getElementAlias($name);
$label = $block->getChildData($alias, 'title');
?>
<div class="data item title"
data-role="collapsible" id="tab-label-<?= $block->escapeHtmlAttr($alias) ?>">
<a class="data switch"
tabindex="-1"
data-toggle="trigger"
href="#<?= $block->escapeUrl($alias) ?>"
id="tab-label-<?= $block->escapeHtmlAttr($alias) ?>-title">
<?= /* @noEscape */ $label ?>
</a>
</div>
<div class="data item content"
aria-labelledby="tab-label-<?= $block->escapeHtmlAttr($alias) ?>-title" id="<?= $block->escapeHtmlAttr($alias) ?>" data-role="content">
<?= /* @noEscape */ $html ?>
</div>
<?php endforeach;?>
</div>
</div>
<?php endif; ?>
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