Hi all,
Im using the products with atributes stock. Ive added a bit of code in the display product page, that lists the diffrent versions of atributes and what stock they have, so people may see whats in stock.
My problem however is when i use multiple atributes on a product (eg both color and size) the number of all atribues id is stored in the database, only seperated by comma. Dont know how to break this down, so I hope for some help here. I usually make an search just for the number eg '333', but with multiple atribues the code changes to eg. '333,444,555'
Heres my code:
<?php
$products_id= $_GET['products_id'];
$sql_result = mysql_query("SELECT * FROM zen_products_with_attributes_stock where products_id=$products_id");
$num_links = mysql_num_rows($sql_result);
if($num_links>0)
{
print("<table border=0 width=300><tr><td colspan=2><b><center>Lagerbeholdning:</center></b></td></tr>");
}
for($i=0;$i<$num_links;$i++)
{
$myrow = mysql_fetch_array($sql_result);
$stock_attributes = $myrow["stock_attributes"];
$quantity = $myrow["quantity"];
if($quantity < 1)
{
$quantity = "<font color=red>X</font> <small>Bestillingsvare (5-15 dager)</small>";
}
$sql = mysql_query("SELECT * FROM zen_products_attributes where products_attributes_id=$stock_attributes");
$myrow2 = mysql_fetch_array($sql);
$ovid = $myrow2["options_values_id"];
$sql = mysql_query("SELECT * FROM zen_products_options_values where products_options_values_id=$ovid AND language_id=2");
$myrow2 = mysql_fetch_array($sql);
$attribute_name = $myrow2["products_options_values_name"];
$tekst = "<tr><td> $attribute_name </td><td> $quantity </td></tr>";
print($tekst);
}
if($num_links>0)
{
print("</table>");
}
?>
Hope somebody can help me alter this code to make it concider the possibility of multiple atributes.



