X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Display All Subcat Products in Parent Cat (https://forum.x-cart.com/showthread.php?t=26196)

tedski 10-28-2006 06:05 PM

Display All Subcat Products in Parent Cat
 
I am trying to display all products under a subcategory when a user opens its parent category. Let me illustrate: If we have CategoryA with SubcategoryA1 and SubcategoryA2 and they have SubcategoryA1i and SubcategoryA1ii. In addition we have CategoryB with SubcategoryB1 and SubcategoryB2 and they have SubcategoryB1i and SubcategoryB1ii.

I would like when a user clicks on CategoryA, it shows all products in all categories beneath it (SubcategoryA1, SubcategoryA2, SubcategoryA1i, and SubcategoryAii), but not any under CategoryB. I hope this makes sense.

I realize the easy way out would be to add all categories to their parent category as an additional category. Is there any loop I could create that would automatically display all products in subcategories beneath the current level?

showoff 11-02-2006 06:24 AM

Re: Display All Subcat Products in Parent Cat
 
I╢m trying to do the same thing but i╢m running into a lot of problems. I thought I got it to work but it was listing all items in my store...
Any help please?

fogelka 11-09-2006 06:00 PM

Re: Display All Subcat Products in Parent Cat
 
I, too, am looking for a solution to this. Anyone have any ideas?

Thanks.

tedski 11-09-2006 06:04 PM

Re: Display All Subcat Products in Parent Cat
 
I did a Search and Modify and just added all categories to their root category. It adds an extra step to product adding, but it works.

fogelka 11-09-2006 06:33 PM

Re: Display All Subcat Products in Parent Cat
 
Thanks for the tip. I'll have to try that out.

1CNS 07-18-2007 09:04 PM

Re: Display All Subcat Products in Parent Cat
 
I'm another person who's been looking for this solution. I'm not sure I understand the solution posted. The idea is, when a root category (a) is clicked, and that category has subcategories (a1) and (a2), the site generates a page like:

Category A Heading

Subcategory A1 Heading
A1 Item 1
A1 Item 2
A1 Item 3

Subcategory A2 Heading
A2 Item 1
A2 Item 2
A2 Item 3

Basically instead of a page of subcategory links for root category (a), those subcategories and their products are all displayed under headings on one page.

Any tips would be greatly appreciated.

liquid 08-06-2007 05:11 AM

Re: Display All Subcat Products in Parent Cat
 
I'm also looking for this solution. Has anyone had any luck?

shorelineoftahoe 12-05-2008 11:17 AM

Re: Display All Subcat Products in Parent Cat
 
Actually, it's really easy.

in products.php modify this line:
$search_data["products"]["search_in_subcategories"] = "";

to

$search_data["products"]["search_in_subcategories"] = "Y";

If you want to show all products in all subcategories on the home page you need to modify these lines in home.php:

if (!empty($cat))
include "./products.php";

to

#if (!empty($cat))
include "./products.php";

That's all. I haven't tested this too much so I don't know about unforeseen consequences. I'll refer back if there is a problem.

albertchui 01-10-2009 11:38 AM

Re: Display All Subcat Products in Parent Cat
 
wow, that is what i want, but how can i just show the products only in product page without the subcategory.

In order to show the subcategory, i wish the subcategory will show in the left hand column when click the root category, like www.art.com, many thanks

shorelineoftahoe 01-30-2009 08:09 AM

Re: Display All Subcat Products in Parent Cat
 
That's a configuration setting you can change in the backend of xcart here:
http://www.YOURSITE.com/admin/configuration.php?option=General

Uncheck the box that says:
If ticked, the categories list always shows root categories

ChristineP 02-21-2009 10:24 AM

Re: Display All Subcat Products in Parent Cat
 
I tried the first portion you have for our cart. I want to have the root category in my flyout menu showing, and to eliminate the page that goes with that root category that has the list of sub category names and number of products in each category. This may be an issue for our flyout mod as we don't want the root category to return a page, but only the sub-category and sub-sub category as clickable that returns a page.

Do you have any suggestions?



Quote:

Originally Posted by shorelineoftahoe
Actually, it's really easy.

in products.php modify this line:
$search_data["products"]["search_in_subcategories"] = "";

to

$search_data["products"]["search_in_subcategories"] = "Y";

If you want to show all products in all subcategories on the home page you need to modify these lines in home.php:

if (!empty($cat))
include "./products.php";

to

#if (!empty($cat))
include "./products.php";

That's all. I haven't tested this too much so I don't know about unforeseen consequences. I'll refer back if there is a problem.


rshandel 04-11-2009 09:30 AM

Re: Display All Subcat Products in Parent Cat
 
I tried shorelineaftahoe's suggestion but I can't to seem to get it to work. My page just shows the subcats listed, but not the subcat products listed underneath them.

Any suggestions?

AusNetIT 04-26-2009 05:50 AM

Re: Display All Subcat Products in Parent Cat
 
HI,

I try to put product into home but no luck?

home.php

#
# $Id: home.php,v 1.10.2.3 2008/04/11 18:09:11 osipov Exp $
#
define('OFFERS_DONT_SHOW_NEW',1);
require "./auth.php";
require $xcart_dir."/include/categories.php";
if ($active_modules["Manufacturers"])
include $xcart_dir."/modules/Manufacturers/customer_manufacturers.php";
#if (!empty($cat))
include "./products.php";

if (empty($products))
include "./featured_products.php";
if ($active_modules["Bestsellers"])
include $xcart_dir."/modules/Bestsellers/bestsellers.php";

if (!empty($current_category) and is_array($current_category["category_location"])) {
foreach ($current_category["category_location"] as $k => $v)
$location[] = $v;
}
if (!empty($active_modules["Special_Offers"])) {
include $xcart_dir."/modules/Special_Offers/category_offers.php";
}
# Deleting the previously saved user information received from PayPal (Is performed when the user exits the checkout process)
if (x_session_is_registered("paypal_token") || x_session_is_registered("paypal_express_details")) {
x_session_unregister('paypal_token');
x_session_unregister("paypal_express_details");
}
#
# Assign Smarty variables and show template
#
$smarty->assign("main","catalog");
# Assign the current location line
$smarty->assign("location", $location);
func_display("customer/home.tpl",$smarty);
?>


All times are GMT -8. The time now is 02:36 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.