Magento 1.9.1 구성 가능한 제품 속성 정렬


24

이미 언급했듯이 magento 1.9.1 및 구성 가능한 제품의 속성 정렬에 문제가있는 것 같습니다. 이제 구성 가능한 제품의 옵션은 항상 단순 제품의 제품 ID에 따라 다릅니다. 속성 옵션의 순서는 무시됩니다.

나는 magento 1.9.0.1로 갔다. 어쩌면 누군가 1.9.1에서 정렬이 수행되는 방법을 결정할 수 있습니다. 구성 가능한 제품을 사용하여 문제를 해결하는 모든 사람에게 좋을 것입니다.

누군가가 그것을보고 싶다면 여기 에서 magento 데모 스토어에서 할 수 있습니다. 크기를 올바르게 정렬 할 수 없었습니다.

답변:


25

참고 : 이 솔루션은 Magento 1.9.2에서 작동하지 않는다는 것이 주목되었습니다. 다른 사람들이 시간을 낭비하지 않기 위해이 게시물의 맨 위에 이것을 지적하고 싶습니다. 내 솔루션을 개발하거나 1.9.2에서 작동하는 다른 솔루션을 찾으면 그 시점 에서이 게시물을 업데이트 할 것입니다.

주의 사항 : 여기에 제시된 솔루션은 Magento의 핵심 라이브러리에서 블록 클래스 파일을 확장합니다. 이 방법을 사용하기 전에 Magento의 소스 코드를 검토 한 후이 방법을 사용하지 않는 것이 좋은 이벤트가 아니라고 판단했습니다. 이후 버전의 Magento에서이 정렬 문제가 해결되면 app / etc / modules XML 파일에서 확장명을 비활성화하여 아래의 변경 사항을 취소 할 수 있습니다.

1 단계 : app / etc / modules / FirstScribe_CatalogOptionSortFix.xml 파일 작성

내용:

<?xml version="1.0"?>
<config>
    <modules>
        <FirstScribe_CatalogOptionSortFix>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Catalog />
            </depends>
        </FirstScribe_CatalogOptionSortFix>
    </modules>
</config>

참고 : 2 단계와 3 단계의 경우 필요에 따라 이러한 파일의 디렉토리를 작성하십시오. 예를 들어 app / code / local 디렉토리가 이미 있거나 사이트에 이미 설치 한 확장자에 따라 그렇지 않을 수 있습니다.

2 단계 : app / code / local / FirstScribe / CatalogOptionSortFix / etc / config.xml 파일 작성

내용:

<?xml version="1.0"?>
<!--
/**
 * Magento 1.9.1.0 has a bug in that the configurable options are sorted by
 * ID rather than position for the Configurable Product's front end view script.
 * This extension addresses this problem.
 *
 * @category    FirstScribe
 * @package     FirstScribe_CatalogOptionSortFix
 * @version     2014.12.15
 */
-->
<config>
    <modules>
        <FirstScribe_CatalogOptionSortFix>
            <version>1.0.0</version>
        </FirstScribe_CatalogOptionSortFix>
    </modules>
    <global>
        <blocks>
            <catalog>
                <rewrite>
                    <product_view_type_configurable>FirstScribe_CatalogOptionSortFix_Block_Product_View_Type_Configurable</product_view_type_configurable>
                </rewrite>
            </catalog>
        </blocks>
    </global>
</config>

3 단계 : 파일 만들기 응용 프로그램 / 코드 / 지역 / FirstScribe / CatalogOptionSortFix / 차단 / 제품 /보기 / 형 / Configurable.php

내용:

<?php
/**
 * Magento 1.9.1.0 has a bug in that the configurable options are sorted by
 * ID rather than position for the Configurable Product's front end view script.
 * This extension addresses this problem.
 *
 * @category    FirstScribe
 * @package     FirstScribe_CatalogOptionSortFix
 * @version     2014.12.15
 */
class FirstScribe_CatalogOptionSortFix_Block_Product_View_Type_Configurable extends Mage_Catalog_Block_Product_View_Type_Configurable
{
    /**
     * @var Magento_Db_Adapter_Pdo_Mysql
     */
    protected $_read;

    /**
     * @var string
     */
    protected $_tbl_eav_attribute_option;

    /**
     * Composes configuration for js
     *
     * @version 2014.12.15 - Addition of this line:
     *    $info['options'] = $this->_sortOptions($info['options']);
     *
     * @return string
     */
    public function getJsonConfig()
    {
        $attributes = array();
        $options    = array();
        $store      = $this->getCurrentStore();
        $taxHelper  = Mage::helper('tax');
        $currentProduct = $this->getProduct();

        $preconfiguredFlag = $currentProduct->hasPreconfiguredValues();
        if ($preconfiguredFlag) {
            $preconfiguredValues = $currentProduct->getPreconfiguredValues();
            $defaultValues       = array();
        }

        foreach ($this->getAllowProducts() as $product) {
            $productId  = $product->getId();

            foreach ($this->getAllowAttributes() as $attribute) {
                $productAttribute   = $attribute->getProductAttribute();
                $productAttributeId = $productAttribute->getId();
                $attributeValue     = $product->getData($productAttribute->getAttributeCode());
                if (!isset($options[$productAttributeId])) {
                    $options[$productAttributeId] = array();
                }

                if (!isset($options[$productAttributeId][$attributeValue])) {
                    $options[$productAttributeId][$attributeValue] = array();
                }
                $options[$productAttributeId][$attributeValue][] = $productId;
            }
        }

        $this->_resPrices = array(
            $this->_preparePrice($currentProduct->getFinalPrice())
        );

        foreach ($this->getAllowAttributes() as $attribute) {
            $productAttribute = $attribute->getProductAttribute();
            $attributeId = $productAttribute->getId();
            $info = array(
                    'id'        => $productAttribute->getId(),
                    'code'      => $productAttribute->getAttributeCode(),
                    'label'     => $attribute->getLabel(),
                    'options'   => array()
            );

            $optionPrices = array();
            $prices = $attribute->getPrices();
            if (is_array($prices)) {
                foreach ($prices as $value) {
                    if(!$this->_validateAttributeValue($attributeId, $value, $options)) {
                        continue;
                    }
                    $currentProduct->setConfigurablePrice(
                            $this->_preparePrice($value['pricing_value'], $value['is_percent'])
                    );
                    $currentProduct->setParentId(true);
                    Mage::dispatchEvent(
                            'catalog_product_type_configurable_price',
                            array('product' => $currentProduct)
                    );
                    $configurablePrice = $currentProduct->getConfigurablePrice();

                    if (isset($options[$attributeId][$value['value_index']])) {
                        $productsIndex = $options[$attributeId][$value['value_index']];
                    } else {
                        $productsIndex = array();
                    }

                    $info['options'][] = array(
                            'id'        => $value['value_index'],
                            'label'     => $value['label'],
                            'price'     => $configurablePrice,
                            'oldPrice'  => $this->_prepareOldPrice($value['pricing_value'], $value['is_percent']),
                            'products'  => $productsIndex,
                    );
                    $optionPrices[] = $configurablePrice;
                }
            }

            // CALL SORT ORDER FIX
            $info['options'] = $this->_sortOptions($info['options']);

            /**
             * Prepare formated values for options choose
             */
            foreach ($optionPrices as $optionPrice) {
                foreach ($optionPrices as $additional) {
                    $this->_preparePrice(abs($additional-$optionPrice));
                }
            }
            if($this->_validateAttributeInfo($info)) {
                $attributes[$attributeId] = $info;
            }

            // Add attribute default value (if set)
            if ($preconfiguredFlag) {
                $configValue = $preconfiguredValues->getData('super_attribute/' . $attributeId);
                if ($configValue) {
                    $defaultValues[$attributeId] = $configValue;
                }
            }
        }

        $taxCalculation = Mage::getSingleton('tax/calculation');
        if (!$taxCalculation->getCustomer() && Mage::registry('current_customer')) {
            $taxCalculation->setCustomer(Mage::registry('current_customer'));
        }

        $_request = $taxCalculation->getDefaultRateRequest();
        $_request->setProductClassId($currentProduct->getTaxClassId());
        $defaultTax = $taxCalculation->getRate($_request);

        $_request = $taxCalculation->getRateRequest();
        $_request->setProductClassId($currentProduct->getTaxClassId());
        $currentTax = $taxCalculation->getRate($_request);

        $taxConfig = array(
                'includeTax'        => $taxHelper->priceIncludesTax(),
                'showIncludeTax'    => $taxHelper->displayPriceIncludingTax(),
                'showBothPrices'    => $taxHelper->displayBothPrices(),
                'defaultTax'        => $defaultTax,
                'currentTax'        => $currentTax,
                'inclTaxTitle'      => Mage::helper('catalog')->__('Incl. Tax')
        );

        $config = array(
                'attributes'        => $attributes,
                'template'          => str_replace('%s', '#{price}', $store->getCurrentCurrency()->getOutputFormat()),
                'basePrice'         => $this->_registerJsPrice($this->_convertPrice($currentProduct->getFinalPrice())),
                'oldPrice'          => $this->_registerJsPrice($this->_convertPrice($currentProduct->getPrice())),
                'productId'         => $currentProduct->getId(),
                'chooseText'        => Mage::helper('catalog')->__('Choose an Option...'),
                'taxConfig'         => $taxConfig
        );

        if ($preconfiguredFlag && !empty($defaultValues)) {
            $config['defaultValues'] = $defaultValues;
        }

        $config = array_merge($config, $this->_getAdditionalConfig());    

        return Mage::helper('core')->jsonEncode($config);
    }

    /**
     * Sort the options based off their position.
     *
     * @param array $options
     * @return array
     */
    protected function _sortOptions($options)
    {
        if (count($options)) {
            if (!$this->_read || !$this->_tbl_eav_attribute_option) {
                $resource = Mage::getSingleton('core/resource');

                $this->_read = $resource->getConnection('core_read');
                $this->_tbl_eav_attribute_option = $resource->getTableName('eav_attribute_option');
            }

            // Gather the option_id for all our current options
            $option_ids = array();
            foreach ($options as $option) {
                $option_ids[] = $option['id'];

                $var_name  = 'option_id_'.$option['id'];
                $$var_name = $option;
            }

            $sql    = "SELECT `option_id` FROM `{$this->_tbl_eav_attribute_option}` WHERE `option_id` IN('".implode('\',\'', $option_ids)."') ORDER BY `sort_order`";
            $result = $this->_read->fetchCol($sql);

            $options = array();
            foreach ($result as $option_id) {
                $var_name  = 'option_id_'.$option_id;
                $options[] = $$var_name;
            }
        }

        return $options;
    }
}

4 단계 : 활성화 된 경우 관리자 패널의 시스템-> 캐시 관리에서 Magento의 "구성"캐시 유형을 새로 고칩니다.

확장 개요

  1. Mage_Catalog_Block_Product_View_Type_Configurable 클래스를 확장하십시오.
  2. position데이터베이스에서이 정보를 가져 와서 값을 기준으로 옵션을 정렬하는 방법을 추가하십시오 .
  3. 속성에 대한 옵션을 수집 한 후 새 함수를 호출하도록 getJsonConfig 메소드를 다시 작성하십시오.

2
환상적으로 작동하며 솔루션이 향후 업그레이드에 영향을 미치지 않는 것을 기쁘게 생각합니다. 실행 가능한 솔루션을 제공해 주셔서 감사합니다.
— dawhoo

안녕하세요 @Meogi 귀하의 수정 사항이 속성 값에 완벽하게 보이지만 모든 것이 제품 선택 상자 자체에 적합해야합니까? 속성 세트 내에서 설정 한 방식대로 주문할 때 문제가 발견되었습니다. 예를 들어, 속성 세트 내에서 "Color"를 "Size"위로 끌어 놓았지만 1.9.1은 2를 바꿨습니다 (순서 무시). 이 문제를 해결하는 유일한 방법은 제품 자체를 편집하고 구성 가능한 항목 내에서 순서를 끌어 오는 것입니다. 어쩌면 이것은 실수로 이전에 수동으로 재주문 한 불량 제품일까요?
— Joe

1
@Joe 내가 실수하지 않으면, 속성 세트에서 속성을 위 / 아래로 드래그해도 프론트 엔드 제품 세부 사항 페이지에 표시되는 순서에는 영향을 미치지 않습니다. 대신, 카탈로그-> 속성-> 속성 관리로 이동하여 속성을 찾고 "위치"값을 편집해야합니다. 이는 구성 가능한 속성이 제품 페이지에 표시되는 순서와 계층 탐색에 모두 영향을줍니다. 구성 가능한 옵션 순서는 관리자별로 "관련 제품"탭으로 이동하여 속성을 위 / 아래로 끌어서 제품별로 재정의 할 수 있습니다.
— Darren Felton

1
@Meogi "계층 탐색에서 사용"을 활성화 할 때 계층 탐색 블록 위치에만 해당됩니다.
— Joe

@Joe 알다시피, 기본 설정을 변경하는 방법을 모르겠습니다 (항상 속성 세트에 배치되었을 수도 있지만 확실하지 않습니다). Magento 1.9.1.0 설치에서 구성 가능한 제품의 "관련 제품"탭에서 클릭 / 드래그 업 / 다운을 클릭하여 원하는 순서로 설정할 수 있다고 말할 수 있습니다. 빠른 작성 양식과 맨 아래의 제품 표 사이에 나열됩니다.
— Darren Felton

11

내 두 센트를 추가하기 위해 다른 두 대답은 나를 수정의 방향으로 안내하는 데 효과적이지만 블록 표시 지점이 아닌 소스에서 공격 할 것이라고 생각했습니다.

Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection모델의 _loadPrices()방법에도 불구하고 이름이 바뀌었을 때 (성능에 따라) 속성이 관련성이 아니라 ID별로 정렬되어 동일한 결과를 얻을 수 있습니다 .

중첩 된 foreach명령문 을 피하기 위해 변경된 것으로 보이지만 올바른 순서도 손실됩니다. 이 솔루션은 업데이트 된 로직을 약간 수정하여 속성 옵션을 추적 한 다음 원래 순서에 따라 다른 루프를 수행하여 실제로 추가를 수행합니다.

다음은 위의 meogi의 답변 과 비슷한 조정 된 연습입니다 .


1 단계 : 새 모듈 등록

참고 : 이미있는 경우 기존을 다시 사용하십시오.

# File: app/etc/modules/YourCompany_AttributeFix.xml
<?xml version="1.0"?>
<config>
    <modules>
        <YourCompany_AttributeFix>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Catalog />
            </depends>
        </YourCompany_AttributeFix>
    </modules>
</config>

2 단계 : 모듈 구성 만들기

# File: app/code/local/YourCompany/AttributeFix/etc/config.xml
<?xml version="1.0"?>
<config>
    <modules>
        <YourCompany_AttributeFix>
            <version>0.1.0</version>
        </YourCompany_AttributeFix>
    </modules>    
    <global>
        <models>
            <catalog_resource>
                <rewrite>
                    <product_type_configurable_attribute_collection>YourCompany_AttributeFix_Model_Resource_Product_Type_Configurable_Attribute_Collection</product_type_configurable_attribute_collection>
                </rewrite>
            </catalog_resource>
        </models>
    </global>
</config>

3 단계 : 자원 모델 확장 추가

# File: app/code/local/YourCompany/AttributeFix/Model/Resource/Product/Type/Configurable/Attribute/Collection.php
/**
 * Catalog Configurable Product Attribute Collection - overridden to re-enable the attribute option
 * sorting by relevance rather than by ID as changed in the Magento core class
 */
class YourCompany_AttributeFix_Model_Resource_Product_Type_Configurable_Attribute_Collection
    extends Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection
{
    /**
     * Load attribute prices information
     *
     * @return Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection
     */
    protected function _loadPrices()
    {
        if ($this->count()) {
            $pricings = array(
                0 => array()
            );

            if ($this->getHelper()->isPriceGlobal()) {
                $websiteId = 0;
            } else {
                $websiteId = (int)Mage::app()->getStore($this->getStoreId())->getWebsiteId();
                $pricing[$websiteId] = array();
            }

            $select = $this->getConnection()->select()
                ->from(array('price' => $this->_priceTable))
                ->where('price.product_super_attribute_id IN (?)', array_keys($this->_items));

            if ($websiteId > 0) {
                $select->where('price.website_id IN(?)', array(0, $websiteId));
            } else {
                $select->where('price.website_id = ?', 0);
            }

            $query = $this->getConnection()->query($select);

            while ($row = $query->fetch()) {
                $pricings[(int)$row['website_id']][] = $row;
            }

            $values = array();

            foreach ($this->_items as $item) {
                $productAttribute = $item->getProductAttribute();
                if (!($productAttribute instanceof Mage_Eav_Model_Entity_Attribute_Abstract)) {
                    continue;
                }
                $options = $productAttribute->getFrontend()->getSelectOptions();

                $optionsByValue = array();
                foreach ($options as $option) {
                    $optionsByValue[$option['value']] = $option['label'];
                }

                /**
                 * Modification to re-enable the sorting by relevance for attribute options
                 * @author Robbie Averill <robbie.averill@kathmandu.co.nz>
                 */
                $toAdd = array();
                foreach ($this->getProduct()->getTypeInstance(true)
                             ->getUsedProducts(array($productAttribute->getAttributeCode()), $this->getProduct())
                         as $associatedProduct) {

                    $optionValue = $associatedProduct->getData($productAttribute->getAttributeCode());

                    if (array_key_exists($optionValue, $optionsByValue)) {
                        $toAdd[] = $optionValue;
                    }
                }

                // Add the attribute options, but in the relevant order rather than by ID
                foreach (array_intersect_key($optionsByValue, array_flip($toAdd)) as $optionValueKey => $optionValue) {
                    // If option available in associated product
                    if (!isset($values[$item->getId() . ':' . $optionValue])) {
                        // If option not added, we will add it.
                        $values[$item->getId() . ':' . $optionValueKey] = array(
                            'product_super_attribute_id' => $item->getId(),
                            'value_index'                => $optionValueKey,
                            'label'                      => $optionsByValue[$optionValueKey],
                            'default_label'              => $optionsByValue[$optionValueKey],
                            'store_label'                => $optionsByValue[$optionValueKey],
                            'is_percent'                 => 0,
                            'pricing_value'              => null,
                            'use_default_value'          => true
                        );
                    }
                }
                /**
                 * End attribute option order modification
                 * @author Robbie Averill <robbie.averill@kathmandu.co.nz>
                 */
            }

            foreach ($pricings[0] as $pricing) {
                // Addding pricing to options
                $valueKey = $pricing['product_super_attribute_id'] . ':' . $pricing['value_index'];
                if (isset($values[$valueKey])) {
                    $values[$valueKey]['pricing_value']     = $pricing['pricing_value'];
                    $values[$valueKey]['is_percent']        = $pricing['is_percent'];
                    $values[$valueKey]['value_id']          = $pricing['value_id'];
                    $values[$valueKey]['use_default_value'] = true;
                }
            }

            if ($websiteId && isset($pricings[$websiteId])) {
                foreach ($pricings[$websiteId] as $pricing) {
                    $valueKey = $pricing['product_super_attribute_id'] . ':' . $pricing['value_index'];
                    if (isset($values[$valueKey])) {
                        $values[$valueKey]['pricing_value']     = $pricing['pricing_value'];
                        $values[$valueKey]['is_percent']        = $pricing['is_percent'];
                        $values[$valueKey]['value_id']          = $pricing['value_id'];
                        $values[$valueKey]['use_default_value'] = false;
                    }
                }
            }

            foreach ($values as $data) {
                $this->getItemById($data['product_super_attribute_id'])->addPrice($data);
            }
        }
        return $this;
    }
}

4 단계 : 캐시 지우기


참고로 코어 클래스의 실제 변경 사항 git diff은 다음과 같습니다 (코어 파일을 직접 편집하지 마십시오!).

diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php
index 135d9d3..4d2a59b 100644
--- a/app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php
+++ b/app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php
@@ -254,6 +254,11 @@ class Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection
                     $optionsByValue[$option['value']] = $option['label'];
                 }

+                /**
+                 * Modification to re-enable the sorting by relevance for attribute options
+                 * @author Robbie Averill <robbie.averill@kathmandu.co.nz>
+                 */
+                $toAdd = array();
                 foreach ($this->getProduct()->getTypeInstance(true)
                              ->getUsedProducts(array($productAttribute->getAttributeCode()), $this->getProduct())
                          as $associatedProduct) {
@@ -261,22 +266,31 @@ class Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection
                     $optionValue = $associatedProduct->getData($productAttribute->getAttributeCode());

                     if (array_key_exists($optionValue, $optionsByValue)) {
-                        // If option available in associated product
-                        if (!isset($values[$item->getId() . ':' . $optionValue])) {
-                            // If option not added, we will add it.
-                            $values[$item->getId() . ':' . $optionValue] = array(
-                                'product_super_attribute_id' => $item->getId(),
-                                'value_index'                => $optionValue,
-                                'label'                      => $optionsByValue[$optionValue],
-                                'default_label'              => $optionsByValue[$optionValue],
-                                'store_label'                => $optionsByValue[$optionValue],
-                                'is_percent'                 => 0,
-                                'pricing_value'              => null,
-                                'use_default_value'          => true
-                            );
-                        }
+                        $toAdd[] = $optionValue;
                     }
                 }
+
+                // Add the attribute options, but in the relevant order rather than by ID
+                foreach (array_intersect_key($optionsByValue, array_flip($toAdd)) as $optionValueKey => $optionValue) {
+                    // If option available in associated product
+                    if (!isset($values[$item->getId() . ':' . $optionValue])) {
+                        // If option not added, we will add it.
+                        $values[$item->getId() . ':' . $optionValueKey] = array(
+                            'product_super_attribute_id' => $item->getId(),
+                            'value_index'                => $optionValueKey,
+                            'label'                      => $optionsByValue[$optionValueKey],
+                            'default_label'              => $optionsByValue[$optionValueKey],
+                            'store_label'                => $optionsByValue[$optionValueKey],
+                            'is_percent'                 => 0,
+                            'pricing_value'              => null,
+                            'use_default_value'          => true
+                        );
+                    }
+                }
+                /**
+                 * End attribute option order modification
+                 * @author Robbie Averill <robbie.averill@kathmandu.co.nz>
+                 */
             }

             foreach ($pricings[0] as $pricing) {

누군가가 참조하기를 원한다면 이것은 GitHub에도 있습니다 .

편집 : 나는 이것을 Magento의 버그로 기록했습니다 .


1
내 친구에게 굉장한 공헌. +1 (예, 감사의 말을하기 위해이 의견을 쓰지 말아야하지만 당신은 그것을 죽였으므로 하하해야합니다)
— Darren Felton

나는 magento 1.9.2로 시도했다. 그리고 나는 왜이 버그가 여전히 Magento에 의해 수정되지 않았는지 이해하지 못합니다.
— Reinsch

모듈이 올바르게 구성되었는지 확인 했습니까? 나는 그들이 그것을 알고 있다고 확신하지만, 시스템의 매우 중요한 부분이기 때문에 패치를 릴리스하기 전에 확인하는 데 시간이 걸릴 것입니다. 편집 : 직접 (및 임시) 수정 사항을 테스트 할 수도 있지만 패치를 코어 클래스에 직접 복사 할 수도 있습니다 (임시)
— Robbie Averill

1
@Reinsch CE 1.9.2와의 비 호환성에 대해 누군가에게 이메일을 받았습니다. Github 저장소에 대한 업데이트를 푸시하고 Magento 샘플 데이터를 사용하여 CE 1.9.2에서 테스트했으며 올바르게 작동합니다
— Robbie Averill

1
@RobbieAverill의 훌륭한 작품-대단히 감사합니다. Magento 1.9.2.1 웹 사이트에서 작동하는지 테스트하고 확인했습니다.
— zigojacko

3

이것은 실제로 올바른 수정은 아니지만 다음 Magento 릴리스가 문제를 올바르게 해결할 때까지 1.9.0.1로 돌아 가지 않도록 일시적으로 수행 한 것입니다. 옵션 값을 사전 순으로 정렬합니다. 물론 원하는대로 정렬 할 수는 있지만 백엔드에서 설정된 정렬 순서에 액세스하는 방법을 모르고 사전 순으로 내 목적에 충분합니다.

파일 변경

/app/code/core/Mage/Catalog/Block/Product/View/Type/configurable.php

215 행 변경

if($this->_validateAttributeInfo($info)) {
   $attributes[$attributeId] = $info;
}

에

usort($info['options'], function ($a,$b)
    {
        return strcmp($a['label'],$b['label']);
    }
);
if($this->_validateAttributeInfo($info)) {
   $attributes[$attributeId] = $info;
}

2
Magento의 핵심 라이브러리를 직접 수정하지 않고 적절하게 확장하는 답변에 대한 내 대답을 참조하십시오. 그럼에도 불구하고 스티브 에게이 대답을 해준 이유는 내가 생각해 낸 솔루션을 개발할 위치를 아는 데 크게 도움이 되었기 때문입니다.
— 대런 펠턴

하루 종일 저축 한 덕분에 Enterprise의 매력처럼 훌륭하게 작동했습니다 ..
— Bharath
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.