Edit template grouped

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 7 ans
Hi guys, I would like to change the template of products with variants so you can get on each variant of the product link directly to the product page itself. I do not understand why there is' this limitation, just think of you with your smartphone that simply slides a finger and arrives immediately to the specifications of a product. I thank in advance all those who will give me a hand.
Il y a 7 ans
freddy2 wrote:
Hi guys, I would like to change the template of products with variants so you can get on each variant of the product link directly to the product page itself. I do not understand why there is' this limitation, just think of you with your smartphone that simply slides a finger and arrives immediately to the specifications of a product. I thank in advance all those who will give me a hand.

Should be something like this. In ProductTemplate.Grouped.cshtml find this:

<div class="variant-name">
    @variant.Name
</div>

Change it to:

<div class="variant-name">
    <a href="@Url.RouteUrl("Product", new { SeName = variant.SeName })">@variant.Name</a>
</div>

That should link the product variant name to the individual product. You could do something similar to wrap the variant image in a link too.

Ideally you want to check if the variant is visible individually so you can add an if/else statement to make the link conditional but the VisibleIndividually property isn't exposed in the ProductDetailModel so it's a bit more involved.
Il y a 7 ans
petemitch wrote:
Hi guys, I would like to change the template of products with variants so you can get on each variant of the product link directly to the product page itself. I do not understand why there is' this limitation, just think of you with your smartphone that simply slides a finger and arrives immediately to the specifications of a product. I thank in advance all those who will give me a hand.
Should be something like this. In ProductTemplate.Grouped.cshtml find this:

<div class="variant-name">
    @variant.Name
</div>

Change it to:

<div class="variant-name">
    <a href="@Url.RouteUrl("Product", new { SeName = variant.SeName })">@variant.Name</a>
</div>

That should link the product variant name to the individual product. You could do something similar to wrap the variant image in a link too.

Ideally you want to check if the variant is visible individually so you can add an if/else statement to make the link conditional but the VisibleIndividually property isn't exposed in the ProductDetailModel so it's a bit more involved.


Thank you so much, I was well on the way but stuck at this point.
I think that will be useful this function.
Best regards.
Freddy2
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.