TaxPlugin Workaround -> Fixed prices instead of percentage

zandmanneke

No avatar

2005-07-26 14:07

Okay, this workaround enables you to show/hide fixed prices (order costs etc) instead of percentages. I.e., if your basket total is less then a pre-defined value an extra (fixed) amount will be added. If it's more, it will not be added. You are in control of the fixed value, customers can see whether it is applied or not.

A small warning: Since my onw shop is heavily customized the workaround may not always work on your shop. Basic knowledge of HTML and preferably PHP is advisable... Backup, please do make a backup before you start "messing" around...

Step 1 - Make a backup of your shop
Step 2 - Install the TaxAndDiscount Plugin
Step 3 - Make a backup of your shop
Step 4 - Open taxAndDiscount.js for editing and replace EVERYTHING between //DISCOUNT and // end of DISCOUNT with the following (I left the tags for easy reading):

// DISCOUNT ...
if(gEBI("discountCost")){
var fDiscount = 0, fDiscountCost = 0;
for(var i=0; i<aDiscounts.length; i++){
// aDiscounts format : [0] basket-amount-trigger , [1] no-of-items-trigger , [2] discount-rate
if(fOrderCost <= aDiscounts[i][0] && iItems >= aDiscounts[i][1]){
fDiscount = aDiscounts[i][2];
}
}
if(fDiscount > 0) {
fDiscountCost = fDiscount;
fOrderCost += fDiscountCost;
var sShowRate = fix(fDiscount);

if(bShowDiscount){
gEBI("discountRate").innerHTML = "";
}
document.form['fDiscountRate'].value = sShowRate;
}
gEBI("discountCost").innerHTML = fix( fDiscountCost );
document.form['fDiscount'].value = gEBI( "discountCost" ).innerHTML;
} // end of DISCOUNT

Step 5 - Open config/general.php for editing and change the array line into the following:

$config['discount_rates'] = array( array( 74.99, 0, 5 ) );

(This line will add the amount of 5.00 when the basket value is lower then 75.00 which is actually 74.99. You can change the values as you like, leave the center one a 0 (zero))

Step 6 - Open your language file and change the $lang[Discount_description] into a value like: "Order costs" or something similar to your liking.

Step 7 - Open templates/default/taxAndDiscount_print.tpl for editing and replace everything between <!-- BEGIN DISCOUNT --> and <!-- END DISCOUNT --> with the following (I left the tags for easy reading):

<!-- BEGIN DISCOUNT -->
<tr>
<td colspan='3' style='text-align: right; padding: 5px;'>
$lang[Discount_description]
</td>
<td style='font-weight: bold; text-align: right; padding: 5px;'>
$aOrder[fDiscount] $config[currency_symbol]
</td>
</tr>
<!-- END DISCOUNT -->

This will make sure the "%" sign is not shown (we don't use percentages anymore now do we?)

Step 8 - Save it all, check, re-check, triple-check and if it works, let me know!

Zandmanneke

Back to top
about us | contact