Guest Posted September 26, 2010 Share Posted September 26, 2010 Hi, Is there a way I could show the quantity of a product sold next to the product description in the store(customer side, not admin side)? I'm sure it would mean calling the info from the database somehow, but not knowing how to write php I'm not sure what to do or where to start. I might be able to figure something out if I could re-use code from the admin side I guess (not confident about it though...). I couldn't find any information on this in the forums, or find an add-on. Would anyone have any suggestions? Thanks:) Link to comment Share on other sites More sharing options...
jhande Posted September 26, 2010 Share Posted September 26, 2010 You might be able to adapt this contribution - Available QTY in Product Listing. Change this bit of code in the contribution: <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading" valign="top"><?php echo $products_name; ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="smallText"> QTY Available: <? if ($product_info['products_quantity']=='0') echo '<span class="errorText">Currently Unavailable</span>'; else echo $product_info['products_quantity']; ?> </td> </tr> </table> </td> <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td> </tr> </table></td> To something like this: <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading" valign="top"><?php echo $products_name; ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="smallText"> QTY Ordered: <? if ($product_info['products_ordered']=='0') echo '<span class="errorText">Non Ordered</span>'; else echo $product_info['products_ordered']; ?> </td> </tr> </table> </td> <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td> </tr> </table></td> Also in product_info.php find this code: <?php } else { $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); And add this to it - p.products_ordered so it looks like this: <?php } else { $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_ordered, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); I'm no PHP expert but that should point you in the right direction. - :: Jim :: - - My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 - Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.