Pages:

'Single Rate of Tax' Plugin

Wizzud

No avatar

2005-03-07 11:34

I'm sorry to say that it is not a simple task, because the values that you need to check are not readily available at the points at which you need to check them. Taking it literally to be '4 or more items' (ie. 4 of one product, or 1 of 4 products, would both qualify) I THINK the steps you would need to take would be along the following lines (dots indicate pre-existing code):

- modify singelRateTax.tpl, COURIER block, to add another hidden field with a name of, say, bApplyDiscount, and a value of $aBasket[bApplyDiscount]

- in the listBasket function (in core/orders.php), inside the for loop, tally the total items into a temporary variable (eg. $iTotalItems), then at the end of the for loop set $aBasket['bApplyDiscount'] to'y' or 'n' (or 1/0 if you prefer) depending on the value of $iTotalItems.
For example:
$iTotalItems = 0;
for(...... {
...
$iTotalItems += $aBasket['iQuantity'];
} //end for
...
$aBasket['bApplyDiscount'] = ($iTotalItems>3)?'y':'n';
...

- in ordersTax.js (in js folder) put an if statement around where it calculates fTax, eg

...
if(document.form['bApplyDiscount'].value == 'y'){
fTax = ( .....
}else{
fTax = 0;
}
...

- in the 'windowPrintOrder' section of actions_client.php (in plugins/singleRateTax folder) put an if statement around where if calculates $fTax, eg

...
if($aBasket['bApplyDiscount']=='y'){
$fTax = .....
}else{
$fTax = sprintf( '%01.2f', 0);
}
...

- in actions_admin.php (plugins/singleRateTax folder) do the same as above for the 'windowPrintOrder' section; for the 'ordersMore' section its similar, eg.

...
if($aBasket['bApplyDiscount']=='y'){
$aOrder['fTax'] = .....
}else{
$aOrder['fTax'] = sprintf( '%01.2f', 0);
}
...

- If you have other plugins installed you may have to modify them as well. For example, sendOrderToClient, htmlMailOrderDetails, scriptedPrintOrder, will all require the same sort of changes as above wherever $fTax is calculated; the productAttributes plugin will require the listBasket function changes; there may be others but I don’t think so.

As you can see its not that simple, and I must stress that I haven't tried any of the above so it is UNTESTED! Take copies of any files you intend to change, BEFORE changing them!

I hope this helps.

laptop

No avatar

2005-03-27 15:02

yes, please send me to Laptop47@hotmail.com

Thanks!

Kim

No avatar

2005-05-03 21:31

please send me this plugin

thanks

Kim xvid@sol.dk

catm

No avatar

2005-06-25 09:17

Can you send me your plug-in? I appreciate it.

catmadoka@hotmail.com

wizzud

No avatar

2005-06-26 10:18

Plugins are available for download from this site ('download' link at top of page). Plugins I personally have developed are also available at ...

Pages:
Back to top
about us | contact