I'm trying to call a custom attribute in the cart.phtml and success.phtml pages so that a module can see the text that is contained. The attribute is a dropdown that isn't visible on the frontend at all.
The attribute contains a keyword that the module searches for, if the keyword is found, different finance options appear.
I've got this working on the product page by adding the following to view.phtml and it works perfectly but using the same/similar code on cart.phtml and success.phtml does not work:
$pro->getAttributeText('my_attribute')
I've done some searches and found that I needed to create a custom module and add the attribute in the config.xml of this module but that didn't work. My php knowledge isn't great so I'm sure I'm missing something.
This is what the snippet of code looks like from cart.phtml:
$prodname = "";
if($cart->getAllItems()):
foreach ($cart->getAllItems() as $item):
$prodname .= "|||".$item->getProduct()->getAttributeText('my_attribute').$item->getProduct()->getName();
endforeach;
endif;
I've also tried with $_item and without the ->getProduct() with no luck.
In the admin panel I can see my custom module where I've put the config.xml is enabled. This is the config.xml:
<config>
<modules>
<module_name>
<version>0.0.1</version>
</module_name>
</modules>
<global>
<sales>
<quote>
<item>
<product_attributes>
<my_attribute />
</product_attributes>
</item>
</quote>
</sales>
</global>
</config>
Help me stackexchange, you're my only hope