Latest News: (loading..)
swguy

[Contribution] Quantity Discounts for osCommerce 3.0

26 posts in this topic

Posted (edited)

the add-on for 2.2 and 2.3.3 and 3.0 is still a mess. The Tax calculatuin and the order total totally wrong.

This function

    function get_tax_rate_from_desc($tax_desc) {
      $tax_rate = 0.00;
  
      $tax_descriptions = explode(' + ', $tax_desc);
      foreach ($tax_descriptions as $tax_description) {
        $tax_query_str = "SELECT tax_rate FROM " . TABLE_TAX_RATES . " WHERE tax_description = '" . $tax_desc . "'";
  
        $tax_query = tep_db_query($tax_query_str);
        if (tep_db_num_rows($tax_query)) { 
           while ($tax = tep_db_fetch_array($tax_query)) {
              $tax_rate += $tax['tax_rate']; // <- the plus before the = is a big bug
           }
        }
      }
      return $tax_rate;
    }

calculate the tax wrong, because if u have more than one Tax then the add the tax and use it for calculate.

i change to


    function get_tax_rate_from_desc($tax_desc) {
      $tax_rate = 0.00;
  
      $tax_descriptions = explode(' + ', $tax_desc);
      foreach ($tax_descriptions as $tax_description) {
        $tax_query_str = "SELECT tax_rate FROM " . TABLE_TAX_RATES . " WHERE tax_description = '" . $tax_desc . "'";
  
        $tax_query = tep_db_query($tax_query_str);
        if (tep_db_num_rows($tax_query)) { 
           while ($tax = tep_db_fetch_array($tax_query)) {
              $tax_rate = $tax['tax_rate']; // <- here i delete the plus befor the =
           }
        }
      }
      return $tax_rate;
    }

but the the total ist still wrong. any suggestions?

 

The function for 3.0 looks differnt, but the same error with the plus in front the =

Edited by mcmannehan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now