Cant find the dollar sign to change it to pounds!
Posted: Mon Oct 30, 2006 10:28 am
Hey guys, I've worked my way through this shopping cart tutorial, which i recommend for beginners:
http://www.phpwebcommerce.com/shopping- ... e-code.php
I have it all working fine and dandy now, which is a small miracle in itself. My only problem is that the currency is displayed in dollars, and not pounds. Trying to change this is proving somewhat difficult, mainly because there are so many $ signs around in php
Well ive tracked the offending variable(?) down in the form of $pd_price. That comes up everytime the price is display anywhere. So Im trying to figure out where this variable(?) is defined. If someone could look at this code and tell me if its in there, id really appreciate it. My main problem is the fact that I dont know the syntax to make php realise the $ sign is only to be displayed, and not a php command, so im struggling to find it.
Thanks in advance.
http://www.phpwebcommerce.com/shopping- ... e-code.php
I have it all working fine and dandy now, which is a small miracle in itself. My only problem is that the currency is displayed in dollars, and not pounds. Trying to change this is proving somewhat difficult, mainly because there are so many $ signs around in php
Well ive tracked the offending variable(?) down in the form of $pd_price. That comes up everytime the price is display anywhere. So Im trying to figure out where this variable(?) is defined. If someone could look at this code and tell me if its in there, id really appreciate it. My main problem is the fact that I dont know the syntax to make php realise the $ sign is only to be displayed, and not a php command, so im struggling to find it.
Thanks in advance.
Code: Select all
<?php
if (!defined('WEB_ROOT')) {
exit;
}
$productsPerRow = 2;
$productsPerPage = 4;
//$productList = getProductList($catId);
$children = array_merge(array($catId), getChildCategories(NULL, $catId));
$children = ' (' . implode(', ', $children) . ')';
$sql = "SELECT pd_id, pd_name, pd_price, pd_thumbnail, pd_qty, c.cat_id
FROM tbl_product pd, tbl_category c
WHERE pd.cat_id = c.cat_id AND pd.cat_id IN $children
ORDER BY pd_name";
$result = dbQuery(getPagingQuery($sql, $productsPerPage));
$pagingLink = getPagingLink($sql, $productsPerPage, "c=$catId");
$numProduct = dbNumRows($result);
// the product images are arranged in a table. to make sure
// each image gets equal space set the cell width here
$columnWidth = (int)(100 / $productsPerRow);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="20">
<?php
if ($numProduct > 0 ) {
$i = 0;
while ($row = dbFetchAssoc($result)) {
extract($row);
if ($pd_thumbnail) {
$pd_thumbnail = WEB_ROOT . 'images/product/' . $pd_thumbnail;
} else {
$pd_thumbnail = WEB_ROOT . 'images/no-image-small.png';
}
if ($i % $productsPerRow == 0) {
echo '<tr>';
}
// format how we display the price
$pd_price = displayAmount($pd_price);
echo "<td width=\"$columnWidth%\" align=\"center\"><a href=\"" . $_SERVER['PHP_SELF'] . "?c=$catId&p=$pd_id" . "\"><img src=\"$pd_thumbnail\" border=\"0\"><br>$pd_name</a><br>Price : $pd_price";
// if the product is no longer in stock, tell the customer
if ($pd_qty <= 0) {
echo "<br>Out Of Stock";
}
echo "</td>\r\n";
if ($i % $productsPerRow == $productsPerRow - 1) {
echo '</tr>';
}
$i += 1;
}
if ($i % $productsPerRow > 0) {
echo '<td colspan="' . ($productsPerRow - ($i % $productsPerRow)) . '"> </td>';
}
} else {
?>
<tr><td width="100%" align="center" valign="center">No products in this category</td></tr>
<?php
}
?>
</table>
<p align="center"><?php echo $pagingLink; ?></p>