Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • lele 100 posts 417 karma points
    Mar 24, 2015 @ 09:20

    Multilingual & some questions


    In a project I plan to use your awesome store solution but first I have some questions:

    1. Multilingual: How can I translate the product and variants (only with the umbraco dict)? I want to use the vorto package... :)

    2. Extend data: Can I add what I want? For example uploaded image, dropdown value, and so on...?

    3. Add more than one store: Can I create more stores in one solution?

    Many thanks for your answers.

  • Preethi 32 posts 99 karma points
    Mar 24, 2015 @ 16:10


    I have a similar scenario where I have two stores for two Language/Country branches with the respective language set to en-GB and de-DE. I am using the Merchello Bazaar.

    1. I can use the .ToString("C") for most prices to display the correct currency except for the 'SalePreparationSummary'  Model prices which seem to be strings. How can I override these prices? Can I do it using the api controller.

    2. I am also not very clear how to set the multiple currency as all my prices in the backend are showing in pound sterling which is my store setting.

    3. The Basket seems to be common. Hence when I switch from one country to the other the products which are restricted to one country seem to remain in the basket. How can I restrict the items to be based on the current region? 

    These are few of my initial questions.



  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 24, 2015 @ 18:13
    Rusty Swayne

    @lele I've only briefly played with Vorto. I once heard that there may be a conflict in the back office but have had a chance to investigate it and that was before 1.7.0 came out - so a lot has changed with respect to Merchello's back office JS since that time. I'm interested in how it goes =) For displaying the various language texts on the front end, Vorto has a PropertyValueConverter - "VortoValueConverter" which returns a Dictionary

    You can save anything you want in the ExtendedDataCollection. I've prefixed all of our extended data keys with "merch" so it'd be pretty straight forward to keep clear of them.

    Merchello does not have multi-store capabilities at this point, but I'm starting to get more and more requests for it and I can see it being added to the road map sometime in the future. We do have a stuff planned through summer so we will likely not be able to look into it until maybe fall or winter. Of course we've also seen growth in community contributions - so maybe someone gets a wild hair and takes that one on ... however, it would be a big effort.

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 24, 2015 @ 18:52
    Rusty Swayne


    If you're swapping currencies you need to make certain that everything in the basket is added with a consistent currency code. The currency code is stored in the line item ExtendedDataCollection using the merchCurrencyCode key. I generally reference it using the constant Core.Constants.ExtendedDataKeys.CurrencyCode.

    So maybe write an extension method ... (this is untested ... just hacking it in here)

     internal static class BasketExtensions 
         public static void SetCurrencyCode(this IBasket basket, string isoCurrencyCode)
              foreach(var item in basket.Items.ToArray())
                    item.ExtendedData.SetValue(Constants.ExtendedDataKeys.CurrencyCode, isoCurrencyCode);
     //// NOTE: You will also need to make sure the shipping calculation is converted (or set correctly in the rate table) and tax computation (if any).  These would need the currency code saved with them as well.  

    If the merchCurrencyCode key is NOT present when an invoice is "prepared" the InvoiceBuilder will automatically add the default store currency code - but it also validates that every line item in the invoice is costed with a consistent currency code (so you can't have an invoice with some line items marked as GBP and others with EUR for example) because in general it's not possible to collect payment in multiple currencies.

    If the Invoice builder finds multiple currencies in it's item collection, the build "Attempt

    You could be more explicit and override this behavior by replacing the Merchello.Core.Chains.InvoiceCreation.ValidateCommonCurrency task with one of your own. To do this, you could essentially copy the ValidateCommonCurrency class into your solution, and refactor the PerformTask method, maybe to add the currency code found in other line items to ones that have not been set yet (thinking of your shipping and tax here).

    You would then go to the merchello.config file, find the "taskChains" element and replace the corresponding task with the one you created.

    <taskChain alias="SalesPreparationInvoiceCreate">
        <task type="Merchello.Core.Chains.InvoiceCreation.AddBillingInfoToInvoiceTask, Merchello.Core" />
        <task type="Merchello.Core.Chains.InvoiceCreation.ConvertItemCacheItemsToInvoiceItemsTask, Merchello.Core" />
        <task type="Merchello.Core.Chains.InvoiceCreation.ApplyTaxesToInvoiceTax, Merchello.Core" /> 


           <task type="Merchello.Core.Chains.InvoiceCreation.ValidateCommonCurrency, Merchello.Core" />

    WITH SOMETHING LIKE (where MySite.dll is your site build dll)

            <task type="MySite.Chains.InvoiceCreation.ValidateCommonCurrency, MySite" />
    <taskChain alias="OrderPreparationOrderCreate">
            <task type="Merchello.Core.Chains.OrderCreation.ConvertInvoiceItemsToOrderItemsTask, Merchello.Core" />    
      <taskChain alias="OrderPreparationShipmentCreate">
              <task type="Merchello.Core.Chains.ShipmentCreation.AddShippableOrderLineItemsToShipmentTask, Merchello.Core" />
              <task type="Merchello.Core.Chains.ShipmentCreation.RemoveShipmentOrderItemsFromInventoryAndPersistShipmentTask, Merchello.Core" />
              <task type="Merchello.Core.Chains.ShipmentCreation.SetOrderStatusTask, Merchello.Core" />

    The basket is common and as I mentioned in my response to @lele Merchello is not setup for multi-store. However, you could use the customer's extended data collection or a customer context value (which would save data into the Merchello cookie)

       CustomerContext.SetValue("basketCulture", [whatever])

    and then check that value in your controller before returning the basket.

    If the value is different than what you expect you could empty the basket (Basket.Empty()) as you would know the customer has changed sites.

    One thing we could consider adding to the Core is saving the culture as another field in the ItemCacheCollection which would allow for having separate baskets per culture. This is would have ramifications in quite a few areas, so we'd need to plan for it and test it thoroughly.

    Hope this helps and let me know how it goes.

  • Preethi 32 posts 99 karma points
    Mar 30, 2015 @ 19:11

    Hi Rusty,

     Thanks for your prompt reply. I have been looking into implementing your solutions. Have made some progress.

    1. The BasketExtensions method works fine. On the Basket View I now use

    var _basket = CurrentCustomer.Basket();


    I am thinking of moving this code along with your final suggestion of setting the CustomerContext.SetValue("basketCulture",[whatever]) inside a controller. What would be the easiest way of acheiving this.

    2. On the initial checkout page where the order is displayed I had to rebuild the SalePreparationSummary from the customerbase and checkoutaddressform model as the prices are already formatted in this model. preparation.PrepareInvoice() always seems to return null at this stage. Is there a way of building the invoice with the regional currency symbol.

           public static SalePreparationSummary PrepareRegionalSale(ICustomerBase customer, CheckoutAddressForm checkoutAddressForm)




                var basket = customer.Basket();

                var preparation = customer.Basket().SalePreparation();


                SalePreparationSummary summary = checkoutAddressForm.SaleSummary;

                summary.TotalLabel = "Sub Total";

                summary.CurrencySymbol = RegionalCurrencySymbol();

                summary.ItemTotal = FormatRegionalPrice(preparation.ItemCache.Items.Where(x => x.LineItemType == LineItemType.Product).Sum(x => x.TotalPrice));

                summary.ShippingTotal = FormatRegionalPrice(preparation.ItemCache.Items.Where(x => x.LineItemType == LineItemType.Shipping).Sum(x => x.TotalPrice));

                summary.TaxTotal = FormatRegionalPrice(preparation.ItemCache.Items.Where(x => x.LineItemType == LineItemType.Tax).Sum(x => x.TotalPrice));

                summary.DiscountsTotal = FormatRegionalPrice(preparation.ItemCache.Items.Where(x => x.LineItemType == LineItemType.Discount).Sum(x => x.TotalPrice));

                summary.InvoiceTotal = FormatRegionalPrice(preparation.ItemCache.Items.Where(x => x.LineItemType != LineItemType.Discount).Sum(x => x.TotalPrice) - preparation.ItemCache.Items.Where(x => x.LineItemType == LineItemType.Discount).Sum(x => x.TotalPrice));


               return summary;


    3. I have replaced the ValidateCommonCurrency with my solution version. While checking through the code it was the Tax lineitemtype which failed and it had a currency set to the storeCurrency. The shipping lineItemType had no merchCurrencyCode in the extended data and the currency symbol had to be added to this LineItem as well. This stopped the system from complaining about the 'Invoice is being created with line items costed in different currencies'

    4. Now on the CheckoutConfirmation page i have two issues. 

    a. The Model.ShippingQuotes Text are still displayed with the StoreCurrency. Where would I change the Text value

    b. It uses SaleSummary Model once agin which has to be rebuilt  as it has the currency already set. (same problem as step 2)




Please Sign in or register to post replies

Write your reply to: