VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: tkejmullins on June 29, 2015, 22:56:58 PM

Title: Different Sublayouts for different product categories?
Post by: tkejmullins on June 29, 2015, 22:56:58 PM
I have looked for several hours, including http://docs.virtuemart.net/tutorials/templating-layouts/199-sublayouts.html.  I can not find a simple explanation as to how I would use a sublayout for 1 product category, but use a different sublayout for a different product category.  The  only setting I see is for the entire store in the configuration.  I use template overrides, but I need to also customize the products.php sublayout for different product categories.

VM 3.0.9.4
Joomla 3.4.1

Any help would be greatly appreciated.
Title: Re: Different Sublayouts for different product categories?
Post by: GJC Web Design on June 29, 2015, 23:30:54 PM
the way I do it  - no idea if the right way..  is make my sublayout  in templates\xxxx\html\com_virtuemart\sublayouts\products-mylayout.php

then a cat over ride in templates\xxxx\html\com_virtuemart\category\default-mylayout.php

in there call

echo shopFunctionsF::renderVmSubLayout('products-mylayout',array('products'=>$products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));


and then in the cat admin choose the template default-mylayout
Title: Re: Different Sublayouts for different product categories?
Post by: jenkinhill on June 29, 2015, 23:50:19 PM
I do it that way, too.
Title: Re: Different Sublayouts for different product categories?
Post by: tkejmullins on June 30, 2015, 02:30:06 AM
Works perfect!!!

Thank you,