2

I'm quite new into magento and for some reason i can't seem to find a good solution!

I'm currently running a Magento shop with Ultimo Theme, great theme but there is one catch! It doesn't have a "Quickview" option...

Now, i dont want to use any extra modules but for once i'm trying to implement it my self!

It's almost working, but the only thing left to do is that i need to have a minified product page

For example if you go to http://example.com/product.html you see the whole page but as soon as you try to load http://example.com/product.html?minified=yes you should see a custom template....

What is the easiest way to do this?

3

You can do this by magento event Observer

Create an event on controller_action_layout_load_before and add a new template on this events and

See more at

https://stackoverflow.com/questions/7123483/conditionally-add-blocks-in-magento-layout http://blog.mattstephens.co.uk/post/26827632719/adding-a-custom-layout-xml-handle-in-magento

Step1:Add this at config.xml code is like

<frontend>
    <events>
        <controller_action_layout_load_before>
            <observers>
                <add_new_block>
                    <class>CUSTOM_MODULE/observer</class>
                    <method>beforeLoadLayout</method>
                </add_new_block>
            </observers>
        </controller_action_layout_load_before>
    </events>
</frontend>

Step2: create a new block

$block = $this->getLayout()->createBlock(
'Mage_Core_Block_Template',
'my_block_name_here',
array('template' => 'activecodeline/developer.phtml')
);

Study:http://inchoo.net/magento/programatically-create-magento-blocks-and-inject-them-into-layout/

Step3: then append it on event your reference block and code

    public function beforeLoadLayout($observer)
{   
if( Mage::app()->getRequest()->getParam('minified')=='yes')
    $block = $this->getLayout()->createBlock(
    'Mage_Core_Block_Template',
    'my_block_name_here',
    array('template' => 'activecodeline/developer.phtml')
    );

       /* new block at content area */
    $observer->getEvent()->getLayout()->getUpdate()->getBlock('content')->append($block);
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.