How are the magento enterprise banner xml nodes inserted into the layout xml? -
background
i have taken on development of magento enterprise website has custom theme. when custom theme created base default templates used rather enterprise default templates , therefore theme doesn't have of enterprise functionality.
i've setup vanilla magento enterprise install matches version number used on site (1.11.1.0) , i'm working through diffing 2 sites , adding functionality in 1 module @ time.
however i've run hurdle how banner functionality works , therefore having problems trying debug missing custom theme them work correctly.
what know
the functionality works fine on vanilla enterprise site.
there's no xml layout files banner module, makes sense created dynamically within admin section allows select page/block want insert banner widgets into.
using commerce bug , looking @ compiled page layout xml banner xml nodes being inserted not being created programatically (via php) within other templates or blocks.
i've looked right through banner module , in observers/events can't see of relevance how nodes being inserted.
it seem coupled enterprise cms module.
i've found references banners in fpc module, fpc not in use on site , methods not hit when fpc disabled.
i've double checked , module output not disabled within admin advanced.
i'm using designfallbacks module enterprise/default , hasn't helped either.
i've setup banners in exact same way on custom site in vanilla enterprise site compiled xml not have banner nodes being inserted.
i've searched across google , stack overflow information on enterprise banners limited , find talks admin section , not how function code level.
all leads to...
what i'd know
how/where banner xml nodes make way layout xml.
the mage_core_model_layout_update
class @ app/code/core/mage/core/model/layout/update.php
contains code responsible loading package layout xml. normally, of handled in fetchfilelayoutupdates
method.
however, there's lesser known method in class named fetchdblayoutupdates
. method loads layout update xml from database , merges package layout.
public function fetchdblayoutupdates($handle) { $_profilerkey = 'layout/db_update: '.$handle; varien_profiler::start($_profilerkey); $updatestr = mage::getresourcemodel('core/layout')->fetchupdatesbyhandle($handle); if (!$updatestr) { return false; } $updatestr = '<update_xml>' . $updatestr . '</update_xml>'; $updatestr = str_replace($this->_subst['from'], $this->_subst['to'], $updatestr); $updatexml = simplexml_load_string($updatestr, $this->getelementclass()); $this->fetchrecursiveupdates($updatexml); $this->addupdate($updatexml->innerxml()); varien_profiler::stop($_profilerkey); return true; }
the mage::getresourcemodel('core/layout')
resource model corresponds core_layout_update
table. in magento enterprise, table banner related layout updates stored.
mysql> select * core_layout_update\g *************************** 1. row *************************** layout_update_id: 1 handle: cms_index_index xml: <reference name="top.container"><block type="enterprise_banner/widget_banner" name="b6d24980179958bad81911d80bce5f36" template="banner/widget/block.phtml"><action method="setdata"><name>display_mode</name><value>fixed</value></action><action method="setdata"><name>banner_ids</name><value>1</value></action><action method="setdata"><name>unique_id</name><value>e2fb0962e605ed01d3759cf531402534</value></action></block></reference> sort_order: 0 *************************** 2. row *************************** layout_update_id: 2 handle: cms_index_index xml: <reference name="footer.before"><block type="enterprise_banner/widget_banner" name="2b2de5c74183936eb4514e860a09e265" template="banner/widget/block.phtml"><action method="setdata"><name>display_mode</name><value>fixed</value></action><action method="setdata"><name>banner_ids</name><value>2</value></action><action method="setdata"><name>unique_id</name><value>1760872fb38c6042c8aee848bf86bf59</value></action></block></reference>
this table isn't banner updates — it's developers of enterprise_banner module chose use functionality of fetchdblayoutupdates
implement features.
Comments
Post a Comment