1

I have this strange issue while adding certain child product of configurable. It gives "Please choose specific options (size / colour) of the product and then click the Saved Lists icon." message which is basically "Please specify the product's option(s)." message.

This is custom size attribute with 480+ options.

I am curious whether the code flow got lost in too many filtrations ? I have debugged up to Mage/Catalog/Model/Product/Type/Configurable.php >> method getProductByAttributes >> line number 503 in the attached core file. It gets lost from above line number.

I'll be very thankful for your great help to know what's wrong.

Here is the product url

Options: Width = Wide, Size = 10 (and 6)

The child product has enough qty (more than 10)

This is a live site where requires login to see the price and add to cart so I have created a video walkthrough to show frontend and backend to explain the issue here.

Here is the portion of code where I've reached so far of Mage_Catalog_Model_Product_Type_Configurable

public function getProductByAttributes($attributesInfo, $product = null)
{
    if (is_array($attributesInfo) && !empty($attributesInfo)) {
        $productCollection = $this->getUsedProductCollection($product)->addAttributeToSelect('name');

        foreach ($attributesInfo as $attributeId => $attributeValue) {
            $productCollection->addAttributeToFilter($attributeId, $attributeValue);
        }

        $productObject = $productCollection->getFirstItem();
        if ($productObject->getId()) {


            return $productObject;
        }

        /**
         * Size option's value get lost by here
         * So it returns null
         */

        //Mage::log($attributesInfo, null, 'debug-product-options.txt');

        foreach ($this->getUsedProducts(null, $product) as $productObject) {
            $checkRes = true;
            foreach ($attributesInfo as $attributeId => $attributeValue) {
                $code = $this->getAttributeById($attributeId, $product)->getAttributeCode();

                if ($productObject->getData($code) != $attributeValue) {
                    $checkRes = false;
                }
            }



            if ($checkRes) {
                return $productObject;
            }
        }
    }
    return null;
}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.