Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

List diffrent product_lists depends on which category you choose


Zero-G

Recommended Posts

I need som help with the index page where the include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING): is choosen.

 

say that my category Software have number 1 in categies_pl then i need it to load product_listing1 and if i choose another categry that have categies_pl number 2 i need it to load product_listing2. I have added product_listing2 to filename.php and i think i shall manage to do the changes i need to do in the product_listing.php.

I dont know if its easy to make it to do the changes in the admin part to each product_listing file like you do it now to each of the product_list files.

 

I dont know if this is the right way to do this, if not i hope you can tell me how i can do this a better and maybe an easier way :)

 

I need a IF statment that is looking in the category table in the datebase for a number.

 

If "categories_pl" is 1 i need it to include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING1):

or

if "categories_pl" is 2 i need it to include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING2):

and going on.

 

 

 

Hope someone can help me with this. My php knowlege isnt the best but i have tried to make this a long time now without any luck :(

Link to comment
Share on other sites

you're on your right way. have you added a new column to your categories called pl and marked it with the number you need for identifying the file? make that column have a default of 1 for any mew cats entered.

 

then in your file, select the category row from the database for the cat you are currently in.

 

get the variable for pl

 

write an if else (or later when you have 6 lists use case)

if ($pl == '1') {
include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING1);
} elseif ($pl == '2') {

include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING2);
}

:-)

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 ...

Link to comment
Share on other sites

Tnx for the answer.

Do you know what query i need to use to get the information from the column? i have tried many different things but i dont know how it should be :(

 

i only got an empty page with the things i tried, but with one query i tried i got the product_listing to show but only the standard one even i choosed categories that i changed the "pl" number.

 

$pl = mysql_query("select c.pl from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

Link to comment
Share on other sites

Tnx for the answer.

Do you know what query i need to use to get the information from the column? i have tried many different things but i dont know how it should be :(

 

i only got an empty page with the things i tried, but with one query i tried i got the product_listing to show but only the standard one even i choosed categories that i changed the "pl" number.

 

$pl = mysql_query("select c.pl from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

 

can you post the full code of that area using the query shown in this post?

:-)

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 ...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...