Forums / General Questions / List of products in category

List of products in category

Locked

Views: 1,711

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
7 Dec 2006, 3:02 AM
#1
nateveronica avatar

nateveronica

New Zenner

Join Date:
Oct 2006
Posts:
7
Plugin Contributions:
0

List of products in category

Hi, I'm wondering if there was a way (function maybe?) that would allow me to provide a list of products in a specific category to include on the product information page.

I guess it would be sort of like the category lists already available, but one which could be included potentially anywhere in the site.

Thanks.

8 Dec 2006, 1:01 AM
#2
nateveronica avatar

nateveronica

New Zenner

Join Date:
Oct 2006
Posts:
7
Plugin Contributions:
0

Re: List of products in category

bump.......

10 Dec 2006, 11:40 PM
#3
nateveronica avatar

nateveronica

New Zenner

Join Date:
Oct 2006
Posts:
7
Plugin Contributions:
0

Re: List of products in category

Ok, so I've come up with a solution, that if you place this code within the tpl_product_info_display.php page it will display a list of products within the product category that the product being displayed is a member of.

$category_id = zen_get_products_category_id($_GET['products_id']);

$cat_prod_array = zen_get_categories_products_list($category_id, '', '');

$num_in_array = count($cat_prod_array);

for ($t=0; $t<$num_in_array; $t++) {
$tmp_prodid = $cat_prod_array[$t];
$tmp_prodname = zen_get_products_name($tmp_prodid);
echo '<br />';
echo '<a href="index.php?main_page=product_info&cPath=' . $category_id . '&products_id=' . $tmp_prodid . '">' . $tmp_prodname . '</a>';
}

Hope you enjoy!:happy:

15 Dec 2006, 7:08 PM
#4
gems14k avatar

gems14k

New Zenner

Join Date:
Jul 2005
Posts:
95
Plugin Contributions:
0

Re: List of products in category

nateveronica:

$category_id = zen_get_products_category_id($_GET['products_id']);

I'm assuming $category_id would give me the (sub) category id of the product. What about the master category? What is the code to get the master category id?

Thanks,

16 Dec 2006, 1:25 AM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: List of products in category

Understand that the master_categories_id is used to determin what Category "owns" the Product when it comes to Pricing for things like SaleMaker ...

This is not always the "immediate" Category that you are in ...

This is not the Parent Category when the Product is in SubCategories ...

NOTE: If you never use Linked Products, then it doesn't matter if you use the master_categories_id or look up the Product categories_id in the products_to_categories table as it will always be the same ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Dec 2006, 5:12 AM
#6
vivaraquel avatar

vivaraquel

Zen Follower

Join Date:
Sep 2004
Location:
Australia
Posts:
305
Plugin Contributions:
0

Re: List of products in category

Is there a way to place a thin horizontal line between products in the product list? I've looked all over admin section and seen nothing. Or a way to make the background on the product list alternate between white and grey? I'd prefer the horizontal line but which ever is posible would be good, if any.

Thanks. I may try playing around with a php file. No idea which one though.

16 Dec 2006, 5:50 AM
#7
vivaraquel avatar

vivaraquel

Zen Follower

Join Date:
Sep 2004
Location:
Australia
Posts:
305
Plugin Contributions:
0

Re: List of products in category

NVM I've done it. The gloss_black template has it so I copied the itty bit of code from that stylesheet to mine and well, it worked!!

For anyone who may want to do this, just add this:

/Product Listing/
.productListing-data {
border-top: 1px solid #000000;
padding: 0.50em 0em 0.50em 0em;
}

In between these 2:

.smallText, #siteinfoLegal, #siteinfoCredits, #siteinfoStatus, #siteinfoIP {
font-size: 0.9em;
padding: .25em;
}

/Shopping Cart Display/
#cartAdd {
float: right;
text-align: center;
margin: 1em;
border: 1px solid #000000;
padding: 1em;
}

Have fun.
https://www.easybeading.com.au