Salvo Posted December 6, 2002 Posted December 6, 2002 Hi all, I am working on some sort of random image and I am stuck, any help is apprecieted.. if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status='1' limit " . MAX_RANDOM_SELECT_NEW)) { This is part of show a random image and name product (any product of all products) I like to select from TABLE_PRODUCT where as above + where the cateregory is = ie AAA Tried to explained it better. I like to select only products from one secified category... HOW? Thanks for help Salvo
Salvo Posted December 7, 2002 Author Posted December 7, 2002 Hi all, after a long working night, I managed to do what I wanted with the above code... these are my eyes :shock: this is what I needed: if ($random_product = tep_random_select("select p.products_id, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " pd " . " where p.products_status = '1' and p.products_id = pd.products_id and pd.categories_id = '17' limit " . MAX_RANDOM_SELECT_NEW)) { Pratically chooses a random image from a specified category. What I needed this for? I have put the code in a cell on the header ie 60x50 and in the cell will show a random image/photo from the specified category every time refresh is used. so the surfer sees a different small image in the header ie next the logo... This image has a link to the product full description. I Need help here or I will spend another sleepless night in London :-) HOW to have this piece of code turned ON/OFF from admin part and be able to specify the category image to use in admin... I thank you Salvo PS: than it will be my real first small contribution
burt Posted December 7, 2002 Posted December 7, 2002 HOW to have this piece of code turned ON/OFF from admin part and be able to specify the category image to use in admin... <? if (SHOW_PRODUCT_HEADER == "1") { if ($random_product = tep_random_select("select p.products_id, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " pd " . " where p.products_status = '1' and p.products_id = pd.products_id and pd.categories_id = " . SHOW_PRODUCT_CATEGORY . " limit " . MAX_RANDOM_SELECT_NEW)) { whatever } } ?> In Admin somewhere, best would likely be Application_top.php: <? define('SHOW_PRODUCT_HEADER', '1'); // 1 == on, anything else == off define('SHOW_PRODUCT_CATEGORY', 'xx'); // replace xx with the categorie number you want to show ?> HTH
Salvo Posted December 7, 2002 Author Posted December 7, 2002 Thanks Burt, That works perfect but it is a temporaly solution at moment... not very easy to change on the fly... I was looking in admin/configuration/images.. and I thought: How about adding at the bottom after "image requred" ie header random "true or false" // true will show , false will not show header random category "xx" // enter the category id can it be done and how it can be done? what should I do? or would I mess everything up.. Thanks Salvo
Recommended Posts
Archived
This topic is now archived and is closed to further replies.