Developer forum

Forum » Rapido » Problem with getting discount - can't get country code

Problem with getting discount - can't get country code

Pamela Šokčević
Reply

Hi,

I need help with getting a discount on the list. This is our code on the template:

-------------------------------------------------------------------------------------------------------------------------------------------------

string countryCode = Pageview.Area.CultureInfo.TwoLetterISOLanguageName;

@if(@GetLoop("Product.Prices").Count>0)
    {
           Dynamicweb.Ecommerce.Products.Product prod = Dynamicweb.Ecommerce.Services.Products.GetProductById(GetString("Ecom:Product.ID"),  GetString("Ecom:Product.VariantID"),true);  
                    Dynamicweb.Ecommerce.Orders.Discounts.DiscountInfoCollection discounts = prod.GetDiscountMatrix(
                        GetString("Ecom:Product.Price.Currency.Code"),
                        countryCode,
                        customerId,
                        prod.DefaultUnitId,
                        ""
                    );

This works fine if the customer is in Croatian language. but when he switches to English at some moment he loses and does not get the country code.

So the web gets this error:

 

Is there some solution for this how we can resolve this problem?

Any other method for getting discounts on templates?


Replies

 

You must be logged in to post in the forum