Guest Posted December 13, 2005 Posted December 13, 2005 Hello, I am attempting to set up oscommerce for a company that sells over 30,000 products. They made it very clear they want two lists of manufacturers, to reflect two different types of product. I started on this over a month ago but right away got put on something else and now it's just come back to haunt me. I may have done this differently if I was to start over but I'm not sure if I should start over. The approach I have started is to basically duplicate all the manufacturers code and tables. I now have the original "manufacturers" table, and the "b_manufacturers" table. The products now have EITHER a manufacturers_id or a b_manufacturers_id. I got Easy Populate working, adding a column to the products table to reference the new manufacturers table. I thought this was simple enough even if not the very most elegant. I'm having trouble now when it comes to displaying the manufacturer. There are several queries in index.php of the catalog that are pretty hairy. Here's an example (unmodified source): //show the products of a specified manufacturer if (isset($HTTP_GET_VARS['manufacturers_id'])) { if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) { // We are asked to show only a specific category $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'"; .......etc...... I think the SQL is getting a little over my head because if I were coding this myself I would probably have used more PHP and less (or at least simpler) SQL. I need to modify this and the surrounding queries so that if p.manufacturers_id is set it does just what it does now, but if instead p.b_manufacturers_id is set, it refers to the b_manufacturers table. Having trouble getting my head around this what with all the joins and things going every which way. Anybody with a little more SQL and a lot more osCommerce can advise me? Should I get the SQL figured out or should I backtrack and try a different approach? Thanks, Chris
Recommended Posts
Archived
This topic is now archived and is closed to further replies.