Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Feb 2008
    Posts
    129
    Plugin Contributions
    0

    Default Custom Text Below Featured Product on Home Page

    Hi,

    I'm trying to put custom text on my home page but I want it to be below the product sections (featured products, etc.)

    Here's what I did:

    I put my custom text in define_main_page.php

    This made the text show up on the home page above the Featured Products.

    So then I edited (mytemplate)/tpl_index_default.php

    I found this section that controls displaying the defined text (when I delete these lines, the defined text disappears):
    Code:
    <?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 } ?>
    Now it would be logical to assume that if I move that entire section to below the code which displays the featured products, I should get the result I want, right? wrong.

    For some reason when I move that block of code to below this block of code:
    Code:
    <?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_FEATURED_PRODUCTS') { ?>
    <?php
    /**
     * display the Featured Products Center Box
     */
    ?>
    <?php require($template->get_template_dir('tpl_modules_featured_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products.php'); ?>
    <?php } ?>
    it has the odd and frustrating behavior of displaying my custom text TWICE--once below the featured section and once above it.

    I double-checked that I actually moved the code, not copied it.

    Can anyone shed some light on this?

  2. #2
    Join Date
    Nov 2005
    Location
    Colorado Springs, CO USA
    Posts
    7,033
    Plugin Contributions
    31

    Default Re: Custom Text Below Featured Product on Home Page

    Quote Originally Posted by susb8383 View Post
    Hi,

    I'm trying to put custom text on my home page but I want it to be below the product sections (featured products, etc.)

    Here's what I did:

    I put my custom text in define_main_page.php

    This made the text show up on the home page above the Featured Products.

    So then I edited (mytemplate)/tpl_index_default.php

    I found this section that controls displaying the defined text (when I delete these lines, the defined text disappears):
    Code:
    <?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 } ?>
    Now it would be logical to assume that if I move that entire section to below the code which displays the featured products, I should get the result I want, right? wrong.

    For some reason when I move that block of code to below this block of code:
    Code:
    <?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_FEATURED_PRODUCTS') { ?>
    <?php
    /**
     * display the Featured Products Center Box
     */
    ?>
    <?php require($template->get_template_dir('tpl_modules_featured_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products.php'); ?>
    <?php } ?>
    it has the odd and frustrating behavior of displaying my custom text TWICE--once below the featured section and once above it.

    I double-checked that I actually moved the code, not copied it.

    Can anyone shed some light on this?
    Did you also make this change to (mytemplate)/tpl_index_categories.php

  3. #3
    Join Date
    Feb 2008
    Posts
    129
    Plugin Contributions
    0

    Default Re: Custom Text Below Featured Product on Home Page

    Quote Originally Posted by clydejones View Post
    Did you also make this change to (mytemplate)/tpl_index_categories.php
    I just tried that--no difference. It still shows my defined text twice, once above and once below the featured products section.

  4. #4
    Join Date
    Nov 2005
    Location
    Colorado Springs, CO USA
    Posts
    7,033
    Plugin Contributions
    31

    Default Re: Custom Text Below Featured Product on Home Page

    Quote Originally Posted by susb8383 View Post
    I just tried that--no difference. It still shows my defined text twice, once above and once below the featured products section.
    Sounds like you copied the section to a new location but didn't delete it from the old location.

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Custom Text Below Featured Product on Home Page

    The whole rest of the file after the define page output is a while() loop, so moving the define content anywhere inside that will display it as many times as the loop executes.You need to put it at the bottom of the file, just above the </div>.
    PHP Code:
    <?php
      $show_display_category
    ->MoveNext();
    // !EOF
    ?>
    </div>
    PHP Code:
    <?php
      $show_display_category
    ->MoveNext();
    // !EOF  end of while loop
    ?>

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

    </div>

  6. #6
    Join Date
    Feb 2008
    Posts
    129
    Plugin Contributions
    0

    Default Re: Custom Text Below Featured Product on Home Page

    Quote Originally Posted by gjh42 View Post
    The whole rest of the file after the define page output is a while() loop, so moving the define content anywhere inside that will display it as many times as the loop executes.You need to put it at the bottom of the file, just above the </div>.
    Bingo!! Thanks, Glenn!

    --Susie

  7. #7
    Join Date
    Feb 2010
    Posts
    154
    Plugin Contributions
    0

    Default Re: Custom Text Below Featured Product on Home Page

    Just thought I'd mention that I just used one of the Footer Banners to put content below my featured products on the homepage.

    Didn't really want to go customising code for something this basic.

    See: http://rawrocks.com

  8. #8
    Join Date
    Feb 2010
    Posts
    154
    Plugin Contributions
    0

    Default Re: Custom Text Below Featured Product on Home Page

    Oops, but unfortunately it puts the text (banner) on the bottom of all pages!

    Is there a way of excluding the banners from showing on certain pages (i.e. all pages other than the home page)?

  9. #9
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Custom Text Below Featured Product on Home Page

    One of the banner's files (module or template, I don't know which in this case) will most likely have a conditional for determining whether the banner displays, something like

    if (SHOW_BANNER_WHATEVER...){
    //execute banner code
    }

    You can add to the conditional a test for whether it is the home page

    if (SHOW_BANNER_WHATEVER and $this_is_home_page){
    //execute banner code
    }

    This principle would have to be tailored to the actual code in your banner file.

  10. #10
    Join Date
    Feb 2010
    Posts
    154
    Plugin Contributions
    0

    Default Re: Custom Text Below Featured Product on Home Page

    Thanks GJH,

    I didn't really want to change code, but I did in the end. Here's what I opted for...


    In /includes/templates/[my template]/common/tpl_main_page.php

    I changed line 133 from:

    PHP Code:
    <div id="bannerFour" class="banners"><?php echo zen_display_banner('static'$banner); ?></div>
    To:

    PHP Code:
    <div id="bannerFour" class="banners"><?php eval("?>" zen_display_banner('static'$banner) . "<?php "); ?></div>
    Putting the 'eval' function in there allows me to write PHP code into my banner itself. This is a slight security risk, but as I'm not offering external advertising or whatnot it shouldn't be an issue as I have sole control over the banner content.

    Now, in my banner, I put the following:

    PHP Code:
    <?php if ($this_is_home_page){ ?>

    <div style="padding-left: 30px; clear: both;">
    Some html and stuff here.
    </div>

    <?php
    }
    ?>
    So now I can control where the banner is shown from within the banner itself. Job's a good'un!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Add text area for Featured Products on home page
    By barendfaber in forum General Questions
    Replies: 4
    Last Post: 23 Oct 2013, 11:31 PM
  2. Home Page Text Below Images but Above Footer
    By limelites in forum General Questions
    Replies: 2
    Last Post: 29 Sep 2011, 03:17 AM
  3. Adding text below home page category images
    By davidmorrisuk in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 26 Sep 2011, 12:21 AM
  4. Need help adding new, special, and featured products to Home page on Custom Template
    By HipChickDesigns in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 23 Feb 2011, 08:21 PM
  5. Custom text and image on the home page -
    By afinta in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 19 Sep 2007, 07:50 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