Hi everyone, does anyone know the best approach fo...
# suitecommerce
n
Hi everyone, does anyone know the best approach for handling different layouts/UI for different Commerce Category pages in SCA? Right now I know that if I customize the default Commerce Category template through the Theme Developer Tools, the changes get applied to all category pages since they share the same template. What I’m trying to achieve is: • customize only a specific Commerce Category page • keep the rest of the category pages unchanged Has anyone handled something like this before, or know a good approach for it?
s
Been a while since I've thought about this but I'm pretty sure you can just publish a new template in an extension and then use the SMTs to change the template https://developers.suitecommerce.com/page-types-and-page-layouts.html
n
I went through the documentation shared earlier, and in the example they are registering a template/layout for the PDP page, which makes sense. However, my case is related to Commerce Category pages. When I open a Commerce Category page through SMT, I don’t see any “Layout” option there like the one available for PDP pages. I also found this NetSuite documentation: Changing the Page Layout of a Specific Page From what I understand, it states that the SMT Page Layout Selector only works for landing pages and enhanced pages, while core page types only support default layouts. (Oracle Docs) So now I’m a bit confused about the correct approach for Commerce Category pages specifically. If Commerce Category pages don’t expose a Layout option in SMT, how are people handling completely different layouts/UI for specific category pages only, while keeping the rest unchanged? I’m attaching a screenshot as well for reference.
s
Commerce category pages should be enhanced pages because they use Facets.Browse.View, which is an enhanced view
Well, it looks like you're right. Search pages can be enhanced but category pages cannot
How weird
So, off the top of my head, one thing you can do is wrap the beforeShowContent of the facets browse view so it checks the URL fragment of the page and, if it matches your desire path, you change the view's template property to your other template
If you intend to do that then you may wish to build in a new configuration object so that this can be managed in the domain configuration page
n
Well, that’s actually what I initially thought of as well using the URL fragment/category URL approach. I’ll probably go ahead with that then. Thanks!