Guest Posted December 15, 2007 Posted December 15, 2007 i need the variable for product price thats a real number and not a string. basically a variable that i can do basic math with.
satish Posted December 15, 2007 Posted December 15, 2007 Do type cast. Satish Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does.
Guest Posted December 15, 2007 Posted December 15, 2007 i tried.. it will error.. i dont think you can typecast a string to an int or something.. i was wondering if there is already a variable thats a real number.. because you have to use something to calculate the sales tax right? I dont really write a function converting a string to a real number plz. ;)
maxxxie Posted December 15, 2007 Posted December 15, 2007 Why not just grab it straight from the DB? Something like SELECT products_price from products where products_id = xxx (using the osC functions to do this, of course)? The value stored in the db is of type int so you should be able to perform maths on it. PS Upon re-read, I see you want to do this specifically within product_info.php. This is basically already done for you as the price and sales tax information is queried by default. Interrogate $product_info['products_price'] for the ex-tax price. Use tep_get_tax_rate($product_info['products_tax_class_id']) to get the tax rate. To display the price (ie through an echo statement or similar), use $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])). Cheers, Max
Guest Posted December 15, 2007 Posted December 15, 2007 wow thx for the reply max.. but i need to add 10 bucks to the price.. so basically something like this: $newPrice = $product_info['products_price'] + 10.00; echo $newPrice; but i believe the $product_info['products_price'] returns a string right? i will try it and post back.
Guest Posted December 15, 2007 Posted December 15, 2007 wheres the edit button? lol.. anyways thx it worked.. $msrp = $currencies->display_price($product_info['products_price'] + 10, tep_get_tax_rate($product_info['products_tax_class_id'])); echo 'Regular: ' . $msrp . '<br>Our Price: ' . $products_price; ?><p> hehe.. i wish there was a list of useful variables or something :)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.