Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Tax Exempt MS2.2


FWR Media

Recommended Posts

A U.S client of mine wanted to install ..

 

tax_exempt_and_organization_discounts_version-1.5 x contribution

 

After 4 hours of testing I came to the conclusion that the contribution has tons of errors and is fundamentally unstable.

 

So I wrote this, including testing this took me about 20 hours. (parts of the above contribution are still used so credit for the original goes to Lee Leahu):

 

Tax Exempt

 

What is it for:

 

When a customer signs up they can select: -

 

Tax exempt yes/no

 

Enter tax exempt id

 

Choose an organisational type (e.g. school)

 

Tax exempt clients will not pay tax on checkout, they will also see their tax exempt status and tax exempt id on ..

 

Checkout confirmation

 

Account history (historical purchases)

 

Invoice.

 

In the admin panel when you view a customer you see all this info and have the opportunity to edit it.

 

Customers cannot edit this info they would have to contact the site owner (intentional)

 

 

 

 

 

How easy is it to install?

 

Note: I have taken the liberty of including Chemos tax class as a necessity. Well you should have had it anyway!!

 

Upload 3 new files and one new image.

 

catalog/includes/classes/tax.php

 

admin/orgtypes.php

 

admin/includes/languages/english/orgtypes.php

 

admin/includes/languages/english/images/buttons/button_new_org_type.gif

 

One SQL file to run in phpMyadmin.

 

Using winmerge or similar this can take as little as 30 mins even though it is 22 files.

Edited by Jan Zonjee
Link to comment
Share on other sites

A U.S client of mine wanted to install ..

 

tax_exempt_and_organization_discounts_version-1.5 x contribution

 

After 4 hours of testing I came to the conclusion that the contribution has tons of errors and is fundamentally unstable.

 

So I wrote this, including testing this took me about 20 hours. (parts of the above contribution are still used so credit for the original goes to Lee Leahu)

What is it for:

 

When a customer signs up they can select: -

 

Tax exempt yes/no

 

Enter tax exempt id

 

Choose an organisational type (e.g. school)

 

Tax exempt clients will not pay tax on checkout, they will also see their tax exempt status and tax exempt id on ..

 

Checkout confirmation

 

Account history (historical purchases)

 

Invoice.

 

In the admin panel when you view a customer you see all this info and have the opportunity to edit it.

 

Customers cannot edit this info they would have to contact the site owner (intentional)

How easy is it to install?

 

Note: I have taken the liberty of including Chemos tax class as a necessity. Well you should have had it anyway!!

 

Upload 3 new files and one new image.

 

catalog/includes/classes/tax.php

 

admin/orgtypes.php

 

admin/includes/languages/english/orgtypes.php

 

admin/includes/languages/english/images/buttons/button_new_org_type.gif

 

One SQL file to run in phpMyadmin.

 

Using winmerge or similar this can take as little as 30 mins even though it is 22 files.

 

 

Not to be a downer.. SPPC 4.1.6 with my TAX EXEMPTABLE ADDON or SPPC 4.2.0 will do everything you just created with the added bonus of having the ability to set seperate pricing for specific types of customers such as distributors, friends, etc..

 

Although I would say you may have a problem if any customer can come by and add in random info for the tax id's and get exempted even if they are not supposed to.. as the admin you should specify who is allowed to be exempt and from which taxes after confirming their tax information..

Edited by insaini
Link to comment
Share on other sites

Not to be a downer.. SPPC 4.1.6 with my TAX EXEMPTABLE ADDON or SPPC 4.2.0 will do everything you just created with the added bonus of having the ability to set seperate pricing for specific types of customers such as distributors, friends, etc..

 

Although I would say you may have a problem if any customer can come by and add in random info for the tax id's and get exempted even if they are not supposed to.. as the admin you should specify who is allowed to be exempt and from which taxes after confirming their tax information..

 

No downer .. I wasn't going to change 80 osC files and bloat out osC just to have the benefit of a "small aspect" of SPPC. And I'm sure others are similar.

 

I only released this as I created it for a customer, it may well not be appropriate for some but it may be for others.

 

I would imagine it is the job of the shop owner to confirm the validity of tax exempt ids.

Edited by FWR Media
Link to comment
Share on other sites

  • 3 weeks later...

I'm getting an error on my shopping_cart.php page when i add a product to the shopping cart. I hope this makes sense. I included the errors (when i'm logged in and when i'm not logged in), the lines of code that the errors are referring to, The tax exempt code that i inserted into the general.php page and the code that was replaced by the tax exempt code.... (I was suppose to replace a snippet of code with the tax exempt code, right?)

 

====================

ERROR WHEN I'M LOGGED IN

====================

 

Fatal error: Call to a member function on a non-object in D:\inetpub\vhosts\... \includes\functions\general.php on line 312

 

=======================

ERROR WHEN I'M NOT LOGGED IN

=======================

 

Fatal error: Call to a member function on a non-object in D:\inetpub\vhosts\... \includes\functions\general.php on line 313

 

========

LINE 312

========

return $osC_Tax->getTaxRate($class_id, $customer_country_id, $customer_zone_id);

 

 

========

LINE 313

========

else return $osC_Tax->getTaxRate($class_id, $country_id, $zone_id);

 

 

===============

THE CODE I ADDED

===============

 

// FWR TAX EXEMPT

function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {

global $osC_Tax, $customer_zone_id, $customer_country_id;

if (tep_session_is_registered('customers_tax_exempt') && $_SESSION['customers_tax_exempt'] == 1) {

return 0;

} else {

if ($customer_country_id && $customer_zone_id)

return $osC_Tax->getTaxRate($class_id, $customer_country_id, $customer_zone_id);

else return $osC_Tax->getTaxRate($class_id, $country_id, $zone_id);

}

}

 

function tep_get_tax_description($class_id, $country_id, $zone_id) {

global $osC_Tax, $customer_zone_id, $customer_country_id;

// BEGIN - Tax Exempt and Organization Discounts

if (tep_session_is_registered('customers_tax_exempt') && $_SESSION['customers_tax_exempt'] == 1) {

return TEXT_TAX_EXEMPT;

} else {

if ($customer_country_id && $customer_zone_id)

return $osC_Tax->getTaxRateDescription($class_id, $customer_country_id, $customer_zone_id);

else return $osC_Tax->getTaxRateDescription($class_id, $country_id, $zone_id);

}

}

// END FWR TAX EXEMPT

 

 

===============================================

THIS IS THE CODE THAT I REPLACED WITH THE TAX EXEMPT CODE

===============================================

 

////

// Returns the tax rate for a zone / class

// TABLES: tax_rates, zones_to_geo_zones

function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {

global $customer_zone_id, $customer_country_id;

 

if ( ($country_id == -1) && ($zone_id == -1) ) {

if (!tep_session_is_registered('customer_id')) {

$country_id = STORE_COUNTRY;

$zone_id = STORE_ZONE;

} else {

$country_id = $customer_country_id;

$zone_id = $customer_zone_id;

}

}

 

$tax_query = tep_db_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");

if (tep_db_num_rows($tax_query)) {

$tax_multiplier = 1.0;

while ($tax = tep_db_fetch_array($tax_query)) {

$tax_multiplier *= 1.0 + ($tax['tax_rate'] / 100);

}

return ($tax_multiplier - 1.0) * 100;

} else {

return 0;

}

}

 

////

// Return the tax description for a zone / class

// TABLES: tax_rates;

function tep_get_tax_description($class_id, $country_id, $zone_id) {

$tax_query = tep_db_query("select tax_description 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 . "' order by tr.tax_priority");

if (tep_db_num_rows($tax_query)) {

$tax_description = '';

while ($tax = tep_db_fetch_array($tax_query)) {

$tax_description .= $tax['tax_description'] . ' + ';

}

$tax_description = substr($tax_description, 0, -3);

 

return $tax_description;

} else {

return TEXT_UNKNOWN_TAX_RATE;

}

}

Link to comment
Share on other sites

I'm getting an error on my shopping_cart.php page when i add a product to the shopping cart. I hope this makes sense. I included the errors (when i'm logged in and when i'm not logged in), the lines of code that the errors are referring to, The tax exempt code that i inserted into the general.php page and the code that was replaced by the tax exempt code.... (I was suppose to replace a snippet of code with the tax exempt code, right?)

 

============================

It looks like i fixed the problem by moving

============================

 

// FWR TAX EXEMPT

require(DIR_WS_CLASSES . 'tax.php');

$osC_Tax = new osC_Tax;

// END FWR TAX EXEMPT

 

============

directly under...

============

 

// currency

if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) {

if (!tep_session_is_registered('currency')) tep_session_register('currency');

 

if (isset($HTTP_GET_VARS['currency'])) {

if (!$currency = tep_currency_exists($HTTP_GET_VARS['currency'])) $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;

} else {

$currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;

}

}

Link to comment
Share on other sites

============================

It looks like i fixed the problem by moving

============================

 

// FWR TAX EXEMPT

require(DIR_WS_CLASSES . 'tax.php');

$osC_Tax = new osC_Tax;

// END FWR TAX EXEMPT

 

============

directly under...

============

 

// currency

if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) {

if (!tep_session_is_registered('currency')) tep_session_register('currency');

 

if (isset($HTTP_GET_VARS['currency'])) {

if (!$currency = tep_currency_exists($HTTP_GET_VARS['currency'])) $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;

} else {

$currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;

}

}

 

Odd looks like your application_top.php calls tep_get_tax somewhere.

Link to comment
Share on other sites

i'm getting the error

 

1146 - Table 'xxxxx_xxxx.TABLE_ORGANIZATION_TYPE' doesn't exist

select org_type_id, org_type_title from TABLE_ORGANIZATION_TYPE order by org_type_id

 

this is happening in create_account.php

 

the table is in the database and i'm running rc2 if that matters.

Edited by NimaP
Link to comment
Share on other sites

i'm getting the error

 

1146 - Table 'xxxxx_xxxx.TABLE_ORGANIZATION_TYPE' doesn't exist

select org_type_id, org_type_title from TABLE_ORGANIZATION_TYPE order by org_type_id

 

this is happening in create_account.php

 

the table is in the database and i'm running rc2 if that matters.

 

never mind i found out. i didn't hit save on my database_tables.php file before uploading.

Link to comment
Share on other sites

  • 4 months later...

Hi.

 

I installed your contribution tax exempt. I don't appear to be getting any errors... That said, heres the problem.

 

Types does appear in the admin, and I can edit the information.

When I click on a customer to edit... there is no field for tax exempt, or however it is supposed to look like, no fields were added, they remain as they were before I installed the contrib - but under "customers" where all the customers are listed you can clearly see Organization type: at the bottom of the right hand box (the one that shows when last visted, created, logged in, etc).

When I sign up as a new customer, it does not offer me tax exempt options... None of the fields changed, none were added, same goes for checking out without logging in...

I used winmerge, as well as the manual instructions. I did the database before updating and adding the files.

Any suggestions?

Silvergren

Link to comment
Share on other sites

  • 2 weeks later...
Hi.

 

I installed your contribution tax exempt. I don't appear to be getting any errors... That said, heres the problem.

 

Types does appear in the admin, and I can edit the information.

When I click on a customer to edit... there is no field for tax exempt, or however it is supposed to look like, no fields were added, they remain as they were before I installed the contrib - but under "customers" where all the customers are listed you can clearly see Organization type: at the bottom of the right hand box (the one that shows when last visted, created, logged in, etc).

When I sign up as a new customer, it does not offer me tax exempt options... None of the fields changed, none were added, same goes for checking out without logging in...

I used winmerge, as well as the manual instructions. I did the database before updating and adding the files.

Any suggestions?

Silvergren

 

 

I would like to say how much I appreciated all the "help" you weren't able to provide. I tried for the final time tonight to upload your contrib to my site. I have checked, and rechecked using winmerge to verify all changes. This last time, I checked each file on 4 separate occasions before I uploaded to my website -thinking I may have missed something each time... NOPE, everything was as you showed in your download... I suppose Jesse was correct in his/her statement... SPPC is apparently the way to go..

 

On a final note, thank you for all the time I wasted on this contrib when it could have been better spent trying someone else's contrib -at least I learned a little more about php!

 

Are you a help VAMPIRE... Gee lets think... nah, just a victim of arrogance... :P

Link to comment
Share on other sites

  • 4 months later...
I suppose Jesse was correct in his/her statement... SPPC is apparently the way to go..

 

On a final note, thank you for all the time I wasted on this contrib when it could have been better spent trying someone else's contrib -at least I learned a little more about php!

 

Are you a help VAMPIRE... Gee lets think... nah, just a victim of arrogance... :P

Apparently you did not learn too much. You cant even figure out how to make a new field show up in the customers account? It doesn't matter if it's in the install instructions or not. You have several examples in the existing customers.php file, and, after going through the new files several times, you couldn't figure out what to code a new field as? Go ahead and install a huge contribution with your bad self then. Just make sure when you CANT do it, yougo blame it on the people that FREELY work hard creating the code for you to FREELY use. You truly are a victim, all arrogance aside, total ignorance abounding.

Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

Link to comment
Share on other sites

  • 2 years later...

Great contribution to the osC family! I do have a question however.. of course.

 

I have a client website that has several other contributions in use, including the widely utilized "ziptax". I would like to continue using this configuration AND include this tax exempt contribution for account creation for customers needing tax exempt status. However, I noticed that this tax exempt contribution includes a "Chemos" tax inclusion.

 

So my question to everyone: is there a way to incorporate all of the great work done on this tax exempt contribution with my existing "ziptax" contribution, and ignore the included "Chemos" tax file?

 

Any ideas would be greatly appreciated, thank you!

Link to comment
Share on other sites

  • 5 months later...

Hi, hope you are well.

 

Just looking at your tax exempt contribution and would like to know if i could set it up so that it only reduces the tax on certain items and not the whole order?

 

I have some items which can be tax free to certain customers such as disabled customers but not the whole product list.

 

Would this contribution do what I require.

 

Thanks for any advice

 

Michael

Link to comment
Share on other sites

I have now installed this contribution and it seems to be ok although I have not done full testing yet.

 

What I would like to do is make the 'Company name' field and the 'tax exempt ID' field Required information under the Company category.

 

How would I do that?

 

Thanks

Link to comment
Share on other sites

Hi, hopefully someone will answer soon.

 

I have another question?

 

At the moment either all the tax is removed or no tax is removed depending on which group you belong to, is there a way to make certain products taxable and some not if you are in the tax exemp class?

 

Perhaps this could be done via tax classes in admin or something? I have tried various variations without much success at the moment.

 

Please please help

 

Thank you

Edited by offie
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...