Commit 64419299 by dhn

mini购物车商品属性展示修改

parent a8678d2e
......@@ -84,9 +84,29 @@ class DefaultItem extends AbstractItem
{
$imageHelper = $this->imageHelper->init($this->getProductForThumbnail(), 'mini_cart_product_thumbnail');
$productName = $this->escaper->escapeHtml($this->item->getProduct()->getName());
$options = $this->getOptionList();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
$connection = $resource->getConnection();
if (!empty($options)) {
foreach ($options as $key => $option) {
if ($option['label'] != 'Size') {
$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);
$options[$key]['value'] = $result['value'];
} 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);
$options[$key]['value'] = $result['value'];
}
}
}
return [
'options' => $this->getOptionList(),
'options' => $options,
'qty' => $this->item->getQty() * 1,
'item_id' => $this->item->getId(),
'configure_url' => $this->getConfigureUrl(),
......
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