0

I've file like app/code/local/Xx/Multistepcheckout/Block/Cart/Item/Renderer.php

In which I've function like following

public function checkItemStatus($_item, $qty, $sku) {
        $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
        $_product = Mage::getModel('catalog/product')->load($product->getId());
        $stockstatus = $_product->getXxxstatus();
        //Rest of the code....
}

Here in function I don't want to use following lines

$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);

$_product = Mage::getModel('catalog/product')->load($product->getId());

Try 1 : So to do so I've add following code in config.xml

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

And in this file app/code/local/Xx/Multistepcheckout/Block/Cart/Item/Renderer.php I've used like $_item->getData('xxxstatus')) but it's not working.

So is there any way in which I can reduce the use of load() method?

Let me know if you want more details.

1 Answer 1

0

Anyways I've sorted using following..

$_item->getProduct()->getData('attributecode');

in function checkItemStatus($_item, $qty, $sku) .

Thanks.

Your Answer

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

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