Reputation: 61
I tried to understand this line of code.
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
1.for started was declared a variable ($_attributes)
2.Mage::helper('core')
helper is a method that loads an object? What is core
? a file? where to find this file?
3.decorateArray
is a method from core class
?
Can you tell me please how this code works and give me a simple example?
I tried to make this short example in my page
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
<?php if($_product->isSaleable() && count($_attributes)){
echo "de vanzare";
}
?>
Perhaps the condition is evaluated false message and not displayed. I get no error, but not working.
I wanted to see if I understand how it works Mage::helper
(that's why I made this example)
Thanks in advance!
Upvotes: 3
Views: 6242
Reputation: 1864
Mage::helper('core')
belongs to app/code/core/Mage/Core/Helper. You can find decorateArray() into data.php inside this path.
Mage folder contains core classes for magento.
Upvotes: 1
Reputation: 1222
Mage::helper('myHelper') will load the called helper, here you load the Mage_Core_Helper_Data helper.
$_attributes will contain the result of the function you called, here the function decorateArray which is in Mage_Core_Helper_Data.
Upvotes: 0