php - ifconfig parameter with store condition -


in magento xml layut or config file can write ifconfig parameter in tag apply condition this

<action method="addlink" translate="label title" module="contacts"     ifconfig="contacts/contacts/enabled"> <label>contact us</label> <url>contacts</url> <title>contact us</title> <prepare>true</prepare> </action> 

i trying find ifconfig alternative of function

mage::getstoreconfig($path,mage::app()->getstore()); 

so can include store condition along path in ifconfig. appreciated.

there no built in way that, because ifconfig constraint used current store. when calling mage::getstroreconfig() 1 parameter current store used second parameter. , layout loaded current store.
if insist, here possible idea on how it.
action tags in layout parsed , applied in method mage_core_model_layout::_generateaction(). piece of code checks ifconfig attribute.

if (isset($node['ifconfig']) && ($configpath = (string)$node['ifconfig'])) {     if (!mage::getstoreconfigflag($configpath)) {         return $this;     } } 

you can override method allow additional parameter store. xml code this:

<action method="somemethod" ifconfig="some/config/path" store="2" /> 

now change code above calls action this:

if (isset($node['ifconfig']) && ($configpath = (string)$node['ifconfig'])) {     if (isset($node['store'])){//check config setting supplied store         if (!mage::getstoreconfigflag($configpath, $node['store'])) {             return $this;         }     }     else{//default behavior         if (!mage::getstoreconfigflag($configpath)) {             return $this;         }     }    } 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -