Reputation: 136
I'm trying to edit the .tpl of the article detail page in my shopware instance to be able to display a complete list of all available variants in a table view with a link in the last column to directly choose the listed variant.
So if there are two configuration possibilities like in this example: color and size, I would like to generate this table:
pants s green "link to variant"
pants m green "link to variant"
pants l green "link to variant"
pants xl green "link to variant"
pants xl green "link to variant"
pants s black "link to variant"
pants m black "link to variant"
pants l black "link to variant"
pants xl black "link to variant"
pants xl black "link to variant"
How can I get a list of available variants for a given base article? How is the link for this article being generated?
What I already did is to add a separate tab that can show the variant table then and some trial&error on generating the table. But simply connecting all variant possibilities will not give a good result, beacuse some variant possibilities may not be available. Therefore I would love to see an approach from the "get active variants"-perspective.
Upvotes: 0
Views: 315
Reputation: 131
You could work with {$sArticle.sConfigurator}. But as you wrote this wouldn't be a good result and it depends on logic in the template.
If you are familiar with PHP I'd try to create an DetailSubscriber(Enlight_Controller_Action_PostDispatchSecure_Frontend_Detail) and get the variants from the article itself. After this you can assign the result to a variable like $sArticleVariants and print it in the frontend.
Upvotes: 0