jslater wrote:Hi,
Is it possible to put products on certain topic pages?
I've created a widget that will show in the Topic page template but when I select product to show in this widget it will show on all Topic pages.
EG. I'm creating a topic called 'Coats that are great for Spring' and would like to show 6 products on that Topic.
Thanks,
John
Hello
jslater,
to add a slider to a specific Topic page, you need to check what page you are currently on and show the slider
widget-zone on the required Topic page only.
You can achieve this, by adding the following code in the
View for the topic pages, where you must have added your new widget-zone:
@if(Model.SystemName.Equals("SYSTEM_NAME_OF_TOPIC_PAGE", StringComparison.CurrentCultureIgnoreCase)) {
YOUR_WIDGET_ZONE_GOES_HERE
}
If you want to have the same slider on multiple pages, you can use the following approach:
var topicNames = "Topic_1,Topic_2,Topic_3";
var topicName = topicNames.Split(",").ToList().FirstOrDefault(x => x.Equals(Model.SystemName, StringComparison.CurrentCultureIgnoreCase));
if(topicName != null)
{
YOUR_WIDGET_ZONE_GOES_HERE
}
Hope this was helpful.
Regards,
Valentin.