Add Manufacturer part number: to Cart Description

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 Jahre weitere
Is there any way to add the Manufacturer part number to the item on the shopping cart page? (Just as you would see for a variant e.g. Colour, Size etc.)
13 Jahre weitere
I am facing the same issue and ended up just using the Product Name as a Part Number field.
If you found a solution, please post.  Will download the source for product.cs file and get some clues there.
13 Jahre weitere
it is possible to implement this.
ManufacturerPartNumber is included in ProductVariant entity,
so you just need create a new method in OrderSummary.ascx.cs to retrieve part number, e.g. GetManufacturerPartNumber and then return the ProductVariant.ManufacturerPartNumber.
and in ascx file call this method that's all.
13 Jahre weitere
Thanks for that. Do you have an example of the code required?
13 Jahre weitere
Worked this out.

For anyone else wanting to do this, here is the required code.

OrderSummary.ascx

<%#GetManufacturerPartNumber((ShoppingCartItem)Container.DataItem)%>

OrderSummary.ascx.cs

        public string GetManufacturerPartNumber(ShoppingCartItem shoppingCartItem)
        {
            var ManufacturerPartNumber = shoppingCartItem.ProductVariant;
            String PartNumber = "PN: ";
            if (ManufacturerPartNumber != null)
                return PartNumber + ManufacturerPartNumber.ManufacturerPartNumber;
            return "Not available";
        }
13 Jahre weitere
how do I avoid the

"the name --- does not exist in the current context" error?

Thanks in advance for your guidance.
13 Jahre weitere
Normally this is when the bolded text below don't match.

OrderSummary.ascx


<%#GetManufacturerPartNumber((ShoppingCartItem)Container.DataItem)%>

OrderSummary.ascx.cs

        public string GetManufacturerPartNumber(ShoppingCartItem shoppingCartItem)
        {
            var ManufacturerPartNumber = shoppingCartItem.ProductVariant;
            String PartNumber = "PN: ";
            if (ManufacturerPartNumber != null)
                return PartNumber + ManufacturerPartNumber.ManufacturerPartNumber;
            return "Not available";
        }
13 Jahre weitere
Or...


OrderSummary.ascx


<%#GetManufacturerPartNumber((ShoppingCartItem)Container.DataItem)%>

OrderSummary.ascx.cs

        public string GetManufacturerPartNumber(ShoppingCartItem shoppingCartItem)
        {
            var ManufacturerPartNumber = shoppingCartItem.ProductVariant;
            String PartNumber = "PN: ";
            if (ManufacturerPartNumber != null)
                return PartNumber + ManufacturerPartNumber.ManufacturerPartNumber;
            return "Not available";
        }
13 Jahre weitere
I have seen Visual Studio display this message when there is no issue. sometimes making a change to the file and saving is enough to fix or try closing Visual Studio and re-open to get around this bug...
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.