How can I set -10% discount price for all products on my order page. Price for product must be the same, just final price must automatic be -10%.. How can I insert a line, let's say -10% discount, between summaryProducts and summaryDelivery on order page.
$iDiscountPercent = 10; // this is where you specify how much percent is discounted from the total price for products, only values 0 - 99 are valid $this->aOrders[$iId]['fOrderSummary'] = $aData['fOrderSummary'] = normalizePrice( ($aData['fProductsSummary'] * (1-($iDiscountPercent/100)) ) + $this->aOrders[$iId]['fPaymentCarrierPrice']);
And REPLACE it with following: iDiscountPercent = 10; // this is where you specify how much percent is discounted from the total price for products, only values 0 - 99 are valid fOrderSummary = fOrderSummary * (1- (iDiscountPercent/100) ); gEBI( 'orderSummary' ).innerHTML = changePriceFormat( +fOrderSummary + fDeliveryCost )
In templates/orders_form.tpl after <tr class="summaryProducts"> ... </tr> add: <tr class="summaryProducts"> <th colspan="3"> Fixed discount </th> <td> 10 % </td> </tr>
In templates/orders_print.tpl paste under <tr class="summaryProducts">..</tr>: <tr class="summaryProducts"> <th colspan="3">Fixed discount:</th> <td>10 %</td> </tr>
---------- That's it, this should work sufficiently. I didn't test it, please try and let me know how it works here. And have a beer on me, because I spent 1/2 hour writing this stuff.
dulej
2008-12-10 21:15
Nothing happens when i replace all this.. I think the problem is in this line $iDiscountPercent = 10; I change this
Your solution is not good. I also must apologize, I didn't test mine, so my own was not really sound either. Here is what you need to do, this is not a complete solution since it would be quite difficult to make (and describe) full modification:
$iDiscountPercent = 10; // this is where you specify how much percent is discounted from the total price for products, only values 0 - 99 are valid $aData['fProductsSummary'] = normalizePrice( ($aData['fProductsSummary'] * (1-($iDiscountPercent/100)) ));
You do not need to make any changes to the default javascript code in core/common.js this time. Erase the previous changes.
Then n templates/orders_form.tpl after <tr class="summaryProducts"> ... </tr> add: <tr class="summaryProducts"> <th colspan="3"> Fixed discount </th> <td> 10 % </td> </tr>
In templates/orders_print.tpl paste under <tr class="summaryProducts">..</tr>: <tr class="summaryProducts"> <th colspan="3">Fixed discount:</th> <td>10 %</td> </tr>
This solution changes the final price ONLY after a courier/payment is chosen. You can tell your customers this will happen after they choose the courier payment. Other than that this should work. Please do not put the % sign to the $iDiscountPercent variable.
btw I see what you're trying to do; if you're interested in nice full solution, write to me or opensolution.org guys and prepare to pay some, since it is not that easy as changing 2 lines of code. Several files need to be changed.
and APPEND UNDER it following code (DO NOT REPLACE):
$iDiscountPercent = 10; // this is where you specify how much percent is discounted from the total price for products, only values 0 - 99 are valid $aData['fProductsSummary'] = normalizePrice( ($aData['fProductsSummary'] * (1-($iDiscountPercent/100)) ));
You do not need to make any changes to the default javascript code in core/common.js this time. Erase the previous changes.
Then n templates/orders_form.tpl after <tr class="summaryProducts"> ... </tr> add: <tr class="summaryProducts"> <th colspan="3"> Fixed discount </th> <td> 10 % </td> </tr>
In templates/orders_print.tpl paste under <tr class="summaryProducts">..</tr>: <tr class="summaryProducts"> <th colspan="3">Fixed discount:</th> <td>10 %</td> </tr>