insert -10%

dulej

No avatar

2008-12-08 18:27

Hi, I have one question!

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.

Tnx a lot..
Dule, Slovenia

» Quick.Cart v3.x

beholder

Avatar: beholder

2008-12-08 23:22

I'll answer your question tomorrow when I have time to look at the source code. Should be simple enough.

beholder

Avatar: beholder

2008-12-09 16:08

In core/orders.php find:


$this
->aOrders[$iId]['fOrderSummary'] = $aData['fOrderSummary'] = normalizePrice$aData['fProductsSummary'] + $this->aOrders[$iId]['fPaymentCarrierPrice']);



and REPLACE it with following code:


$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']);




Then in core/common.js find:


gEBI
'orderSummary' ).innerHTML changePriceFormat( +fOrderSummary fDeliveryCost )



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

No avatar

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

if ( $aData['fProductsSummary'] > 30 ) {
$iDiscountPercent = '10%' ;
$aData['sProductsSummary'] = displayPrice( $aData['fProductsSummary'] * 0.9 );
}

and it works, just one thing doesn't work, i want that -10% displays me on order page, but it don't, when order is biger than 30eur..

Thanks anyway, you have a beer from me..

beholder

Avatar: beholder

2008-12-11 17:26

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:


In core/orders.php find:

$aData['sProductsSummary'] = displayPrice( $aData['fProductsSummary'] );

and REPLACE it with following code:

$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.

beholder

Avatar: beholder

2008-12-11 17:29

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.

beholder

Avatar: beholder

2008-12-11 17:36

damn, I made a grave mistake in the above script, here is a correction:

In core/orders.php find:

$aData['sProductsSummary'] = displayPrice( $aData['fProductsSummary'] );

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>

Back to top
about us | contact