Developer forum

Forum » Development » Shipping currency

Shipping currency


Reply

I have a little problem.

The problem is that the product prices are in one currency and the shipping fees in another.

The products are in the default currency.

 

I have set the ShippingFee.CurrencyRate tag using a template extender but

DW do not recalculate the shipping fee.

 

How do I get DW to recalculate the shipping fee and the totalprice with fees using the new currency rate?

 

Or is it possible to change the default currency on shipping fee in another whay and still have the default currency on products?


Replies

 
Reply

Setting a tag with a tag extender only changes the information merged to the template, not the information used for calculations. Use a FeeProvider to manipulate with shipping fee. Here's an example:

 

using System.Data;
using Dynamicweb;
using Dynamicweb.eCommerce;
using Dynamicweb.Extensibility;

namespace CustomModules.CustomModules.Classes
{
    public class FeeProvider:Dynamicweb.eCommerce.Orders.FeeProvider
    {
        public override Dynamicweb.eCommerce.Prices.PriceRaw FindFee(Dynamicweb.eCommerce.Orders.Order Order)
        {
            Dynamicweb.eCommerce.Prices.PriceRaw ReturnFee = null;

            if (Order.CustomerEmail != "")
            {
                IDataReader DR = Database.getDataReader(string.Format("SELECT TOP 1 * FROM EcomOrders WHERE OrderCustomerEmail = '{0}' AND OrderDate >= DATEADD(day, -1, GETDATE()) AND OrderComplete = {1}", Order.CustomerEmail, Database.SqlBool(true)), "Ecom.mdb");
                if (DR.Read())
                {
                    ReturnFee = new Dynamicweb.eCommerce.Prices.PriceRaw(0.00, Dynamicweb.eCommerce.Common.Application.DefaultCurrency);
                }
            }
            return ReturnFee;
        }
    }
}

 
Reply

I tryed the feeProvider but I get some strange numbers that I dont know where they come from.

 

I'm getting the order from the databese and the value of the shipping fee is 350 but when I go in to the cart the value is 437.50 and it increases everytime I relode the page.

 

Another thing is that this value doesn't affect the total price or VAT.

Do I have to use some other providers for these?

 
Reply

350*1.25=437.45 -> Could be Danish VAT calculation. What's the VAT setting on the solution?

 
Reply

Ok, but the VAT from the shipping is not calculated in the total with VAT and the total VAT is calculated from the shipping fee without VAT.

 

An exampl of the values I get:

 

Product whit VAT €1.39

Shipping Fee Whit VAT €437.50

Total with VAT €351.39

VAT €70.28

Total without VAT €281.11

 

Here you can see that the calculations are using the shipping without VAT (350) as shipping with VAT.

 

And if I reload the it adds the VAT to the shipping fee again.

Why does it do that?

 
Reply

In Control Panel -> Prices you can control whether to calculate VAT on shipping and payment.

 
Reply

I have allready checked that box.

Looking at the template tags I have the correct shipping fee with and without VAT. It is the total with VAT and total VAT that uses the shipping fee without VAT to calculate the total.  

 
Reply

Well, that depends on how you set the setting in Control panel...

 
Reply

Ok, the VAT is now correct but I still get the default currency.

this is the code:

Currency = Dynamicweb.eCommerce.Common.

Application.get_Currency("SEK");

ReturnFee =

new Dynamicweb.eCommerce.Prices.PriceRaw(shippingFee, Currency);

 

 

Is there something else I have to do to change the currency for shipping?

 

If I try to recalculate the shipping directly on "shippingFee" the value will encrease everytine you reload the page and the total price and VAT will be one step behind.

 

 
Reply

How did you set currency in ecom and Frontpage or Language/Area module?

 
Reply
Sorensen wrote:

How did you set currency in ecom and Frontpage or Language/Area module?


 

This solution dosn't have the landuage/area module.

In the frontpage it is set to Euro the same as the default currency.

It was set to none before and it gave the same result.

 

 

You must be logged in to post in the forum