Assign different templates for multiple sites?

I would think this would be a common situation, but how do you define a theme for multi site Pimcore installations? The sites will share controllers and views, with the only thing varying being the base layout template. Do you usually define that using website settings? I’m having a surprisingly difficult time finding a “best approach”. For example, say I have 3 sites:

site1.com


site3.com

How would I define that site1.com uses layout1.html.twig, site2.com uses layout2.html.twig, etc? I would like to use something more eloquent than a switch/case or if/then for every possible site.

take a look at this:

it installs Liip/theme-bundle and integrates it into Pimcore. You can either implement custom theme-resolvers or just use the default ones it comes with:

  1. based on the site-document name:
  2. based on a document property theme

It loads the theme form this directory:

app/Resources/themes/[THEME-NAME]

take a look at liip/theme-bundle for more information about it.

I am actually using CoreShop already, and am using the built-in theme setup, so that is a perfect solution. I’m trying to understand how it is associated with the site document. For option #1, do you mean name the directory the same as the key on the site document? For example, like mc.supply:

image

So /app/Resources/themes/mc.supply?

If you are using CoreShop already, then it is a bit different. In CoreShop you have stores, each store has a template name, and that is the identifier for your theme

I’m using a combination of CoreShop e-commerce sites as well as some generic Pimcore CMS sites. The e-commerce site themes are working great, I’m just trying to utilize something similar for those sites that are strictly Pimcore/CMS. Would I utilize your earlier suggestion for those?

So, you have installed coreshop/core-shop right? and you have non commerce sites as well right?

I am not sure if that really works, since CoreShop has some EventListeners that require a Store.

If it is a separate installation of Pimcore, you can simply install coreshop/theme-bundle and either use the site name (in your case: mc.supply as theme name) or use a document property called theme and give it a name.

So, in theory with the theme-bundle, you can use different themes for different pages of your site as well, like /contact can have a different theme than /about-us just by using document-properties.

Hope that helps

Correct, I have both types on a single installation of Pimcore. Are you saying that doesn’t work in general, or just not for themes?

Is the recommendation to install a separate version of Pimcore for the non-ecommerce sites and install the themes bundle?

So far, I have not run into any issues having them on one, but am open to suggestions.

If you haven’t ran into any issues so far, it’s all fine then :), Just use the theme-bundle in the non-commerce way described above.