Testing the webstore

This is an open forum for any mojoPortal topics that don't fall into the other categories.

This thread is closed to new posts. You must sign in to post in the forums.
5/6/2010 9:00:32 PM
Gravatar
Total Posts 15

Testing the webstore

Hello,
I am testing the webstore and can't get the tax calculation to work, so fiddle with the code and removed the SiteGuid TaxZoneGuid check.
and harcoded 25% tax. I wanted the prices in the store to be before tax, The tax will be visible in the checkout part.
Then I discovered that paypal added to mutch VAT it was more then one items of a offer. So I changed the code a bit more in store.cs
I had to set the tax for the item in the offer to (one item tax) to get paypal calculate it correct. eg. offer.Tax = 0.25m * offer.OfferPrice;
Now it works for me, maybee it's a bug or not depending on how it was ment to work.

public void CalculateTax(Cart cart)
{
// TODO: this doesn't take into account discounts

decimal taxAmount = 0;

// if (cart.OrderInfo.TaxZoneGuid != Guid.Empty)
// {
// Collection<TaxRate> taxRates = TaxRate.GetTaxRates(this.SiteGuid, cart.OrderInfo.TaxZoneGuid);
// if (taxRates.Count > 0)
// {
foreach (CartOffer offer in cart.CartOffers)
{
offer.Tax = 0;

// foreach (TaxRate taxRate in taxRates)
// {
// if (offer.TaxClassGuid == taxRate.TaxClassGuid)
{
offer.Tax = /*taxRate.Rate*/0.25m * offer.OfferPrice; // (offer.OfferPrice * offer.Quantity));
offer.Save();
//taxAmount += offer.Tax;
taxAmount += (0.25m * (offer.OfferPrice * offer.Quantity));
//break;
}
// }
}
// }
// }

cart.TaxTotal = Math.Round(taxAmount, this.RoundingDecimalPlaces, this.RoundingMode);
if (cart.TaxTotal < 0) { cart.TaxTotal = 0; }
cart.Save();

}
 

5/7/2010 1:57:28 PM
Gravatar
Total Posts 18439

Re: Testing the webstore

Hi,

I recommend don't modify any mojoPortal code or you will not be able to upgrade without losing your changes.

Currently the internal tax system only works when you are processing orders on the site using Authorize.NET or another card processor where payments are processed without the user leaving your site.

You must define a TaxRate (for specific states or regions), a TaxClass (ie Taxable, Non-Taxable), then you assign the tax class to an offer in the store.

If processing orders internally on the site tax will be applied after the user enters address info.

We don't currently support passing our own tax calculation to external payment sites like PayPal because we don't know the user's address and we do not ask for this information before sending the user to PayPal, so we have no basis to calculate tax since it is based on location. Typically PayPal returns that address data to us. So when using external payment gateways like paypal, currently you have to configure it in your PayPal account about tax collection.

Hope it helps,

Joe

5/7/2010 4:19:32 PM
Gravatar
Total Posts 15

Re: Testing the webstore

Hello,

Yes I understand that code needs to be generic and for every region, and my hack is just a test.

But what i tried to explain is that for paypal to get it right (in my case) I needed to change

offer.Tax += taxRate.Rate *  (offer.OfferPrice * offer.Quantity));

to

change offer.Tax = taxRate.Rate * offer.OfferPrice;

So the data is stored in the database as tax per item.

otherwise paypal will present that that the tax is equal to (tax of all the items) * number of items.

Alot of tax.

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

By the way I think i found a somthing missing in

ConfirmOrder.apx.cs in ShowChart() there shuld be a

pnlOrderTotal.Visible = (cart.OrderTotal > 0);

 

Best regards

Bert

You must sign in to post in the forums. This thread is closed to new posts.