MX Shop Forum :: Adding value on:

This thread was displayed: 0 times


Starting with 17th May 2007, Adobe Systems will stop offering support for any version of the discontinued InterAKT products. As a result, we will not answer to new support incidents starting with May 17th, 2007. Pending support incidents will still be followed in order to be closed. The product forums will remain open and be transformed in user-to-user forums. The general forums will be made read-only and not allow new posts or comments.

For more information about the affected products visit: www.interaktonline.com/Support/

View Threaded Show all Show descending
fernando.delgado @aon.at
06-02-2007 14:47:32 GMT +2

Hello guys,

I apologize for this question out of support date limit, but maybe some user can help me out with this simple question:

Using MX Shop, for example in the offer nugget comes a product with the
price:" Only  €100.00" that's fine. I just want to  have this value printed with 20% added. I try this adding just *1.20 and works fine on other pages such as product view nugget, but not in the Offer and Cart nugget:

This is the code wich print the Offer price, I just try to multiplicate $row_rsOffer['price_prd'] * 1.20  , but I get  always  normal price value :

<p>Buy Only:  <?php echo krt_getFpDiscount($row_rsOffer['price_prd']*1.20,$row_rsOffer['id_prd']);//getFpDiscount Kart 3 function ?> </p>

Notice that this work fine on Product View and Product Details nuggets.

Also on the Cart nugget, i want to print the Total + 20% added ( only printed here )

this code print the total value wich I want to add 20%:

<?php echo $row_KartFV_RS['MXK_TotalPrice']; ?> //this Print the right value fine

I try to do the before but it does not work:

<?php
$all = $row_KartFV_RS['MXK_TotalPrice'] * 1.20;
?>

Total price: <?php echo $all; ?> /I get 0, why ?

Note: I'm calculating the Taxes properly set 20% for all countries and this is working perfectly, i just want to add 20% to the pronted values on Cart nugget  total and offer nugget price.

live site is here

Please somebody help me out with this !

Thanks in advance,
Fernando Delgado.

Back | Reply | Quote | Top
Chris Pollock
06-04-2007 14:30:59 GMT +2

Hi Fernando,

I think your problem is that the prices are stored as text, not numerals. You will have to convert them to numbers before you can do the calculations. The following is a code segment I have used to calculate a 10% tax on a list of prices:

<?php } while ($row_rsOrderDetails = mysql_fetch_assoc($rsOrderDetails)); ?>
<?php $total_incGST_num = 1.1*(float) ((str_replace(',','',substr($row_KARTRecordset['MXK_TotalPrice'],1))));
$currency = krt_getCurrentCurrency();
$cur = substr($row_KARTRecordset['MXK_TotalPrice'],0,1);
$total_incGST_str = $cur . number_format($total_incGST_num, $KT_currencies[$currency]['decimals'], $KT_currencies[$currency]['decsep'], $KT_currencies[$currency]['thsep']);?>

You should be able to modify it to your needs. The important steps are in line 2 (converting the string to a number) and the last three lines which format the price. For 20% you will need to replace 1.1 with 1.2 (line 2).

Good luck!

Chris P

Reply | Quote | Top
fernando.delgado @aon.at
06-05-2007 15:08:17 GMT +2

Hi Chris,

This is a really big help, I will try it and let you know.

Thanks in advance for replying

fernando.

Reply | Quote | Top
fernando.delgado @aon.at
06-05-2007 15:43:03 GMT +2

HI Cris,

I can not make it work. I made this:

<?php  while ($row_rsOffer = mysql_fetch_assoc($rsOffer)); ?>
<?php $total_incGST_num = 1.2*(float) ((str_replace(',','',substr(krt_getFpDiscount($row_rsOffer['price_prd'],
$row_rsOffer['id_prd']),1))));

$currency = krt_getCurrentCurrency();
$cur = substr(krt_getFpDiscount($row_rsOffer['price_prd'],$row_rsOffer['id_prd']),0,1);
$total_incGST_str = $cur . number_format($total_incGST_num, $KT_currencies[$currency]['decimals'], $KT_currencies[$currency]['decsep'], $KT_currencies[$currency]['thsep']);?>


    echo IncTax: <?php echo $total_incGST_str ?> |


If you look at the file modules/offer/offer_nug.php  you see that the following code get the value wich I want to add 20%:

<?php echo krt_getFpDiscount($row_rsOffer['price_prd'],$row_rsOffer['id_prd']);//getFpDiscount Kart 3 function ?>


I also tried in your exapmple with only ((str_replace(',','',substr($row_rsOffer['price_prd'],1)))); but not work, PLEASE have a look to your offer_nug.php to better understanding looking at the real code.


It's only to add 20% to this valued there, only for visual effect. it looks so simple
but it's not.

Sorry for not make it work, i'm confused with this.

Any suggestion ?


thanks a lot !


Reply | Quote | Top
Chris Pollock
06-06-2007 14:30:40 GMT +2

Hi Fernando,

Sorry, I gave you an abbreviated script that wasn't quite suitable for your application. This works on my offer_nug.php page:

<?php # This is the string to number conversion: ?>
 <?php $total_incGST_num = 1.2*(float) ((str_replace(',','',substr(krt_getFpDiscount($row_rsOffer['price_prd'],$row_rsOffer['id_prd']),1))));
   $currency = krt_getCurrentCurrency();
   $cur = substr(krt_getFpDiscount($row_rsOffer['price_prd'],$row_rsOffer['id_prd']),0,1);
   $total_incGST_str = $cur . number_format($total_incGST_num, $KT_currencies[$currency]['decimals'], $KT_currencies[$currency]['decsep'], $KT_currencies[$currency]['thsep']);?></p>

<?php echo 'Inc Tax: '.$total_incGST_str; ?>

I slotted this piece of code in after the nugget body table code (line 42 on my page), just to try it. You will have to modify the code in the table to get the result you want. Let me know how you go.

Regards,

Chris

Reply | Quote | Top
fernando.delgado @aon.at
06-09-2007 20:55:39 GMT +2

Hi Chris !,


Sorry for not replying before, I just came now. This works Amazing !!!.. just perfect solution, I tank you so much ! see: http://justballs.at :-)

Now the I need to do the same with Cart Nugget (to the total add 20%). I tried the same procedure but I'm getting CERO as result: I tried this:

 <?php # This is the string to number conversion: ?>
 <?php $total_incGST_num = 1.2*(float) ((str_replace(',','',substr($row_KartFV_RS['MXK_TotalPrice']
))));

   $currency = krt_getCurrentCurrency();
   $cur = substr($row_KartFV_RS['MXK_TotalPrice']);
   $total_incGST_str = $cur . number_format($total_incGST_num, $KT_currencies[$currency]['decimals'], $KT_currencies[$currency]['decsep'], $KT_currencies[$currency]['thsep']);?></p>


I just replaced:

krt_getFpDiscount(
$row_rsOffer['price_prd'],$row_rsOffer['id_prd']),0,1
for RED code above, what is wrong Chris ?... Please !

Best regards and thanks a million !

Reply | Quote | Top
Chris Pollock
06-10-2007 09:45:58 GMT +2

 

Hi Fernando,

Glad the code helped you. The Cart nugget is a bit more complicated, and depends on whether or not you list individual items with their prices plus a total price, or just the total price. Can you let me know?

Regards,

Chris

Reply | Quote | Top
fernando.delgado @aon.at
06-11-2007 08:22:55 GMT +2

Hi Chris,

It's just the Total price, just add 20% only to the total price !

Just: somthing like  $row_KartFV_RS['MXK_TotalPrice'] * 1.20

Thanks so much!!!

fernando.

Reply | Quote | Top
fernando.delgado @aon.at
06-12-2007 20:42:41 GMT +2

Any Idea Chris ??


Thanks !

Reply | Quote | Top
Chris Pollock
06-13-2007 06:11:15 GMT +2

Hi Fernando,

You didn't quite get it modified correctly. This code works on my cart nugget:


 <?php $total_incGST_num = 1.2*(float) ((str_replace(',','',substr($row_KartFV_RS['MXK_TotalPrice'],1))));
 echo $total_incGST_num;
   $currency = krt_getCurrentCurrency();
   $cur = substr(($row_KartFV_RS['MXK_TotalPrice']),0,1);
   $total_incGST_str = $cur . number_format($total_incGST_num, $KT_currencies[$currency]['decimals'], $KT_currencies[$currency]['decsep'], $KT_currencies[$currency]['thsep']);?></p>

You left the string initialisation digit (string start position) off the end of the first line. Should work now.

Regards,

Chris

Reply | Quote | Top
fernando.delgado @aon.at
06-13-2007 10:04:05 GMT +2

Hi Chris,

I really have no words to thank you. This is working amazing !

Thanks so much for this big help, now the project is finished.

I i can help you with something let me know.

fernando.delgado@aon.at

Reply | Quote | Top
© Adobe Systems Romania. All rights reserved.