Iб╢m trying to add a dropdown list to the products table. What Iб╢ve done is pretty the same you did with the FAQ page.
Code:
ALTER TABLE `xcart_products` ADD `prod_type` INT( 11 ) NOT NULL ;
include/product_modify.php
Code:
$prod_type = func_query("SELECT $sql_tbl[products].prod_type FROM $sql_tbl[products]");
$smarty->assign("prod_type", $prod_type);
Updated the database query
Code:
db_query("UPDATE $sql_tbl[products] SET product='$product', descr='$descr', fulldescr='$fulldescr', avail='$avail', list_price='$list_price', weight='$weight', productcode='$productcode', forsale='$forsale', distribution='$distribution', free_shipping='$free_shipping', shipping_freight='$shipping_freight', discount_avail='$discount_avail', min_amount='$min_amount', return_time = '$return_time', prod_type='$prod_type', low_avail_limit='$low_avail_limit', free_tax='$free_tax' WHERE productid='$productid'");
But then I edited skin1/main/product_details.tpl
Code:
<TR>
{if $productids ne ''}<TD width="15" class="TableSubHead"><INPUT type="checkbox" value="Y" name="fields[prod_type]"></TD>{/if}
<TD class="FormButton" nowrap>{$lng.lbl_type}:</TD>
<TD class="ProductDetails">
<SELECT name="type">
<OPTION value="U" {if $product.prod_type eq "U"}selected{/if}>{$lng.lbl_used}</OPTION>
<OPTION value="N" {if $product.prod_type eq "N"}selected{/if}>{$lng.lbl_new}</OPTION>
<OPTION value="R" {if $product.prod_type eq "R"}selected{/if}>{$lng.lbl_reman}</OPTION>
</SELECT>
</TD>
</TR>
After that I included the new field in the product skin1/customer/main/product.tpl
Code:
{$lng.lbl_type}: {$products[product].prod_type}
It all looks fine. But it seems that there is something wrong with the database query. I get the option fields while adding a product but it shows only a "O" on the customer front-end product page.
Any help would be highly appreciated.