I'm following this guide (product attribute to quote item and order item) however for whatever reason I seem unable to retrieve my attribute in my observer. My attribute I created is called "budgetcode" and is assigned to the product I'm trying to purchase. In my observer I'm attempting to use the same theory as the above post however my "budgetcode" attribute appears so deep within the schema I cannot retrieve it. I did Zend_Debug::dump($item)
and can see a massive output (too big to paste) with my budgetcode shown way down, problem is I can't seem to retrieve it.
Observer.php
class Bendart_BudgetCode_Model_Observer extends Varien_Event_Observer
{
public function setBudgetCodeAttribute(Varien_Event_Observer $observer)
{
$item = $observer->getQuoteItem();
Zend_Debug::dump($item);
$product = $observer->getProduct();
$item->setBudgetCode($product->getBudgetCode());
return $this;
}
}
config.xml
<?xml version="1.0"?>
<config>
<modules>
<Bendart_BudgetCode>
<version>0.1.0</version>
</Bendart_BudgetCode>
</modules>
<global>
<fieldsets>
<sales_convert_quote_item>
<budgetcode>
<to_order_item>*</to_order_item>
</budgetcode>
</sales_convert_quote_item>
</fieldsets>
<sales>
<quote>
<item>
<product_attributes>
<budgetcode />
</product_attributes>
</item>
</quote>
</sales>
<events>
<sales_quote_item_set_product>
<observers>
<Bendart_BudgetCode>
<class>Bendart_BudgetCode_Model_Observer</class>
<method>setBudgetCodeAttribute</method>
</Bendart_BudgetCode>
</observers>
</sales_quote_item_set_product>
</events>
</global>
</config>
Any help is appreciated.