News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

multiple tax and calculation rules for one bill [closed]

Started by Bollek, September 23, 2013, 15:55:49 PM

Previous topic - Next topic

Bollek

Hi,

i'm using VirtueMart 2.022c and Joomla 2.5.14.

I wanted to use several tax and calculation rules for different product categories.

Specifically, I would like to add a fixed amount depending on the country to the bill (a "DATaxBill").
So, i have a categorie without any shipment costs and a category where are spezific costs depending on country of delivery.

All works fine, as long as there are only type of a category in the cart, because apparently the rule is selected from the last element of the cart.
But if there are both type and the last element is a free-shipping product, the cost for the other product are missing.

At the beginning, the rules did not apply to certain products. So I had to add the following code:

   
            //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


and


            if ($hitsDeliveryArea && $hitsShopper && $hitsCats) {//fix for cat filtering GJC
                if ($this->_debug)
                    echo '<br/ >Add Checkout rule ' . $rule["virtuemart_calc_id"] . '<br/ >';
                $testedRules[$rule['virtuemart_calc_id']] = $rule;
            }


to ./html/administrator/components/com_virtuemart/helpers/calculation.php, which i found here in the forum (sorry, i don't remember the topic).


I'm not sure if this is a bug or if it is even possible to use multiple rules simultaneously.

Bollek

Milbo

Multiple VATs work with unpublished categories in the calculation rule. So as long I do not really understand your setup, I cannot decide if you found a bug, if you do a fix or whatever.
I also have no clue why you say you added a code, which exists exactly that way already since years in the calculationh.php

Ahh now I get it, maybe. You must use per product and not per bill.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Bollek

What do you mean with mutliple VATs work with unpublished categories?

I had to insert the code above, respectively otherwise the rules did not distinguish between different product categories and was always active in every product.
I add the code in the function "gatherEffectingRulesForBill" and there i only find the same sql-query:


            $q = 'SELECT `virtuemart_category_id` FROM #__virtuemart_calc_categories WHERE `virtuemart_calc_id`="' . $rule['virtuemart_calc_id'] . '"';
            $this->_db->setQuery($q);
            $rule['calc_categories'] = $this->_db->loadResultArray();


,but it does not distinguish between product categories, therefore I add the code.

Edit:

I wrote a little workaround for my problem and topic can be closed.