I was hoping someone on the forum may be able to help me solved a problem I am having with TaxCloud and my zencart v1.50 site.
With the help of one of TaxCloud support specialists I was able to modify the orders.php and func.taxcloud.php in order to calculate tax on an order AFTER a manufacturers discount had to been applied to the order.
The problem I am having now... when a customer puts in a coupon code during step 2 of checkout and hits the enter key to apply the code, everything works as it should and the tax is recalculated with the new discount price. BUT if the customer types the coupon code in step 2 of checkout then clicks "continue checkout", step 3 of checkout will show the coupon code has been applied and the amount has been taken off of the sub-total but the tax is not recalculated according to the code I have below. I know it may seem a bit convoluted and I am having a difficult time putting the process into words nonetheless some help would be greatly appreciated!!!
What can I change in either php page in order to tell the cart to apply the new code even if "continue checkout" is clicked rather than the coupon code be applied then "continue checkout" clicked?
The following modifications were done in order to make this process work up to its current point...
Order.php (Around line 600):
$discount_per_product = 0;
if ($this->info['coupon_code']) {
$coupon_query = "SELECT coupon_type, coupon_amount from " . TABLE_COUPONS . " where coupon_code ='" . $this->info['coupon_code'] . "'";
$coupon_results = $db->Execute($coupon_query);
$coupon_amount = $coupon_results->fields['coupon_amount'];
$discount_per_product = $coupon_amount;
}
$tax = func_taxcloud_lookup_tax( $this->products, $shippingAddress, $err, $this->info['shipping_cost'], $selectedCert, $discount_per_product );
}
Func.Taxcloud.php (Around line 170):
if($product['id'] == 16) {
$price = ($product['final_price'] - ($discount_per_product / $product['qty']));
}
else{
$price = ($product['final_price']);}
$cartItem->setPrice($price); // Price of each item
$cartItem->setQty($product['qty']); // Quantity
$cartItems[$index] = $cartItem;
Bookmarks