Good day,
I was wondering if you could assist me in someway?
I have a "Product Price" and "Markup" That I want to work out a "Total Price" but it is giving me the incorrect results.
Example: "Total Price" = "Product Price" * "Markup
I have the following code.
<?php
$markup = 1 + (15 / 100);
$url = "http://nanobug.co.za/feed/stock-file/Stock-File-New.xml";
$xml = simplexml_load_file($url);
foreach ($xml->product as $item)
{
$product_code = $item->code;
$product_price = $item->price;
$product_price = str_replace("R", "", $product_price);
$product_price = str_replace(" ", "", $product_price);
$total_price = $product_price * $markup;
echo "Product Price: ".$product_price."<br>";
echo "Markup: ".$markup."<br>";
echo "Equation: Total Price = Product Price * Markup<br>";
echo "Total Price: ".$total_price."<br><br>";
}
?>
The link to see results: View Results
The link to view the xml file: View XML
Can you please help me as it is giving the incorrect total price.