Is there a way to display the variant name in the cart or order, next to
the original product name?
Let's say, I am displaying my cart by looping through the orderlines, as the variant prices displays individually, I would also display each variant name next to the order product name.
foreach (OrderLine o in cart.OrderLines)
{
<p>@o.Name - //display variant name here</p>
}
I have altered the product details page a bit, so only one dropdown is showing all of my variants instead of combining. That's because I want to list each variant price to the right of the product variant.
It works fine with the different prices when I add to basket, but the order line name is still the original product name:
Could you try and make a simple example and what it does today and what you need it to do?
The demo store uses javascript to update the "productIdentifier" html hidden field. When the variant is added to the cart as an order line - Tea Commerce knows how to fetch the variant name parts and add it after the product name. That is why it get "Summer Yacht - Black - Medium" in the demo store.
With the product identifier of the chosen variant with jQuery:
$(function () {
$('#variant').change(function () {
var x = $(this).val();
$('#pid').val(x);
});
});
That works fine, and the product variant is added to the basket with the correct variant price. But in the basket and in the orderline, the name of the variant is not displayed. It displays only the name of the main product.
So basically what I want is to somehow fetch the variant name in the basket and on each order line and display it next to the main product name, as in the demo store.
Do you have a property on your product and variant doc types with the alias "productName"? If yes - try NOT to enter a value in the umbraco back office for the variant. Tea Commerce should then pick it up from the node names of the variant and the product.
See line 137 - 156 where it tries to find a value for the variant first - it not - then use the node name of the product and ask the variant service for the name of the variant.
Zank you. - And "yes" to both of your questions. Removing the value for the variant in the backend on the product made the cart/order fetch the variant name from the variant specification node.
Display variant name on the order
Hi
Is there a way to display the variant name in the cart or order, next to the original product name?
Let's say, I am displaying my cart by looping through the orderlines, as the variant prices displays individually, I would also display each variant name next to the order product name.
Best regards.
Hi Thomsen.
If you see the demo shop of Tea commerce https://demo.teacommerce.net and choose to purchase the Summer Yacht then you can select color and size.
When you have added the product to the mini cart, and goes to check then the product name and variant are displayed like this
Is it something tike this that you want? If so the code below are the code that are using the generate these order lines.
Hope this helps,
/Dennis
Hi Dennis, thank you for your answer.
I have altered the product details page a bit, so only one dropdown is showing all of my variants instead of combining. That's because I want to list each variant price to the right of the product variant.
It works fine with the different prices when I add to basket, but the order line name is still the original product name:
Here is my code:
Hi Thomsen
Its a bit hard to get specific what you want :)
Could you try and make a simple example and what it does today and what you need it to do?
The demo store uses javascript to update the "productIdentifier" html hidden field. When the variant is added to the cart as an order line - Tea Commerce knows how to fetch the variant name parts and add it after the product name. That is why it get "Summer Yacht - Black - Medium" in the demo store.
Kind regards
Anders
Hi Anders
Instead of combining the variants like in the demo, I have only one dropdown which lists all the variant combinations like this:
When the user selects a variant, I update the value of the hidden field:
With the product identifier of the chosen variant with jQuery:
That works fine, and the product variant is added to the basket with the correct variant price. But in the basket and in the orderline, the name of the variant is not displayed. It displays only the name of the main product.
So basically what I want is to somehow fetch the variant name in the basket and on each order line and display it next to the main product name, as in the demo store.
Best regards.
Do you have a property on your product and variant doc types with the alias "productName"? If yes - try NOT to enter a value in the umbraco back office for the variant. Tea Commerce should then pick it up from the node names of the variant and the product.
See line 137 - 156 where it tries to find a value for the variant first - it not - then use the node name of the product and ask the variant service for the name of the variant.
https://github.com/TeaCommerce/Tea-Commerce-for-Umbraco/blob/master/Source/TeaCommerce.Umbraco.Configuration/InformationExtractors/PublishedContentProductInformationExtractor.cs
Kind regards
Anders
Hi Anders,
Zank you. - And "yes" to both of your questions. Removing the value for the variant in the backend on the product made the cart/order fetch the variant name from the variant specification node.
Best regards!
is working on a reply...