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

Tax not calculatuing on shipping using 'default rules' - (weight_countries)

Started by dsrpmedia, April 28, 2015, 19:38:39 PM

Previous topic - Next topic

dsrpmedia

Hi I am using Joomla 3.4.1, and VM 3.0.8

The default tax calculation rules are working on the products themselves - but not on the shipping (using Shipment Method: weight_countries)

I have selected the 'use default rules' in the dropdown

if I select a specific tax rule the tax calculates correctly for the shipping for that one specific rule - but I ship all over & need to calculate tax accordingly

is there any way to get the Shipment Method: weight_countries to use the default tax rules?

thank you!

GJC Web Design

as u saw the ship method only takes one tax rule "statically"

I assume you need to clone the ship method for each country etc .. and filter by the same filters as the rule
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

dsrpmedia

thanks for your suggestion

unfortunately it is by state / province that I need the rules to apply so cloning by country does no good.

so you are saying that the shipping module does not work with default rules?

why would they make that an option then?

GJC Web Design

well here's a funny thing

in the weight ship plugin weight_countries.php VM3.0.8

the function plgVmOnProductDisplayShipment() (which I assume is the annoying ship cost that everyone switches off on the product details) doesn't use the plugin configured tax id at all

it takes what ever vat tax is currently used on the prices

Quoteif(isset($product->prices['VatTax']) and count($product->prices['VatTax'])>0){
                  reset($product->prices['VatTax']);
                  $rule = current($product->prices['VatTax']);
                  if(isset($rule[1])){
                     $product->prices['shipmentTax'] = $product->prices['shipmentPrice'] * $rule[1]/100.0;
                     $product->prices['shipmentPrice'] = $product->prices['shipmentPrice'] * (1 + $rule[1]/100.0);

                  }
               }

where as the getCosts() function (used in the cart I think) doesn't factor in tax at all
complete function

Quotefunction getCosts (VirtueMartCart $cart, $method, $cart_prices) {

      if ($method->free_shipment && $cart_prices['salesPrice'] >= $method->free_shipment) {
         return 0.0;
      } else {
         return $method->shipment_cost + $method->package_fee;
      }
   }

the only place I can find the configured tax id used (the one selected in the plugin) is in the plgVmConfirmedOrder() function
used when the order is stored

Quote$values['tax_id'] = $method->tax_id;
      $this->storePSPluginInternalData ($values);

and in the admin order display getOrderShipmentHtml()

Quote$tax = ShopFunctions::getTaxByID ($shipinfo->tax_id);
      $taxDisplay = is_array ($tax) ? $tax['calc_value'] . ' ' . $tax['calc_value_mathop'] : $shipinfo->tax_id;
      $taxDisplay = ($taxDisplay == -1) ? vmText::_ ('COM_VIRTUEMART_PRODUCT_TAX_NONE') : $taxDisplay;

all very odd...  have u checked if the shipping display on the productdetails is correct if an address is given?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

dsrpmedia

Quotehave u checked if the shipping display on the productdetails is correct if an address is given?

I just turned on the shipping display on the product details page, the basic shipping is displaying correctly, but no mention of tax (tried both the default rule & a static rule which is working in the cart)

* I have modified the product details page to not show taxes / discounts etc on the product pricing, not sure if that would effect the shipping pricing as well

GJC Web Design

Quote* I have modified the product details page to not show taxes / discounts etc on the product pricing, not sure if that would effect the shipping pricing as well

it tries to get the tax rate from the $product->prices['VatTax']

you can echo that out in the details and see if set

print 'Debug Line '.__LINE__.' $product->prices[VatTax] <pre>'; print_r ($product->prices['VatTax']); print "</pre><br />\n";
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

dsrpmedia

I ran that on the default_showprices file and got a result

Debug Line 43 $product->prices[VatTax]

1

is that the page you meant for me to enter it on?

what does '1' mean?

GJC Web Design

oops  - should be

print 'Debug Line '.__LINE__.' $this->product->prices[VatTax] <pre>'; print_r ($this->product->prices['VatTax']); print "</pre><br />\n";

should be the tax applied

[VatTax] => Array
        (
            [1] => Array
                (
                   
  • => Tax
                        [1] => 20.0000
                        [2] => +%
                        [3] => 0
                        [4] => 47
                        [5] =>
                        [6] => 1
                        [7] => 1
                    )

            )

    in this case   $product->prices['shipmentTax'] = $product->prices['shipmentPrice'] * $rule[1]/100.0;

    from above $rule[1] would be 20.0000
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation