Hello,
I am looking for a little help on how to combine three parts of code.
Here's part one:
So if the price from the db is 20, the above line will create: (20 + 5) * 1,85. Which makes the final price 46.25. Also, everything is rounded up by 5.PHP Code:$base_m=5;
{$item['price'] = round ((($item['price']+5) *1.85),0); $item['pricefinal'] = $base_m*(ceil(($item['price'])/$base_m));}
Here's part two:
Meaning prices must be bigger than 11 before being showed and the smaller or bigger than 100 and 1000 parts are just to align the euro sign and the prices all nicely underneath each other.PHP Code:if (($item['price'] > "11") && ($item['pricefinal'] < "100")) { ?> € <?php echo $item['pricefinal']; ?>,- <?php }
elseif (($item['price'] > "11") && ($item['pricefinal'] < "1000")) { ?> € <?php echo $item['pricefinal']; ?>,- <?php }
elseif (($item['price'] > "11") && ($item['pricefinal'] >= "1000")) { ?> € <?php echo $item['pricefinal']; ?>,- <?php }
Now, the two above parts of code are working well together already. I´m just showing these to point out the many things that need to be done with the prices, making it not easy (at least for me) to add the following code...
Here´s part three:
Basically, I have three different prices and only the lowest one must be displayed (with the added math function and be aligned, also must be higher than 11).PHP Code:print min(100, 70, 101, 50);
// returns --> 50
OR
$array = array(100, 701, 2, 4, 202);
print min($array);
// returns --> 2
So let's say the prices are 10, 20 and 25.
I'd like the script to use the price of 20. Meaning the value shown will be 50 (after being rounded up).
I hope you understand all that I've said here, if not, lemme know and I'll explain more. I have no idea how to add in the 'find lowest' part into the script as it is.... I know the code might look messy, I'm sorry for that, but I don't know another way to do this...
Thank you in advance!!



Reply With Quote
Bookmarks