Results 1 to 10 of 25

Hybrid View

  1. #1
    Join Date
    May 2006
    Posts
    30
    Plugin Contributions
    0

    Default Re: Charge only one tax from resellers

    Hi scully2569

    I was not sure if anybody else needs this. I am not expert, but I managed to hack the code to my needs. Here is how I did it -

    Please note that you need to have the "dual_pricing_1_3" module installed before making this change.

    Open the file includes/functions/functions_taxes.php

    Close to line 32, look for -

    PHP Code:
        $tax_query "select sum(tax_rate) as tax_rate
                      from (" 
    TABLE_TAX_RATES " tr
                      left join " 
    TABLE_ZONES_TO_GEO_ZONES " za on (tr.tax_zone_id = za.geo_zone_id)
                      left join " 
    TABLE_GEO_ZONES " tz on (tz.geo_zone_id = tr.tax_zone_id) )
                      where (za.zone_country_id is null
                      or za.zone_country_id = 0
                      or za.zone_country_id = '" 
    . (int)$country_id "')
                      and (za.zone_id is null
                      or za.zone_id = 0
                      or za.zone_id = '" 
    . (int)$zone_id "')
                      and tr.tax_class_id = '" 
    . (int)$class_id "'
                      group by tr.tax_priority"

    Replace it with -

    PHP Code:
    // KLUDGE START by Harmeet - To charge only GST from resellers.
    if ($_SESSION['customer_id']) {
        
    $customers_id $_SESSION['customer_id'];
        
    $customer_check $db->Execute("select * from " TABLE_CUSTOMERS " where customers_id = '$customers_id'");
        if (
    $customer_check->fields['customers_whole'] != "0") {
            
    $whole 1;
        }
    }
    if (
    $whole) {
        
    $tax_query "select tax_rate as tax_rate
                      from (" 
    TABLE_TAX_RATES " tr
                      left join " 
    TABLE_ZONES_TO_GEO_ZONES " za on (tr.tax_zone_id = za.geo_zone_id)
                      left join " 
    TABLE_GEO_ZONES " tz on (tz.geo_zone_id = tr.tax_zone_id) )
                      where (za.zone_country_id is null
                      or za.zone_country_id = 0
                      or za.zone_country_id = '" 
    . (int)$country_id "')
                      and (za.zone_id is null
                      or za.zone_id = 0
                      or za.zone_id = '" 
    . (int)$zone_id "')
                      and tr.tax_class_id = '" 
    . (int)$class_id "'
                      group by tr.tax_priority"
    ;
    }
    else {
    // KLUDGE END
        
    $tax_query "select sum(tax_rate) as tax_rate
                      from (" 
    TABLE_TAX_RATES " tr
                      left join " 
    TABLE_ZONES_TO_GEO_ZONES " za on (tr.tax_zone_id = za.geo_zone_id)
                      left join " 
    TABLE_GEO_ZONES " tz on (tz.geo_zone_id = tr.tax_zone_id) )
                      where (za.zone_country_id is null
                      or za.zone_country_id = 0
                      or za.zone_country_id = '" 
    . (int)$country_id "')
                      and (za.zone_id is null
                      or za.zone_id = 0
                      or za.zone_id = '" 
    . (int)$zone_id "')
                      and tr.tax_class_id = '" 
    . (int)$class_id "'
                      group by tr.tax_priority"
    ;
    // KLUDGE START by Harmeet - To charge only GST from resellers.
    }
    // KLUDGE END 

    Close to line 78, look for -

    PHP Code:
        if ($tax->RecordCount() > 0) {
          
    $tax_description '';
          while (!
    $tax->EOF) {
            
    $tax_description .= $tax->fields['tax_description'] . ' + ';
            
    $tax->MoveNext();
          }
          
    $tax_description substr($tax_description0, -3);

          return 
    $tax_description;
        } else {
          return 
    TEXT_UNKNOWN_TAX_RATE;
        } 
    Replace it with -

    PHP Code:
    // KLUDGE START by Harmeet - To charge only GST from resellers.
      
    if ($_SESSION['customer_id']) {
        
    $customers_id $_SESSION['customer_id'];
        
    $customer_check $db->Execute("select * from " TABLE_CUSTOMERS " where customers_id = '$customers_id'");
        if (
    $customer_check->fields['customers_whole'] != "0") {
            
    $whole 1;
        }
      }
      if (
    $whole) {
        if (
    $tax->RecordCount() > 0) {
          
    $tax_description $tax->fields['tax_description'] . ' + ';
          
    $tax_description substr($tax_description0, -3);
          return 
    $tax_description;
        } else {
          return 
    TEXT_UNKNOWN_TAX_RATE;
        }
      }
      else {
    // KLUDGE END
        
    if ($tax->RecordCount() > 0) {
          
    $tax_description '';
          while (!
    $tax->EOF) {
            
    $tax_description .= $tax->fields['tax_description'] . ' + ';
            
    $tax->MoveNext();
          }
          
    $tax_description substr($tax_description0, -3);

          return 
    $tax_description;
        } else {
          return 
    TEXT_UNKNOWN_TAX_RATE;
        }
    // KLUDGE START by Harmeet - To charge only GST from resellers.
      
    }
    // KLUDGE END 
    Hope it works for you.

    Thanks
    Last edited by harmeet; 13 Aug 2006 at 10:19 PM.

  2. #2
    Join Date
    May 2006
    Posts
    30
    Plugin Contributions
    0

    Default Re: Charge only one tax from resellers

    Here is the link to the Dual Pricing module -

    http://www.zen-cart.com/forum/showthread.php?t=35450

    Thanks

  3. #3
    Join Date
    Jan 2006
    Posts
    13
    Plugin Contributions
    0

    Default Re: Charge only one tax from resellers

    That is awesome, I will tackle that one soon!
    Thanks for replying

  4. #4
    Join Date
    Jun 2006
    Posts
    566
    Plugin Contributions
    0

    Default Re: Charge only one tax from resellers

    sweet this must be the answer i have been looking for?

  5. #5
    Join Date
    Dec 2006
    Posts
    5
    Plugin Contributions
    0

    Default Re: Charge only one tax from resellers

    Now it seems that Zen Cart has some code that apparently works for wholesalers (Thanks Harmeet!), I'm going to seriously test how well this works for my needs. However, there is another download (Tax Exemption Status) that seems to be similar to the the modifed Dual Pricing module.

    Has anyone set up a store for both retail and wholesale customers so that wholesale customers are exempt from paying provincial retail sales tax (in Canada)?

  6. #6
    Join Date
    Nov 2007
    Posts
    270
    Plugin Contributions
    0

    Default Re: Charge only one tax from resellers

    Quote Originally Posted by harmeet View Post
    Hi scully2569

    I was not sure if anybody else needs this. I am not expert, but I managed to hack the code to my needs. Here is how I did it -

    Please note that you need to have the "dual_pricing_1_3" module installed before making this change.

    Open the file includes/functions/functions_taxes.php

    Close to line 32, look for -

    PHP Code:
        $tax_query "select sum(tax_rate) as tax_rate
                      from (" 
    TABLE_TAX_RATES " tr
                      left join " 
    TABLE_ZONES_TO_GEO_ZONES " za on (tr.tax_zone_id = za.geo_zone_id)
                      left join " 
    TABLE_GEO_ZONES " tz on (tz.geo_zone_id = tr.tax_zone_id) )
                      where (za.zone_country_id is null
                      or za.zone_country_id = 0
                      or za.zone_country_id = '" 
    . (int)$country_id "')
                      and (za.zone_id is null
                      or za.zone_id = 0
                      or za.zone_id = '" 
    . (int)$zone_id "')
                      and tr.tax_class_id = '" 
    . (int)$class_id "'
                      group by tr.tax_priority"

    Replace it with -

    PHP Code:
    // KLUDGE START by Harmeet - To charge only GST from resellers.
    if ($_SESSION['customer_id']) {
        
    $customers_id $_SESSION['customer_id'];
        
    $customer_check $db->Execute("select * from " TABLE_CUSTOMERS " where customers_id = '$customers_id'");
        if (
    $customer_check->fields['customers_whole'] != "0") {
            
    $whole 1;
        }
    }
    if (
    $whole) {
        
    $tax_query "select tax_rate as tax_rate
                      from (" 
    TABLE_TAX_RATES " tr
                      left join " 
    TABLE_ZONES_TO_GEO_ZONES " za on (tr.tax_zone_id = za.geo_zone_id)
                      left join " 
    TABLE_GEO_ZONES " tz on (tz.geo_zone_id = tr.tax_zone_id) )
                      where (za.zone_country_id is null
                      or za.zone_country_id = 0
                      or za.zone_country_id = '" 
    . (int)$country_id "')
                      and (za.zone_id is null
                      or za.zone_id = 0
                      or za.zone_id = '" 
    . (int)$zone_id "')
                      and tr.tax_class_id = '" 
    . (int)$class_id "'
                      group by tr.tax_priority"
    ;
    }
    else {
    // KLUDGE END
        
    $tax_query "select sum(tax_rate) as tax_rate
                      from (" 
    TABLE_TAX_RATES " tr
                      left join " 
    TABLE_ZONES_TO_GEO_ZONES " za on (tr.tax_zone_id = za.geo_zone_id)
                      left join " 
    TABLE_GEO_ZONES " tz on (tz.geo_zone_id = tr.tax_zone_id) )
                      where (za.zone_country_id is null
                      or za.zone_country_id = 0
                      or za.zone_country_id = '" 
    . (int)$country_id "')
                      and (za.zone_id is null
                      or za.zone_id = 0
                      or za.zone_id = '" 
    . (int)$zone_id "')
                      and tr.tax_class_id = '" 
    . (int)$class_id "'
                      group by tr.tax_priority"
    ;
    // KLUDGE START by Harmeet - To charge only GST from resellers.
    }
    // KLUDGE END 

    Close to line 78, look for -

    PHP Code:
        if ($tax->RecordCount() > 0) {
          
    $tax_description '';
          while (!
    $tax->EOF) {
            
    $tax_description .= $tax->fields['tax_description'] . ' + ';
            
    $tax->MoveNext();
          }
          
    $tax_description substr($tax_description0, -3);

          return 
    $tax_description;
        } else {
          return 
    TEXT_UNKNOWN_TAX_RATE;
        } 
    Replace it with -

    PHP Code:
    // KLUDGE START by Harmeet - To charge only GST from resellers.
      
    if ($_SESSION['customer_id']) {
        
    $customers_id $_SESSION['customer_id'];
        
    $customer_check $db->Execute("select * from " TABLE_CUSTOMERS " where customers_id = '$customers_id'");
        if (
    $customer_check->fields['customers_whole'] != "0") {
            
    $whole 1;
        }
      }
      if (
    $whole) {
        if (
    $tax->RecordCount() > 0) {
          
    $tax_description $tax->fields['tax_description'] . ' + ';
          
    $tax_description substr($tax_description0, -3);
          return 
    $tax_description;
        } else {
          return 
    TEXT_UNKNOWN_TAX_RATE;
        }
      }
      else {
    // KLUDGE END
        
    if ($tax->RecordCount() > 0) {
          
    $tax_description '';
          while (!
    $tax->EOF) {
            
    $tax_description .= $tax->fields['tax_description'] . ' + ';
            
    $tax->MoveNext();
          }
          
    $tax_description substr($tax_description0, -3);

          return 
    $tax_description;
        } else {
          return 
    TEXT_UNKNOWN_TAX_RATE;
        }
    // KLUDGE START by Harmeet - To charge only GST from resellers.
      
    }
    // KLUDGE END 
    Hope it works for you.

    Thanks
    I know this is 2 years old, but I tried it with the new Dual Pricing/Wholesale module, but it works only for wholesale levels. When I have a retailer (indicated as wholesale level 0) it also does not include PST.
    Anyone got it working??
    Tx Veronika

  7. #7
    Join Date
    Nov 2007
    Posts
    270
    Plugin Contributions
    0

    Default Re: Charge only one tax from resellers

    Quote Originally Posted by Veronika7747 View Post
    I know this is 2 years old, but I tried it with the new Dual Pricing/Wholesale module, but it works only for wholesale levels. When I have a retailer (indicated as wholesale level 0) it also does not include PST.
    Anyone got it working??
    Tx Veronika
    I got this working, but now I have a problem with HST for wholesalers in Eastern Canada ( ns, nf, nb) as they are still being charged 13% HST. I am assuming their HST should also drop the 8% PST, right?
    Any comments
    Tx

 

 

Similar Threads

  1. v151 I need to charge tax only in Colorado
    By brianw3185 in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 14
    Last Post: 30 Sep 2013, 07:46 AM
  2. Workaround for Resellers/Tax Exempt
    By sarahbn in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 5
    Last Post: 26 Jun 2009, 08:13 PM
  3. Only charge tax to people from the same state
    By susanshropshire in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 3
    Last Post: 17 May 2009, 08:39 PM
  4. how do i charge just one flat tax rate
    By rohitsax in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 8
    Last Post: 6 Nov 2007, 04:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg