Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2019
    Location
    United States
    Posts
    18
    Plugin Contributions
    0

    Default Trouble with Displaying Category with Define Main Page

    So I want to display a category on the main page along with the defined main page.
    I have no problem with it when displaying the Top category, but when displaying a subcategory, the define main page elements aren't shown.
    Is there a workaround for this?

    My Current Configurations:

    Configuration > Layout Settings
    Categories - Always Show on Main Page: 1
    Main Page - Opens With Category: 9
    Categories - Always Open to Show Subcategories: 1

  2. #2
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,587
    Plugin Contributions
    19

    Default Re: Trouble with Displaying Category with Define Main Page

    If I read that right you want define_page content on the product listings. The stock wording is a bit misleading. The main page is only one page - the index - home - landing page. There's no code present to call the $define_page on other pages as you navigate the various categories.

    This tpl_index_default.php code would need to be added to the tpl_index_product_list.php...

    <?php if (DEFINE_MAIN_PAGE_STATUS >= 1 and DEFINE_MAIN_PAGE_STATUS <= 2) { ?>
    <?php
    /**
    * get the Define Main Page Text
    */
    ?>
    <div id="indexDefaultMainContent" class="content"><?php require($define_page); ?></div>
    <?php } ?>

    To control display of your preferred define_page you could change the switch DEFINE_MAIN_PAGE_STATUS to any other DEFINE_YOUR_PAGE_STATUS.

    This would allow the original Zen Cart switches to control ALL occurrences of a define page. If that's the case I've found it very handy to add alternate switch positions to the originals like this:

    Twitch - Categories - Always Show on Main Page
    Always Show Categories on Main Page
    0 = OFF Show Only Define Page
    1 = Show Define Page - Categories
    2 = Show Define Page - IndexBanner
    3 = Show IndexBanner - Define Page
    4 = Show IndexBanner - Define Page - Categories
    Default category can be set to Top Level or a Specific Top Level

    That assists with 'seeing' the matrix having various intertwined display elements and controls and 'knowing' what each one is for - and what it will do.

    In my example ^ I have dedicated a banner for use on the index page only, then allowed various display orientations with one master switch that includes the original position and function for upgrade compatibility.
    Last edited by twitchtoo; 25 Jun 2020 at 07:51 PM.
    Twitch.
    http://www.twitchtoo.com - Do you work for free? Please donate.
    Twitch Wholesale + Attributes, ZC 1.38 - 1.56c - Expert Site Migration & Upgrades!

  3. #3
    Join Date
    Sep 2019
    Location
    United States
    Posts
    18
    Plugin Contributions
    0

    Default Re: Trouble with Displaying Category with Define Main Page

    Hi Twitchtoo,

    Thank you for the help and advice! This worked perfectly and did exactly what I was asking for.
    I'll admit I'm not all too familiar with PHP, but this explination helped. I think I'll stick with manually changing the parameters as I need it.

  4. #4
    Join Date
    Sep 2019
    Location
    United States
    Posts
    18
    Plugin Contributions
    0

    Default Re: Trouble with Displaying Category with Define Main Page

    Actually coming back to this since there was a slight problem.

    While Twitchtoo's solution was helpful and actually worked, the code to display the define_main_page on tpl_index_product_list allowed for define_main_page to be displayed on all product listing pages. Category pages were not affected. So I decided to try to look for another possible solution and found this thread: https://www.zen-cart.com/showthread.php?138175-Banners-only-on-main-page

    Thank you Ajeh for the guidance and code. Below is the detail of my process for those looking to do the same.
    In order to get the results I wanted without the define_main_page showing up on my product listing pages, I had to move my define_main_page content into a banner and set that banner to show up at the position I wanted (in this case, top position 3)
    I copied the tpl_main_page file from the default template files into my shop's template files and fixed this code:

    Code:
    <?php
      if (SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) {
        if ($banner->RecordCount() > 0) {
    ?>
    <div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
        }
      }
    ?>
    Into this:

    Code:
    <?php
     if ($this_is_home_page && (SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3))) {
        if ($banner->RecordCount() > 0) {
    ?>
        <div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
        }
      }
    ?>
    This changes this specific banner position and makes it so that it's only visible on the home page of your website and no where else. I can imagine this being useful in other functions as well.

 

 

Similar Threads

  1. v151 Trouble with defining main page
    By farrahscreations in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 26 Jun 2017, 06:34 PM
  2. v151 Main page displaying text from define editor on every category page
    By Canvas101 in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 24 Jun 2014, 02:47 AM
  3. v139h define main page lower not displaying properly
    By swdynamic in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 23 May 2013, 05:29 PM
  4. Main Page Layout with Categories AND Define Pages
    By cmisales in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 27 Jan 2009, 09:14 AM
  5. Main Page Displaying in Categories with Children
    By bgroup99 in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 28 Aug 2008, 06:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR