Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 19 of 19

Thread: Show multiple currency below each product

  1. #1
    hirish.reddy is offline Member
    Join Date
    Jul 2009
    Posts
    40

    Default Show multiple currency below each product

    Hi,

    i want to show multiple currencies.

    below each n every product i want to show price in both currencies (USA and INR)


    please some one help me on this

    Thanks in advance

  2. #2
    Dusty is offline Member
    Join Date
    Jun 2009
    Posts
    176

    Default

    Such is a relatively difficult task. The way the storefront works is the price of a project is in part derived from the locale context. The only approach I could recommend would be to have a daily task that iterates through all possible currency contexts, populates the extension data fields with this information, and modify your product page to display this information as well.

    Dusty
    ASPDotNetStorefront Staff

  3. #3
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Well, perhaps this might help: Equivalent Currency Display

  4. #4
    nihon is offline Senior Member
    Join Date
    May 2008
    Posts
    150

    Default

    Hey
    Thanks to Jao i got this to work but just on the Total and not on each product.
    Jao i also managed to add this to all my checkout pages and receipt..
    Thanks for the support ..
    Version (Code/DB):
    AspDotNetStorefront ML 8.1.2.0/8.1.2.0

  5. #5
    nihon is offline Senior Member
    Join Date
    May 2008
    Posts
    150

    Default

    Is this something i can do by just editing the product XML?
    Version (Code/DB):
    AspDotNetStorefront ML 8.1.2.0/8.1.2.0

  6. #6
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Yes, you will need to edit the product.package.xml.config you're using. But before we proceed, I think you might be referring to the shoppingcart.aspx page, rather than the product page, that is because, the cart page contains the total, product doesn't. So I need your clarification...

  7. #7
    nihon is offline Senior Member
    Join Date
    May 2008
    Posts
    150

    Default

    Hey Joe
    The Shopping cart is already done and so is the Checkout process and the receipt. (thanks to your help)
    What am thinking now is removing the drop down menu to select the currency and show the products on the product pages with 2 prices, 1 the GBP which is our main currency and the other equivalent to AUD. This makes sense for us as our price list is in GBP and we just want to show our clients the equivalent to that price, Showing the currency select option might me misleading to our clients..

    You think you can guide us, I have been trying to figure it out but no luck as of yet ..
    I was trying all sorts on this code..
    HTML Code:
    <div id="ProductPrice">
    								<xsl:value-of select="aspdnsf:GetVariantPrice(VariantID, number(HidePriceUntilCart), Price, SalePrice, ExtendedPrice, Points, aspdnsf:GetMLValue(SalesPromptName))" disable-output-escaping="yes" />
    Thanks for all Joe
    Version (Code/DB):
    AspDotNetStorefront ML 8.1.2.0/8.1.2.0

  8. #8
    nihon is offline Senior Member
    Join Date
    May 2008
    Posts
    150

    Default

    Hi Joe,
    Is it possible i need to create a App_code file (xxxxextension.cs)
    Version (Code/DB):
    AspDotNetStorefront ML 8.1.2.0/8.1.2.0

  9. #9
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Creating an extension is another way, but if you have a source code there's no need...

  10. #10
    nihon is offline Senior Member
    Join Date
    May 2008
    Posts
    150

    Default

    Cheers Jeo..
    I have source .. what code should i be editing.. would it be the Appconfig.cs ?

    Edit...

    Sorry i meant applogic..
    Last edited by nihon; 11-30-2009 at 03:57 AM.
    Version (Code/DB):
    AspDotNetStorefront ML 8.1.2.0/8.1.2.0

  11. #11
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Nope, actually it only takes commenting this line out on your {root}/skins/Skin_#/template.ascx
    Code:
    <div style="visibility: (!CURRENCYDIVVISIBILITY!); display: (!CURRENCYDIVDISPLAY!);">Currency: (!CURRENCYSELECTLIST!)</div>
    and that's it. No source code modification or extension creation...

  12. #12
    nihon is offline Senior Member
    Join Date
    May 2008
    Posts
    150

    Default

    Thanks Joe,
    But that's just to remove the drop down to select the currency, That not a problem
    What am after is adding 2 prices on the product page, 1 in GBP which will be the main and the other in AUD which will just act as a reference, under the GBP price ..
    Version (Code/DB):
    AspDotNetStorefront ML 8.1.2.0/8.1.2.0

  13. #13
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Well, you'll need to modify the XSLTExtensionBase.cs, add another method that is a replica of the GetVariantPrice in AUD locale, then call it from the XMLpackage you're using and that's it...

  14. #14
    nihon is offline Senior Member
    Join Date
    May 2008
    Posts
    150

    Default

    Joe, Seems like i managed the do this ..
    Can i post the code here.?

    I now have 2 currency's on the product page, brilliant ..
    Last edited by nihon; 12-01-2009 at 12:18 AM.
    Version (Code/DB):
    AspDotNetStorefront ML 8.1.2.0/8.1.2.0

  15. #15
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    I'm glad to hear it. Well, yes, you definitely can...

  16. #16
    nihon is offline Senior Member
    Join Date
    May 2008
    Posts
    150

    Default

    Ok here is the code i Changed..
    Add this Code under Line 4006
    I changed GetVariantPrice to GetVariantPriceAUD and linked this to my product XML file. I also Replaced most of the ThisCustomer.LocaleSetting to "AUD" as this is the currency i want to load under my Main Currency..

    Hope this helps .. and if anybody sees something that i should change in the code please let me know.. Cheers guys
    C#/VB.NET Code:
            public virtual string GetVariantPriceAUD(String sVariantIDString sHidePriceUntilCartstring sPricestring sSalePricestring sExtPriceString sPointsstring sSalesPromptName)
            {
                return 
    GetVariantPriceAUD(sVariantIDsHidePriceUntilCartsPricesSalePricesExtPricesPointssSalesPromptName"True""1""0.00");
            }

            public 
    virtual string GetVariantPriceAUD(String sVariantIDString sHidePriceUntilCartstring sPricestring sSalePricestring sExtPriceString sPointsstring sSalesPromptNamestring sTaxClassID)
            {
                return 
    GetVariantPriceAUD(sVariantIDsHidePriceUntilCartsPricesSalePricesExtPricesPointssSalesPromptName"True"sTaxClassID"0.00");
            }

            public 
    virtual string GetVariantPriceAUD(String sVariantIDString sHidePriceUntilCartstring sPricestring sSalePricestring sExtPriceString sPointsstring sSalesPromptNameString sShowpricelabelstring sTaxClassID)
            {
                return 
    GetVariantPriceAUD(sVariantIDsHidePriceUntilCartsPricesSalePricesExtPricesPointssSalesPromptNamesShowpricelabelsTaxClassID"0.00");
            }
            public 
    virtual string GetVariantPriceAUD(String sVariantIDString sHidePriceUntilCartstring sPricestring sSalePricestring sExtPriceString sPointsstring sSalesPromptNameString sShowpricelabelstring sTaxClassIDString sChosenAttributesPriceDelta)
            {
                
    // validate paramters
                
    InputValidator IV = new InputValidator("GetVariantPriceAUD");
                
    int variantID IV.ValidateInt("VariantID"sVariantID);
                
    bool hidePriceUntilCart IV.ValidateBool("HidePriceUntilCart"sHidePriceUntilCart);
                
    decimal regularPrice IV.ValidateDecimal("Price"sPrice);
                
    decimal salePrice IV.ValidateDecimal("SalePrice"sSalePrice);
                
    decimal extPrice IV.ValidateDecimal("ExtPrice"sExtPrice);
                
    int points IV.ValidateInt("Points"sPoints);
                
    string salesPromptName IV.ValidateString("SalesPromptName"sSalesPromptName);
                
    bool showPriceLabel IV.ValidateBool("Showpricelabel"sShowpricelabel);
                
    int taxClassID IV.ValidateInt("TaxClassID"sTaxClassID);
                
    decimal attributesPriceDelta IV.ValidateDecimal("AttributesPriceDelta"sChosenAttributesPriceDelta);

                
    // instantiate return variable
                
    StringBuilder results = new StringBuilder(1024);

                
    // short-circuit this procedure if the price will be hidden
                
    if (hidePriceUntilCart)
                {
                    return 
    string.Empty;
                }

                
    // round it by 2
                
    regularPrice decimal.Round(regularPrice2MidpointRounding.AwayFromZero);

                
    // calculate customerLevel price (in default currency, with no inclusive taxes added yet)
                
    decimal customerLevelMultiplier ThisCustomer.LevelDiscountPct 100;
                
    decimal customerLevelPrice regularPrice customerLevelMultiplier;    // defaults to regular price with applied discount

                
    if (extPrice != 0)                                   // if extended pricing is defined (non-zero), use it instead
                
    {
                    if (
    ThisCustomer.DiscountExtendedPrices)         // do customerLevel discounts apply to extended pricing?
                    
    {
                        
    customerLevelPrice extPrice customerLevelMultiplier// yes, use extended pricing and apply discount
                    
    }
                    else
                    {
                        
    customerLevelPrice extPrice;                     // no, just use extended price with no additional discount
                    
    }
                }


                
    // get inclusive tax rate
                
    decimal taxMultiplier 1;                           // this is the default tax rate (e.g. no inclusive taxes)

                
    string taxSuffix string.Empty;

                if (
    m_VATOn)
                {

                    
    bool isNotTaxable false;

                    
    // check if the variant is defined as NOT taxable
                    
    using (SqlConnection conn = new SqlConnection(DB.GetDBConn()))
                    {
                        
    conn.Open();
                        
    string sql string.Format("SELECT IsTaxable FROM ProductVariant WHERE VariantID = {0}"variantID);
                        
    using (IDataReader reader DB.GetRS(sqlconn))
                        {
                            
    isNotTaxable reader.Read() && DB.RSFieldTinyInt(reader"IsTaxable") == 0;
                        }
                    }

                    if (
    isNotTaxable)
                    {
                        
    taxMultiplier 1;
                    }
                    else
                    {
                        
    taxMultiplier += ThisCustomer.TaxRate(taxClassID) / 100// add any inclusive taxes into tax multiplier
                    
    }

                    
    // get suffix to display after pricing             
                    
    if (AppLogic.ProductIsMLExpress() == false
                        
    && m_VATEnabled)
                    {
                        
    // put another validation stuff here if the product variant is taxable or not 
                        // set tax suffix to an empty string when the item is non-taxable regardless if the VAT Setting is either
                        // Inclusive or Exclusive
                        
    if (m_VATOn && isNotTaxable)
                        {
                            
    taxSuffix String.Empty;
                        }
                        else if (
    m_VATOn && !isNotTaxable)
                        {
                            
    taxSuffix AppLogic.GetString("setvatsetting.aspx.6"ThisCustomer.SkinIDThisCustomer.LocaleSetting);
                        }
                        else if (!
    m_VATOn && !isNotTaxable)
                        {
                            
    taxSuffix AppLogic.GetString("setvatsetting.aspx.7"ThisCustomer.SkinIDThisCustomer.LocaleSetting);
                        }
                    }
                }


                
    // add inclusive tax, convert all pricing to ThisCustomer's currency, and round
                
    regularPrice decimal.Round(Currency.Convert(regularPrice attributesPriceDeltaLocalization.StoreCurrency(), ThisCustomer.CurrencySetting) * taxMultiplier2MidpointRounding.AwayFromZero);
                
    salePrice decimal.Round(Currency.Convert(salePriceLocalization.StoreCurrency(), ThisCustomer.CurrencySetting) * taxMultiplier2MidpointRounding.AwayFromZero);
                
    customerLevelPrice decimal.Round(Currency.Convert(customerLevelPriceLocalization.StoreCurrency(), ThisCustomer.CurrencySetting) * taxMultiplier2MidpointRounding.AwayFromZero);

                
    // format pricing
                
    string regularPriceFormatted Localization.CurrencyStringForDisplayWithExchangeRate(regularPrice"AUD");
                
    string salePriceFormatted Localization.CurrencyStringForDisplayWithExchangeRate(salePrice"AUD");
                
    string customerLevelPriceFormatted Localization.CurrencyStringForDisplayWithExchangeRate(customerLevelPrice"AUD");
            

                
    // get pricing labels
                
    string genericPriceLabel string.Empty;
                
    string regularPriceLabel string.Empty;
                
    string salePriceLabel string.Empty;
                
    string customerLevelName string.Empty;

                if (
    showPriceLabel)
                {
                    
    genericPriceLabel AppLogic.GetString("showproduct.aspx.26"ThisCustomer.SkinIDThisCustomer.LocaleSetting) + "&nbsp;";
                    
    regularPriceLabel AppLogic.GetString("showproduct.aspx.27"ThisCustomer.SkinIDThisCustomer.LocaleSetting) + "&nbsp;" "Equivalent to:";
                    
    salePriceLabel "&nbsp;" salesPromptName ":&nbsp;";
                    
    customerLevelName ThisCustomer.CustomerLevelName "&nbsp;";
                }

                
    // format micropay points
                
    string pointsFormatted string.Empty;
                if (
    AppLogic.AppConfigBool("MicroPay.ShowPointsWithPrices"))
                {
                    
    pointsFormatted "(" points.ToString() + " Points)";
                }

                
    // create results string
                // handle non-discounted customerLevel cases
                
    if (ThisCustomer.CustomerLevelID == || (ThisCustomer.LevelDiscountPct == && extPrice == 0))
                {
                    if (
    ThisCustomer.CustomerLevelID == && AppLogic.AppConfigBool("WholesaleOnlySite"))  // wholesale site with default customerLevel
                    
    {
                        
    results.Append("&nbsp;");
                    }
                    else  
    // show Level 0 Pricing
                    
    {
                        if (
    salePrice == || ThisCustomer.CustomerLevelID 0)
                        {
                            
    results.Append("<span class=\"variantpriceAUD\">" "Equivalent to:" regularPriceFormatted "</span>");
                        }
                        else
                        {
                            
    results.Append("<span class=\"RegularPrice\" >" regularPriceLabel "Equivalent to:" regularPriceFormatted "</span><br />");
                            
    results.Append("<span class=\"SalePrice\" style=\"color: " AppLogic.AppConfig("OnSaleForTextColor") + "\">" salePriceLabel salePriceFormatted "</span>");
                        }

                        
    results.Append("&nbsp;");

                        
    results.Append(taxSuffix);
                    }
                }

                
    // handle discounted customerLevels
                
    else
                {
                    
    results.Append("<span class=\"RegularPrice\" >" regularPriceLabel regularPriceFormatted "</span><br />");
                    
    results.Append("<span class=\"LevelPrice\" style=\"color:" AppLogic.AppConfig("OnSaleForTextColor") + "\">" customerLevelName regularPriceLabel customerLevelPriceFormatted "</span>");
                    
    results.Append(pointsFormatted);
                    
    results.Append(taxSuffix);
                }

                return 
    results.ToString();
            } 
    Version (Code/DB):
    AspDotNetStorefront ML 8.1.2.0/8.1.2.0

  17. #17
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Please keep the original GetVariantPrice rather than totally replacing it. It will not be used, unless, it's called, though... I'm glad to hear you're all set...

  18. #18
    nihon is offline Senior Member
    Join Date
    May 2008
    Posts
    150

    Default

    Thanks Joe,
    Yes i kept the full code for GetVariantPrice, the above code is a duplicate of all the GetVariantPrice code .. just copied and pasted under GetVariantPrice and renamed it to GetVariantPriceAUD so i can load the AUD price .. is this what u mean by keeping the original GetVariantPrice rather than totally replacing it .. ?


    Thanks again
    Gordon
    Version (Code/DB):
    AspDotNetStorefront ML 8.1.2.0/8.1.2.0

  19. #19
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Yes, precisely...