Jump to content

Different Tax per user group


soyoh

Recommended Posts

Hello guys,

i've a problem, i need to set different taxes per user group. i tried several modifications that i found on the forum and other blogs but without success.

 

anyone know how can i do it??

 

so far, i've tried to override the file tax/Tax.php without success, somehow it seems that the file is not being executed, is this file still being used?

 

this is what i've done so far:

 

- Users choose wich group they want when registering, this is done and working

- Prices are displayed with different tax depending of that user group, this doesn't work, i tried this piece of code:

public static function getProductTaxRate($id_product, $id_address = null, Context $context = null)
	{
		// echo "----";
		
		if ($context == null)
			$context = Context::getContext();
							
		$groups = Customer::getGroupsStatic($context->cart->id_customer);
		$taxratenew = null;
		foreach ($groups as $g) {
			switch ($g) {
				case 1:
				case 2:
				case 3:
				case 4:
					$taxratenew = 22;
					break;
				case 5:
					$taxratenew = 10;
					break;
				default:
					$taxratenew = 10;
			}
		}
		
		if (!$taxratenew) {
			$id_tax_rules = (int)Product::getIdTaxRulesGroupByIdProduct($id_product, $context);
			$tax_manager = TaxManagerFactory::getManager($address, $id_tax_rules);
			$tax_calculator = $tax_manager->getTaxCalculator();
			$taxratenew = $tax_calculator->getTotalRate();
		}
		return $taxratenew;
	}

i tried debuggin or setting a trown exception, but seems that is not beign executed at all. anyone can point me to the right direction please??

 

 

thanks for your help.

 

 

Link to comment
Share on other sites

Hello,

Thanks for your response. this is because we have different type of clients, and we have to apply different taxes to each one.

 

For example, if we sell to an individual we want to apply 15% of taxes, if is a company 20%,,, etc and we want to have another user group "taxes exempt"

 

maybe there is another solution for this rather than modifying the code, but i really dont know, i'm quite new to prestashop.

 

any help or directions are really appreciated...

Link to comment
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
×
×
  • Create New...