qpee Posted September 14, 2005 Share Posted September 14, 2005 Hi, i would like to generate a sql statement that selects all products from the logged in user which has the 'Type' (Product Option) of 'pdf' (Option Value). How could that look like? thanks a lot, i'm lost in tables and relations Link to comment Share on other sites More sharing options...
Guest Posted September 14, 2005 Share Posted September 14, 2005 create a new test page in your catalog directory (just copy an existing one like privacy.php is simple enough) Then at the beginning add a login check and afterwards perform the products query. Something like this: <?php /* $Id: privacy.php,v 1.22 2003/06/05 23:26:23 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRIVACY); if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name"); $products_array = array(); while($products_array[] = tep_db_fetch_array($products_query)); unset($products_array[count($products_array)-1]); // Filter attributes with a 2nd query here. ?> Now this is to retrieve the products you could add the second query below it for the attributes filter and check the option field for string 'pdf'. Then in the html <body> you setup a table and display the results. Store the attributes in an array like is shown for the products. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.