Can someone help me further with this as I am completely stumped.
I have changed the script so that it will pull prices from my database based upon products_id, options_id and options_value_id. Rather than a hard coded options_id etc. However I am confused on how to get the script to identify what the product_id etc is.
The answer would be placed into a css table so that when I update my prices in the database it will automatically update them on the product listing page. Can an if statement include an html input name and value? If so, this may work for me. Although then I would be hardcoding product_id, options_id and options_value_id again. awwww
I have included the code for both. Any suggestions/advice is greatly appreciated.
<?php
include("includes/configure.php"); // To grab the DB info
$db = mysql_connect ("localhost", DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die ('<BR> - Could not connect to the database because: '.mysql_error());
mysql_select_db (DB_DATABASE, $db) or die(mysql_error( ));
$productPrices = $query;
$query = "select pa.options_values_price
from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
where pa.products_id = '" . (int)$_GET['products_id'] . "'
and pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
and pa.options_values_id = pov.products_options_values_id";
$result = mysql_query($query); if (!$result) { $message = "Error! Invalid Query: ".mysql_error()."\n Original Query: ".$query; die($message); }
while($row = mysql_fetch_array($result)){
$productPrices = $row[0];
}
mysql_close();
?>
<div class="priceslistfull"><p class="quantity">Quantity</p><p class="productprice1">A4 Posters</p>
<p class="productprice2">A3 Posters</p><p class="productprice3">A2 Posters</p><p class="productprice4">A1 Posters</p>
<p class="productprice5">A0 Posters</p>
<div class="priceunderdiv"><p class="quantityunder">250</p><p class="productprice1under">£<?php echo number_format ($productPrices, 2);?></p>
<p class="productprice2under">£<?php echo number_format ($productPrices, 2);?></p><p class="productprice3under">£<?php echo number_format ($productPrices, 2);?></p>
<p class="productprice4under">-</p>
<p class="productprice5under">-</p></div>
<div class="productpurchase"><img src="images/purchase_now1.gif" alt="Spacer Image" width="100" /></div>
<div class="productpurchase"><form action="index.php?main_page=product_info&cPath=3_143_38&products_id=526/&action=add_product" method="post" enctype="multipart/form-data" name="cart_quantity" >
<input type="hidden" name="cart_quantity" value="1" maxlength="6" size="4" />
<input type="hidden" name="products_id" value="526" />
<input name="image" type="image" title="Add to Cart" src="images/purchase_now.gif" alt="Add to Cart" />
<input type="hidden" value="3" name="id[3]" />
</form></div>
<div class="productpurchase"><form action="index.php?main_page=product_info&cPath=3_143_42&products_id=536/&action=add_product" method="post" enctype="multipart/form-data" name="cart_quantity" >
<input type="hidden" name="cart_quantity" value="1" maxlength="6" size="4" />
<input type="hidden" name="products_id" value="536" />
<input name="image" type="image" title="Add to Cart" src="images/purchase_now.gif" alt="Add to Cart" />
<input type="hidden" value="3" name="id[3]" />
</form></div>
<div class="productpurchase"><form action="index.php?main_page=product_info&cPath=3_143_41&products_id=532/&action=add_product" method="post" enctype="multipart/form-data" name="cart_quantity" >
<input type="hidden" name="cart_quantity" value="1" maxlength="6" size="4" />
<input type="hidden" name="products_id" value="532" />
<input name="image" type="image" title="Add to Cart" src="images/purchase_now.gif" alt="Add to Cart" />
<input type="hidden" value="3" name="id[3]" />
</form></div>