ในหน้าการดูโดยคุณภาพเยี่ยมเริ่มต้นแสดงราคาต่ำสุดของผลิตภัณฑ์ที่เกี่ยวข้อง
ฉันต้องการแสดงราคาสูงสุดของผลิตภัณฑ์ที่เกี่ยวข้อง คนใดคนหนึ่งมีความคิดที่ตรรกะอยู่ที่ไหนวิธีการปรับแต่งพฤติกรรมนี้
อัปเดต:
วีโอไอพี \ ConfigurableProduct \ ราคา \ ราคา \ ConfigurablePriceResolver
/**
     * @param \Magento\Framework\Pricing\SaleableInterface|\Magento\Catalog\Model\Product $product
     * @return float
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function resolvePrice(\Magento\Framework\Pricing\SaleableInterface $product)
    {
        $price = null;
        foreach ($this->configurable->getUsedProducts($product) as $subProduct) {
            $productPrice = $this->priceResolver->resolvePrice($subProduct);
            $price = $price ? min($price, $productPrice) : $productPrice;
        }
        if (!$price) {
            throw new \Magento\Framework\Exception\LocalizedException(
                __('Configurable product "%1" do not have sub-products', $product->getName())
            );
        }
        return (float)$price;
    }ฉันพยายามแทนที่ไฟล์หลักนี้ แต่มันไม่ทำงาน
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
     <preference for="Magento\ConfigurableProduct\Pricing\Price\ConfigurablePriceResolver" type="Kensium\Catalog\Pricing\Price\ConfigurablePriceResolver" /><?php
namespace Kensium\Catalog\Pricing\Price;
class ConfigurablePriceResolver extends \Magento\ConfigurableProduct\Pricing\Price\ConfigurablePriceResolver
{
    /**
     * @param \Magento\Framework\Pricing\SaleableInterface|\Magento\Catalog\Model\Product $product
     * @return float
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function resolvePrice(\Magento\Framework\Pricing\SaleableInterface $product)
    {
        $price = null;       
        $assPrice=array();
        foreach ($this->configurable->getUsedProducts($product) as $subProduct) {
            $productPrice = $this->priceResolver->resolvePrice($subProduct);
            $assPrice[]=$productPrice;
            $price = $price ? min($price, $productPrice) : $productPrice;
        }
        if (!$price) {
            throw new \Magento\Framework\Exception\LocalizedException(
                __('Configurable product "%1" do not have sub-products', $product->getName())
            );
        }
        return (float)(max($assPrice));
        //return (float)$price;
    }
}