Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Getting Main Page To Open With Category Plus Other Stuff

Getting Main Page To Open With Category Plus Other Stuff

Views: 1,198

Results 1 to 7 of 7
2 Apr 2011, 1:16 PM
#1
dmcco avatar

dmcco

New Zenner

Join Date:
Apr 2011
Posts:
13
Plugin Contributions:
0

Getting Main Page To Open With Category Plus Other Stuff

I'd like to list the products in a certain category (ID=2) on the main page, under text and/or images defined as usual in includes/languages/english/html_includes/custom/define_main_page.php. This would seem to be straightforward.

However, when in Layout Settings I set "Main Page - Opens with Category" to the category ID, the text/images disappear. They reappear if I set "Main Page - Opens with Category" to zero (or blank). So I can get one or the other, but not both. Is this normal?

Obviously I have "Categories - Always Show on Main Page" set to 1. Version is 1.3.9h.

2 Apr 2011, 2:55 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Getting Main Page To Open With Category Plus Other Stuff

There are 3 index templates for:

1 Normal index when no categories are displayed:
tpl_index_default.php

2 Index for when there are Categories displayed, such as you click on categories_id 3 and it has subcategories:
tpl_index_categories.php

3 Index for when you are on a Category with just Products for the Product Lising to display:
tpl_index_product_listing.php

The first two, show the Define page for the:
define_main_page.php

The last one does not ...

You could customize the third one to know when it is on the Home page with the variable:
$this_is_home_page

and add the Define page to it to display only when on the Home Page but not when on the Category navigation for the Product Listing ...

2 Apr 2011, 8:53 PM
#3
dmcco avatar

dmcco

New Zenner

Join Date:
Apr 2011
Posts:
13
Plugin Contributions:
0

Re: Getting Main Page To Open With Category Plus Other Stuff

Thank you for a very quick reply. I've now added the following code at the top of includes/templates/custom/templates/tpl_index_product_list.php (and it seems to work):

<?php if (DEFINE_MAIN_PAGE_STATUS >= 1 and DEFINE_MAIN_PAGE_STATUS <= 2 and $this_is_home_page) { ?> <?php ?> <div id="indexDefaultMainContent" class="content"><?php require($define_page); ?></div> <?php } ?>

I copied it from tpl_index_default.php and added your suggestion of "if $this_is_home_page".

I hope that I've understood you correctly and that I haven't upset anything else by making this modification!

2 Apr 2011, 10:34 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Getting Main Page To Open With Category Plus Other Stuff

Glad that this is now working for you ... thanks for posting the solution you used to display the define on the tpl_index_product_listing.php when that is being used as your Home page ... :smile:

5 Apr 2011, 11:20 PM
#5
dmcco avatar

dmcco

New Zenner

Join Date:
Apr 2011
Posts:
13
Plugin Contributions:
0

Re: Getting Main Page To Open With Category Plus Other Stuff

I should let you know that I've now decided to display featured products on the main page instead, and therefore the modification I made will not be getting a proper test.

It may even be causing a problem, because though the featured products are showing on the main page, the Featured Listing in the Admin does not now seem to control how they display.

7 Apr 2011, 3:11 PM
#6
dmcco avatar

dmcco

New Zenner

Join Date:
Apr 2011
Posts:
13
Plugin Contributions:
0

Re: Getting Main Page To Open With Category Plus Other Stuff

Well, it wasn't the problem. I've reversed the modification I made to tpl_index_product_listing.php, but the Featured Listing in the Admin is still failing to controlling the featured products display on the main page.

21 Jun 2011, 9:04 AM
#7
shockraver avatar

shockraver

New Zenner

Join Date:
Nov 2004
Posts:
47
Plugin Contributions:
0

Re: Getting Main Page To Open With Category Plus Other Stuff

this solution helpt me 2... thank you