0

i am trying to create a new product detail page for only quick view section, rest of functionality i have completed and my final URL of product is like

https://example.com/product_quick_view/product/quickview/id/18295

I have added this functionality as a new module. most of things are working fine but few blocks are not loading because of those blocks are define in .xml file only for this <catalog_product_view> page.

i wonder is there any option in magento layout files that i can create above type of tag and import blocks into my new product view phtml file.

My Class name is: ProductQuickView_Block_Product

Template file is coming from /template/quick-view/product.phtml

i tried other method like this:

<?php echo $layout->createBlock('catalog/product_view_media')->setTemplate('catalog/product/view/media.phtml')->toHtml(); ?>

and its working fine but i don't think so its a clean way to do rest of stuff...i will appreciate if anyone can help me to do this in layout way.

  • Hi, there is something unclear for me : where and how did you define the block which has the template template/quick-view/product.phtml ? I mean, did you declare it in a xml layout with something like <block type="product_quick_view/product" name="whatever-you-want" template="/template/quick-view/product.phtml"/> ? – Julien Loizelet Mar 5 '18 at 20:50
0

if you want to modify the design of a page with the url

`https://example.com/product_quick_view/product/quickview/id/XXXX`

you should use the handle <product_quick_view_product_quickview>. (because an handle is always like <router_controller_action>).

So, if you want to add a block of type product_quick_view/product (I supposed here that the alias of your block type is product_quick_view), you should write something like :

<product_quick_view_product_quickview>
     <reference name="content">
         <block type="product_quick_view/product" name="product.quick.view.product" template="template/quick-view/product.phtml"/>
     </reference>
</product_quick_view_product_quickview>

And if you want to add child called product.quick.view.product.child1, you should write :

<product_quick_view_product_quickview>
     <reference name="content">
         <block type="product_quick_view/product" name="product.quick.view.product" template="template/quick-view/product.phtml">
            <block type="catalog/product_view_media" name="product.quick.view.product.child1"  template="catalog/product/view/media.phtml"/>
        </block>
     </reference>
</product_quick_view_product_quickview>

To display the child, you will have to write

`echo $this->getChildHtml('product.quick.view.product.child1');` 

in the template/quick-view/product.phtml template.

Hope it helps.

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.