0

I want track quote items color and brand in our checkout process. Regarding this answer I should do this in config.xml:

<global>
    <sales>
        <quote>
            <item>
                <product_attributes>
                    <color />
                </product_attributes>
            </item>
        </quote>
    </sales>
</global>

And this in my checkout process:

<?php 
    foreach($cartItems as $_quoteItem) {
        echo $_quoteItem->getProduct()->getAttributeText('color');
    } 
?>

But this is not working - result is nothing.

0

Your config.xml file is correct, however, retrieving the attribute value for configurable or simple products differs. If you have configurable product in cart, but the attributes are set for its simple products, consider this solution:

foreach ($cartItems as $_quoteItem) {
    $simpleProductOption = $_quoteItem->getOptionByCode('simple_product');
    $color = $simpleProductOption->getProduct()->getAttributeText('color');
}

Sorry, I do not have enough reputation to comment/ask whether you need this done for configurable products or simple products, or any other products, but I hope this helps you!

  • We are using both. The configurable products are the containers for our simple products. But I am really new to this stuff - could be that I mixed up something. – Jurik May 10 '16 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.