VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: steved on September 23, 2012, 17:04:44 PM

Title: Taxes & Calculation Rules Apply to All Products rather than specific Catagories
Post by: steved on September 23, 2012, 17:04:44 PM
Hi there,

I am having issues when using the Tax calculation rules in Virtuemart Version 2.0.8e.

For the products in the 'commissions' category of the store I wish to show the full price on the product page, however only charge 50% at checkout. (As the customer only pays a deposit). I have gone about achieving this by applying a Tax Rule as follows:

(http://demelzakeens.co.uk/post_images/Calculation%20rule.jpeg)

However this applies to every item I add to my cart rather than Just items in the 'commissions' category.

For example - the item "Green Eyes" is in the 'prints' category

(http://demelzakeens.co.uk/post_images/greeneyes.jpeg)

The item "Two Subjects" is in the 'commissions' category

(http://demelzakeens.co.uk/post_images/Twosubjects.jpeg)

However when they are added to the cart the discount is taken from both items rather than just "Two Subjects"

(http://demelzakeens.co.uk/post_images/cart.jpeg)

The issue also occurs when I Set the discount on an individual product rather than using the category feature.

I have tried the fix located at http://forum.virtuemart.net/index.php?topic=98178.0 (http://forum.virtuemart.net/index.php?topic=98178.0) but it did not work

Thank you for any help you can give

Additional info:
Joomla Version: 2.5.4 Stable
PHP: 5.3.3
Title: Re: Taxes & Calculation Rules Apply to All Products rather than specific Catagories
Post by: bowie on February 11, 2013, 14:59:22 PM
I have the exact same problem. Any solutions to this?
Title: Re: Taxes & Calculation Rules Apply to All Products rather than specific Catagories
Post by: GJC Web Design on February 11, 2013, 16:12:31 PM
What I've found specifically for "Tax per Bill" is there is no Category check at all in the code

This fixes it on my install  - 2.0.18a

File - administrator/components/com_virtuemart/helpers/calculationh.php
function gatherEffectingRulesForBill($entrypoint, $cartVendorId=1)

around line 986 -add after block

$hitsShopper = true;
if (isset($this->_shopperGroupId)) {
$hitsShopper = $this->testRulePartEffecting($shoppergrps, $this->_shopperGroupId);
}


//GJC - check category
$q = 'SELECT `virtuemart_category_id` FROM #__virtuemart_calc_categories WHERE `virtuemart_calc_id`="' . $rule["virtuemart_calc_id"] . '"';
$this->_db->setQuery($q);
$taxcategories = $this->_db->loadResultArray();
$hitsCats = true;
if (isset($this->_cats)) {
$hitsCats = $this->testRulePartEffecting($taxcategories, $this->_cats);

}
//GJC


then change line

if ($hitsDeliveryArea && $hitsShopper ) {

to

if ($hitsDeliveryArea && $hitsShopper && $hitsCats) {//fix for cat filtering GJC

works for me but haven't tested with country filters etc