mr_c Posted September 22, 2009 Share Posted September 22, 2009 hey guys, i'm new to the forum and php! I need to edit some php in a shopping cart software that uses php and i'm trying to subtract two variables with each other like this but with no results: What i need to work: 1- {convertPrice price=$product->getPriceWithoutReduct()-$product->getPrice()} 2- {convertPrice price=$product->getPriceWithoutReduct()}{convertPrice price=$product->getPrice()} what is so confusing to me is that line number 2 shows the values of both variables in the browser, for example: £10 £9. All i want is for those two vars to subtract each other so i would get £1 in that example. and if i try this: {convertPrice price=$product->getPriceWithoutReduct()-2} or {convertPrice price=$product->getPrice()-2} the browser shows the value - 2! so it only breaks when i try to subtract each other is there any way i can subtract those two variables? thanks in advance guys Link to comment https://forums.phpfreaks.com/topic/175103-subtraction-in-php-need-a-bit-of-help-it-should-be-simple/ Share on other sites More sharing options...
trq Posted September 22, 2009 Share Posted September 22, 2009 Sorry, but none of the code is pure php. Might be some templating engine? Link to comment https://forums.phpfreaks.com/topic/175103-subtraction-in-php-need-a-bit-of-help-it-should-be-simple/#findComment-922894 Share on other sites More sharing options...
mr_c Posted September 22, 2009 Author Share Posted September 22, 2009 Yeah, it's a smarty based system that uses php. So does my code not give any indication as to any possible solutions? I'm pulling my hair out over it, such a "straight-forward" thing that is using up a lot of time! Link to comment https://forums.phpfreaks.com/topic/175103-subtraction-in-php-need-a-bit-of-help-it-should-be-simple/#findComment-922898 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.