Commit b1825e83 by dhn

优化购物车属性查询

parent c1d01700
...@@ -18,6 +18,21 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima ...@@ -18,6 +18,21 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$mobileDetect = $objectManager->get(\Joshine\Common\Lib\MobileDetect\MobileDetect::class); $mobileDetect = $objectManager->get(\Joshine\Common\Lib\MobileDetect\MobileDetect::class);
$priceBlock = $objectManager->get(\Magento\Catalog\Block\Product\AbstractProduct::class); $priceBlock = $objectManager->get(\Magento\Catalog\Block\Product\AbstractProduct::class);
$_options = $block->getOptionList();
$resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
$connection = $resource->getConnection();
foreach ($_options as $key=>$_option) {
if ($_option['label'] != 'Size') {
$tableName = $resource->getTableName('eav_attribute_option_value');
$sql = "Select value FROM " . $tableName ." where store_id=0 AND option_id=".$_option['option_value'];
} else {
$tableName = $resource->getTableName('eav_attribute_option_swatch');
$sql = "Select value FROM " . $tableName ." where store_id=0 AND option_id=".$_option['option_value'];
}
$result = $connection->fetchRow($sql);
$_options[$key]['value'] = $result['value'];
}
?> ?>
<div class="cart item is_mobile"> <div class="cart item is_mobile">
...@@ -51,43 +66,18 @@ $priceBlock = $objectManager->get(\Magento\Catalog\Block\Product\AbstractProduct ...@@ -51,43 +66,18 @@ $priceBlock = $objectManager->get(\Magento\Catalog\Block\Product\AbstractProduct
</p> </p>
<!----------------------------item name end-------------------------------------> <!----------------------------item name end------------------------------------->
<!----------------------------item option start---------------------------------> <!----------------------------item option start--------------------------------->
<?php if ($_options = $block->getOptionList()) :?> <?php if ($_options) :?>
<div class="item-options-meta"> <div class="item-options-meta">
<?php
$countOpt = count($_options);
?>
<?php foreach ($_options as $key=>$_option) :?> <?php foreach ($_options as $key=>$_option) :?>
<strong style="font-weight: 600;margin-right: 10px;"><?= $block->escapeHtml($_option['label']) ?> :</strong> <strong style="font-weight: 600;margin-right: 10px;"><?= $block->escapeHtml($_option['label']) ?> :</strong>
<span class="item-options-line"> <span class="item-options-line">
<?php <?= $block->escapeHtml($_option['value']) ?>
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
$connection = $resource->getConnection();
?>
<?php if ($_option['label'] != 'Size'){ ?>
<?php
$tableName = $resource->getTableName('eav_attribute_option_value');
$sql = "Select * FROM " . $tableName ." where store_id=0 AND option_id=".$_option['option_value'];
$result = $connection->fetchRow($sql);
?>
<?= $block->escapeHtml($result['value']) ?>
<?php }else{
$tableName = $resource->getTableName('eav_attribute_option_swatch');
$sql = "Select * FROM " . $tableName ." where store_id=0 AND option_id=".$_option['option_value'];
$result = $connection->fetchRow($sql);
echo $result['value'];
} ?>
</span><br /> </span><br />
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<?php endif;?> <?php endif;?>
<div style="max-width: 100%;width: 100%;height: 40px;"> <div style="max-width: 100%;width: 100%;height: 40px;">
<!----------------------------item handle start---------------------------------> <!----------------------------item handle start--------------------------------->
<div class="item-handle" style="width: 16%;float:left;position: inherit;font-size: 16px;"> <div class="item-handle" style="width: 16%;float:left;position: inherit;font-size: 16px;">
<div class="item-quantity"> <div class="item-quantity">
......
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