How does Mag :: Assistant work in Magento?

I tried to understand this line of code.

$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());

      

1.to begin with, a variable was declared ($_attributes)

2. Mage::helper('core')

Is the helper the method that loads the object? What is it core

? file? where to find this file?

3. decorateArray

Is this method from core class

?

Could you please tell me how this code works and give me a simple example?

I tried to do this short example on my page

$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
<?php if($_product->isSaleable() && count($_attributes)){
   echo "de vanzare";
}
?>

      

The condition may be evaluated as a false message and not displayed. I get no error, but it doesn't work.

I wanted to see if I understood how it works Mage::helper

(which is why I made this example)

Thanks in advance!

+3


source to share


2 answers


Mage::helper('core')

belongs to Application / Code / Core / Mage / Core / Helper. You can find decorateArray () in data.php inside this path.



The Mage folder contains the core classes for magento.

+1


source


Mage :: helper ('myHelper') will load the helper to call, here you will load the Mage_Core_Helper_Data helper.



The $ _ attributes will contain the result of the called function, here the decorateArray function, which is in Mage_Core_Helper_Data.

0


source







All Articles