Guest Posted July 2, 2007 Posted July 2, 2007 I am building a kitchen site and have layed out catagories and sub-catagories for the ranges of kitchen... all of the kitchens have the same product names e.g. "1000mm wall unit" these items need product attributes setting up but when I go to the dropdown box to choose which product I can not tell which one is which, all I can see is this 1000mm wall unit 1000mm wall unit 1000mm wall unit 1000mm wall unit ... what I could do with is a way of telling which catagory they are related too e.g. 1000mm wall unit - catag1's[name] 1000mm wall unit - catag2's[name] 1000mm wall unit - catag3's[name] 1000mm wall unit - catag4's[name] ... Please can anyone help me here
ComicWisdom Posted July 2, 2007 Posted July 2, 2007 I am building a kitchen site and have layed out catagories and sub-catagories for the ranges of kitchen... all of the kitchens have the same product names e.g. "1000mm wall unit" these items need product attributes setting up but when I go to the dropdown box to choose which product I can not tell which one is which, all I can see is this 1000mm wall unit 1000mm wall unit 1000mm wall unit 1000mm wall unit ... what I could do with is a way of telling which catagory they are related too e.g. 1000mm wall unit - catag1's[name] 1000mm wall unit - catag2's[name] 1000mm wall unit - catag3's[name] 1000mm wall unit - catag4's[name] ... Please can anyone help me here I've used attributes on a few sites, but I'm still not an expert. You really do need to differtiate between the product names. I don't know any other way to do it. Just between us, remember there are only 10 kinds of people in the world; those who understand binary and those who don't!! Remember, learning is a "do-it-yourself" experience; although, not necessarily a "do-it-BY-yourself" experience. The quickest way to learn is to forget to BACKUP!
ComicWisdom Posted July 2, 2007 Posted July 2, 2007 Here's the address of a page I'm working on now with drop down attributes. Notice everything is named different http://christophersgrinders.com/catalog/index.php?cPath=22 Just between us, remember there are only 10 kinds of people in the world; those who understand binary and those who don't!! Remember, learning is a "do-it-yourself" experience; although, not necessarily a "do-it-BY-yourself" experience. The quickest way to learn is to forget to BACKUP!
Guest Posted July 2, 2007 Posted July 2, 2007 the only way I can see around it is to rename all the product names to include the catagory name too and I don't want to do that as it would look very messy :( at the point the code creates the dropdown box contents could I not make a call somewhere to get the root catagory name and include it in the dropdown box some how... ?
Guest Posted July 2, 2007 Posted July 2, 2007 looking at the source i see this: <select name="products_id"> <option name="1000 Wall Unit" value="124">1000 Wall Unit</option> would I be able to query the db to get the root catagory name and the first subcatagory name (if it exists) of where product 124 resides ...so i can end up with this: <option name="1000 Wall Unit" value="124">1000 Wall Unit - CONTEMPORARY/ATHENS</option> the shop tree position for this is... /CONTEMPORARY/ATHENS/WALL UNITS/ many thanks for the replies too
Guest Posted July 2, 2007 Posted July 2, 2007 products_attributes.php continued... still trying to work out the above problem! I can work around it by using the manufacturers_id to tell them apart (i think) this is the line that gets the two values to build the products_id dropdown box <select name="products_id"> $products = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name"); so at the same time how can I get the manufacturers_id and put that as a new third item in the array, so while i'm looping i can do this... echo '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '">' . $products_values['products_name'] . ' - ' . $products_values['manufacturers_id'] . '</option>'; that way i'll get my 1000 wall unit - ATHENS 1000 wall unit - CALGARY ... I have had a go at the $products = tep_db_query sum but I came from perl and all this is new to me :( so, can any of you wonderful sql coders out there help me on this please.
Guest Posted July 3, 2007 Posted July 3, 2007 I used a bigger hammer and it still doesn't work :'( i have come this far but it's not right and it doesn't work... I just done understand php or mysql PLEASE HELP $products = tep_db_query("select p.products_id, pd.products_name, p.manufacturers_id, m.manufacturers_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), where pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name "); I did manage to get the p.manufacturers_id as that was already in a table being called, but now I need to use that to get the m.manufacturers_name to make it a 4th value in the array :blink:
Guest Posted July 5, 2007 Posted July 5, 2007 after many hours (over 3 days) I have cracked it, what with all the help and support from the massive community and all that it was done in a flash :blink: (rant over) IF anyone else should ever need to do the same... look for the "open" and "close" of this dropdown box <select name="products_id"> and replace it with the code below I know the function could be better placed but as it's only needed here once why not? <select name="products_id"> <?php $products = tep_db_query("select p.products_id, p.manufacturers_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name"); function get_manuf($in) { $manufacturers_query = tep_db_query('select manufacturers_name as manName, manufacturers_id as manId from ' . TABLE_MANUFACTURERS); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { define($manufacturers['manName'], $manufacturers['manID']); if($manufacturers['manId'] == $in){ return $manufacturers['manName']; } } } while ($products_values = tep_db_fetch_array($products)) { echo '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '">' . $products_values['products_name'] . ' - ('; $myman = get_manuf($products_values['manufacturers_id']); if($myman == ''){ echo('NO ID'); } else { echo($myman); } echo ")</option>\n"; } ?> </select> later all.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.