bigandini
bigandini

Reputation: 136

How to add a table to shopwares product detail page which lists all available variants for this product?

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.

https://shopware.demo2.sixhop.net/hoehenluft-abenteuer/fashion/herren/151/mi-pants-bacun?number=SW10151.5&c=5

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

Answers (1)

jinnoflife
jinnoflife

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

Related Questions