Page 1 of 1

Best way to create a custom template and structure

Posted: 21 Jul 2015, 09:34
by larryweya
First great product, exactly what I've been looking for and was almost building from scratch.

I'm trying to create a custom template whose structure is completely different from the defaults, I've created an extension using the online tool and started modifying the templates one by one, which feels pretty tedious, is this the preferred approach? In some cases e.g. for the catalog filter, I've had to create new classes and copy all the contents just to modify the tree markup.

on a related note, I plan to have multiple stores, each with a custom template, what would be the best way to have the template determined by the site/shop?

Re: Best way to create a custom template and structure

Posted: 21 Jul 2015, 11:50
by aimeos
larryweya wrote:First great product, exactly what I've been looking for and was almost building from scratch.
Thanks, we hope you enjoy it :-)
larryweya wrote:I'm trying to create a custom template whose structure is completely different from the defaults, I've created an extension using the online tool and started modifying the templates one by one, which feels pretty tedious, is this the preferred approach? In some cases e.g. for the catalog filter, I've had to create new classes and copy all the contents just to modify the tree markup.
The first question is: Why do you want to change all templates? What special requirements do you have for doing this? Normally, people change a few ones at max, like the item list view or something in the detail view. As the templates are strictly structural markup only, you can change the layout in almost any way using just CSS3.

You are also able to add new, remove or move existing template subparts only be configuration. That makes the layout very flexible so you are the first one saying that you need to change all templates.

Building the category tree using a view helper might not be the end of wisdom. Maybe we will change that to use partials in the future.
larryweya wrote:on a related note, I plan to have multiple stores, each with a custom template, what would be the best way to have the template determined by the site/shop?
In a CMS application where you can assign completely different sets of configurations to each page, this works out of the box. In a pure Laravel application it's a little bit more difficult.

If you only need different CSS, you could do this rather easy by adding the site code as CSS class to each component. For completely different configurations, you would need to modify the Aimeos\Shop\Base\Context code to load site specific configuration from the config file if available.

In both cases, we would love to get a patch which we could integrate :-)

Re: Best way to create a custom template and structure

Posted: 21 Jul 2015, 13:00
by larryweya
Thanks for the quick response.

Having to change ALL the templates is definitely an overstatement. So far I've had to change the mini basket, I'm working on the list and will probably have to change the detail, full basket and checkout templates. I'm using a pre-built template with its own css class names for various containers so changing the templates seems easier than fiddling with the css styles because that would mean duplicating a lot of the styles to give them aimeos specific names.

So far its not as tedious as I had imagined.

On the multitenancy within laravel, I've also been thinking along the lines of different shop config files per template but I'm yet to look into how aimeos walks through the extension directory because I would imagine I would need to only consider the current shop's template extension directory and ignore the rest, and only those that are template extensions and not others that may be shared by all shops. Perhaps a separate template extensions directory. I'll definitely post if I make some progress with this.

Re: Best way to create a custom template and structure

Posted: 21 Jul 2015, 16:41
by aimeos
larryweya wrote: I'm using a pre-built template with its own css class names for various containers so changing the templates seems easier than fiddling with the css styles because that would mean duplicating a lot of the styles to give them aimeos specific names.
OK, that's a valid point and a weak part of CSS because you can't assign classes to each other.
larryweya wrote: On the multitenancy within laravel, I've also been thinking along the lines of different shop config files per template but I'm yet to look into how aimeos walks through the extension directory because I would imagine I would need to only consider the current shop's template extension directory and ignore the rest, and only those that are template extensions and not others that may be shared by all shops. Perhaps a separate template extensions directory. I'll definitely post if I make some progress with this.
It would be enough to add a new section "sites" to the existing config file where site specific configuration could be added. A possibility would be to use different "extdir" locations (and therefore extensions) per site.

Re: Best way to create a custom template and structure

Posted: 27 Aug 2015, 08:55
by aimeos
larryweya wrote:In some cases e.g. for the catalog filter, I've had to create new classes and copy all the contents just to modify the tree markup.
We've replaced the view helpers by partials in the latest version which will make it much easier to change the markup :-)
https://github.com/aimeos/aimeos-core/t ... n/partials