Guest Posted November 28, 2011 Posted November 28, 2011 Hi, I have a question concerning my index page. As of now I load random products to my index page so that you get to see different stuff every time you come to the site. The thing is, that I have some products that I would like to exclude from showing up on the index page. Can I exclude a specific manufacturer? Or are there any filters in the store admin? I can't find anything. But if I look at the index.php here seems to be a few lines looking at filters. Like this: // optional Product List Filter if (PRODUCT_LIST_FILTER > 0) But where do I find the filter options in the admin part? Any help would be appreciated. Charles.
♥Monika in Germany Posted November 28, 2011 Posted November 28, 2011 when you "load" random products, I'm sure you do that via a query to your products table. in that query, you can certainly specify to exclude one (or several) manufacturers ... you just need to alter the "where clause". do you know how to create sql queries? :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
♥Monika in Germany Posted November 28, 2011 Posted November 28, 2011 another option would be to add (similar to actie/inactive) a second switch to all of your products in admin - which takes some coding in the database and categories.php in admin. you could then set those products (regardless of their manufacturer) that you do not wish to include in your store front to red. Obviously, in that case also, you'd need to edit the query that pulls the resultset. :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
Guest Posted November 28, 2011 Posted November 28, 2011 Dear Monika, Thank you for your reply. To be honest, when I set up the website I did alter some code in order to get random items to show up on the front page. I forgot which file I edited at the time. I was thinking of adding some code there to exclude a certain category. You don't happen to know where I should be looking for that, do you? is it in the index.php since it only affects the index page? Once again, thank you for your help. Charles
♥Monika in Germany Posted November 28, 2011 Posted November 28, 2011 charles, no I cannot tell you for sure where to look. but towards the bottom of your index.php file, in root, you may be having a module added ... maybe the new products module, that you altered (not really good) or cloned and renamed (yes, that would be good) and changed for your needs. in any case, that would be the file where the exclusions would need to be added, with or without the extra admin module I suggested. :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
Guest Posted November 28, 2011 Posted November 28, 2011 Okay, I remember what I did. In new_product.php I added the following lines. $category_query = tep_db_query("select distinct categories_id from ". TABLE_PRODUCTS_TO_CATEGORIES ); $cids = array(); while ($categories = tep_db_fetch_array($category_query)) { array_push($cids, $categories["categories_id"]); } $cid = $cids[rand(0, count($cids) - 1)]; "' order by p.products_date_added desc limit " replace it with: "' order by rand() limit " And then I replaced this: "' and p.products_status = '1' and p.products_id with: "' and p.products_status = '1' order by rand() limit Is it possible to add a line of code here to exclude category "xy" ? Again, super nice of you to help me out with this, thank you. Charles
♥Monika in Germany Posted November 28, 2011 Posted November 28, 2011 if you are using the array from the first query to later select the products, you can exclude certain (or a group of) category ids from the selection ... :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
Guest Posted November 28, 2011 Posted November 28, 2011 I am afraid to say this, but I have no idea how to do it... As I understand, all categories are selected here: $category_query = tep_db_query("select distinct categories_id from ". TABLE_PRODUCTS_TO_CATEGORIES ); can I just add manually something like -category("xy") Or could I say something like if categories_id="xy" then select next product? This might sound really naive, but I only have a very limited understanding of this code. :( Charles
Guest Posted November 28, 2011 Posted November 28, 2011 Dear Monika, Is there a chance I can pay you for writing this line of code? Would be great if you could help me out on this. Thanks in advance. Charles
Guest Posted November 28, 2011 Posted November 28, 2011 Dear Monika, Is there a chance I can pay you for writing this line of code? Would be great if you could help me out on this. Thanks in advance. Charles
♥Monika in Germany Posted November 28, 2011 Posted November 28, 2011 sure Charles ... for payed work, please contact me via my wesite, the link is in my profile. :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.