I'm not sure if what I said was clear. What I meant is instead of this:
if (!"SALES_ORDER".equals(cart.getOrderType()) ||
UtilValidate.isEmpty(cart.getShippingContactMechId())) {
do this:
if (!"SALES_ORDER".equals(cart.getOrderType()) ||
(UtilValidate.isEmpty(cart.getShippingContactMechId()) &&
UtilValidate.isEmpty(cart.getBillingAddress()))) {
The code that substitutes the billing address for the shipping address is a bit
hidden (partially because the ShoppingCart, ShoppingCartHelper,
ShoppingCartEvents, CheckOutHelper, etc have logic that is all over the place
an not well organized, a problem that we all know has needed fixing for a
while), but anyway it is in CheckOutHelper.java, around line 777.
Anyway this change should be fine and still result in the calcTax not being
called if this information hasn't been selected AND not break the feature (that
is supported in most places and _hopefully_ still works!) where it is possible
to checkout with a billing address but no shipping address. That is actually
fairly important for certain users of OFBiz, especially those with just digital
goods and such.
-David
Anil K Patel wrote:
David,
I understand what you mean. I looked around, The calcTax service is
implemented in TaxAuthorityServices.java::rateProductTaxCalc. At line #
148 it checks for Postal address for Shipping. This means even if I
implemented as you suggested we'll still get problem.
Regards
Anil Patel
David E Jones wrote:
I see what you're looking at. This change is fine then, but
incomplete. Before skipping tax calc we need to make sure that both
the shipping and billing addresses are empty. To check this you can
use the cart.getBillingAddress() method.
-David
Anil K Patel wrote:
In E-Commerce site (or its custom impl), When user click on ShowCart,
I'll like to route request through the process of calculating
Shipping and Tax and set then in cart so that we can show it to
Customer.
In case if user has not yet logged in or is anonymous then Shipping
and Tax calc services fail because of missing Address details. By
doing this change and another change that I did few days back, We
attempt of calc these things only if we have data to work with else
do nothing.
Regards
Anil Patel
David E Jones wrote:
Actually if there is not shipping address we should use the billing
address.
I thought there was something in place that did that already.
Could you describe the process where this is becoming a problem?
-David
[EMAIL PROTECTED] wrote:
Author: apatel
Date: Thu Jul 26 16:56:18 2007
New Revision: 560035
URL: http://svn.apache.org/viewvc?view=rev&rev=560035
Log:
if there is no shipping contact mech in shoppingcart then do not
attempt to calc tax.
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?view=diff&rev=560035&r1=560034&r2=560035
==============================================================================
---
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
(original)
+++
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
Thu Jul 26 16:56:18 2007
@@ -714,7 +714,7 @@
}
public void calcAndAddTax(GenericValue shipAddress) throws
GeneralException {
- if (!"SALES_ORDER".equals(cart.getOrderType())) {
+ if (!"SALES_ORDER".equals(cart.getOrderType()) ||
UtilValidate.isEmpty(cart.getShippingContactMechId())) {
return;
}