Forums / Templates, Stylesheets, Page Layout / Adding content to main page above and below "Featured" products???

Adding content to main page above and below "Featured" products???

Locked

Started by aly22 on 7 May 2009, 5:58 AM · Views: 7,076

Results 1 to 14 of 14
This thread is locked. New replies are disabled.
7 May 2009, 5:58 AM
#1
aly22 avatar

aly22

Zen Follower

Join Date:
Feb 2008
Posts:
174
Plugin Contributions:
0

Adding content to main page above and below "Featured" products???

I would like to (possibly) include custom content on my main page both above (which I have done) and BELOW the Featured Products that display in the main page, center area. Is this possible? and if so, how?

/includes/modules/featured_products.php???

Basically,

HOME PAGE
Menu Main Page (define) Content
Featured Products here in 1 row
MORE custom content

THANKS!

7 May 2009, 6:49 AM
#2
aly22 avatar

aly22

Zen Follower

Join Date:
Feb 2008
Posts:
174
Plugin Contributions:
0

Re: Adding content to main page above and below "Featured" products???

Ok, I got adventurous and edited
templates/mytemplate/common/tpl_main_page.php

And managed to get additional content to show below the featured box just like I wanted it to ... BUT ...

now it shows on EVERY page below everything.

Is there a way to get it to JUST appear on the main page?

(link)

7 May 2009, 9:28 AM
#3
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Adding content to main page above and below "Featured" products???

You need to put some restriction on where the additional content must appear.

Look here for some ideas:

http://www.zen-cart.com/forum/showthread.php?t=55487

20 years a Zencart User

7 May 2009, 2:52 PM
#4
aly22 avatar

aly22

Zen Follower

Join Date:
Feb 2008
Posts:
174
Plugin Contributions:
0

Re: Adding content to main page above and below "Featured" products???

Awesome! I just tried this:

<!--additional content below featured products--> <?php if ($this_is_home_page) { ?>

INSERT HTML HERE

<?php } ?> <!-- eof additional content below featured -->

THANK YOU!

7 Jun 2009, 2:48 PM
#5
giftmeister avatar

giftmeister

Zen Follower

Join Date:
Jan 2009
Location:
Montreal, Canada
Posts:
230
Plugin Contributions:
0

Re: Adding content to main page above and below "Featured" products???

I've been experimenting for half an hour and can't figure out where exactly to put your code without messing up other parts of the page. A little more info, please, for us non-programmers!

R

7 Jun 2009, 3:13 PM
#6
giftmeister avatar

giftmeister

Zen Follower

Join Date:
Jan 2009
Location:
Montreal, Canada
Posts:
230
Plugin Contributions:
0

Re: Adding content to main page above and below "Featured" products???

As is often the case, I experimented a little more and figured it out right after the 7-minute limit to edit or cancel my previous post.

It goes at line 132 (of tpl_main_page.php):

....  * prepares and displays center column
  *
  */
 require($body_code); ?>
<!--additional content below featured products-->	
<?php if ($this_is_home_page)
{ ?> 
YOUR TEXT OR CODE
<?php } ?>	
<!-- eof additional content below featured -->
<?php
  if (SHOW_BANNERS_GROUP_SET4 != ......

Thanks!

R

22 Jun 2009, 3:07 PM
#7
aboveallfabric avatar

aboveallfabric

New Zenner

Join Date:
Feb 2009
Posts:
17
Plugin Contributions:
0

Re: Adding content to main page above and below "Featured" products???

Will this work even if the featured products is not currently displayed?

19 Feb 2010, 12:03 PM
#8
josee225 avatar

josee225

New Zenner

Join Date:
Feb 2009
Posts:
78
Plugin Contributions:
0

Re: Adding content to main page above and below "Featured" products???

This is exactly almost what I want !

I have a bilingual website, how could I add a user defined box here, instead of just having content ? I can set up the box, I just don't know how to call it.

Thank you !

23 Feb 2010, 12:47 PM
#9
josee225 avatar

josee225

New Zenner

Join Date:
Feb 2009
Posts:
78
Plugin Contributions:
0

Re: Adding content to main page above and below "Featured" products???

Please, could someone help me out with this ?

Thanks in advance :smile:

3 Mar 2010, 3:16 PM
#10
josee225 avatar

josee225

New Zenner

Join Date:
Feb 2009
Posts:
78
Plugin Contributions:
0

Re: Adding content to main page above and below "Featured" products???

I have been testing with a few options here, and since I know almost nothing about php, I am kinda stuck here... :blink:

I tried adding the define_page_2.php in my tpl_index_default.php file, but all I kkeep getting is a copy of the define_main_page.php content... Here is the code:

<?php
/**
 * Page Template
 *
 * Main index page<br />
 * Displays greetings, welcome text (define-page content), and various centerboxes depending on switch settings in Admin<br />
 * Centerboxes are called as necessary
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_index_default.php 3464 2006-04-19 00:07:26Z ajeh $
 */
?>
<div class="centerColumn" id="indexDefault">
<h1 id="indexDefaultHeading"><?php echo HEADING_TITLE; ?></h1>

<?php if (SHOW_CUSTOMER_GREETING == 1) { ?>
<h2 class="greeting"><?php echo zen_customer_greeting(); ?></h2>
<?php } ?>

<!-- deprecated - to use uncomment this section
<?php if (TEXT_MAIN) { ?>
<div id="" class="content"><?php echo TEXT_MAIN; ?></div>
<?php } ?>-->

<!-- deprecated - to use uncomment this section
<?php if (TEXT_INFORMATION) { ?>
<div id="" class="content"><?php echo TEXT_INFORMATION; ?></div>
<?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 } ?>

<?php
  $show_display_category = $db->Execute(SQL_SHOW_PRODUCT_INFO_MAIN);
  while (!$show_display_category->EOF) {
?>

<?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 } ?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_SPECIALS_PRODUCTS') { ?>
<?php
/**
 * display the Special Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_specials_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_specials_default.php'); ?>
<?php } ?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_NEW_PRODUCTS') { ?>
<?php
/**
 * display the New Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_whats_new.php'); ?>
<?php } ?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_UPCOMING') { ?>
<?php
/**
 * display the Upcoming Products Center Box
 */
?>
<?php include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS)); ?><?php } ?>


<?php
  $show_display_category->MoveNext();
} // !EOF
?>

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

</div>

I'm sure the problem lies in the require($define_page), but I have no clue how to fix this !

Could someone please point me in the right direction ?:frusty:

Thank you !

3 Mar 2010, 9:15 PM
#11
josee225 avatar

josee225

New Zenner

Join Date:
Feb 2009
Posts:
78
Plugin Contributions:
0

Re: Adding content to main page above and below "Featured" products???

Ok so tinkered around and found the solution on my own. I just don't know if I defined the page in the right spot to optimize my code though...

Anyway, here goes:

<?php
/**
 * Page Template
 *
 * Main index page<br />
 * Displays greetings, welcome text (define-page content), and various centerboxes depending on switch settings in Admin<br />
 * Centerboxes are called as necessary
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_index_default.php 3464 2006-04-19 00:07:26Z ajeh $
 */
$define_page_2 = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_PAGE_2, 'false');
?>

<div class="centerColumn" id="indexDefault">
<h1 id="indexDefaultHeading"><?php echo HEADING_TITLE; ?></h1>

<?php if (SHOW_CUSTOMER_GREETING == 1) { ?>
<h2 class="greeting"><?php echo zen_customer_greeting(); ?></h2>
<?php } ?>

<!-- deprecated - to use uncomment this section
<?php if (TEXT_MAIN) { ?>
<div id="" class="content"><?php echo TEXT_MAIN; ?></div>
<?php } ?>-->

<!-- deprecated - to use uncomment this section
<?php if (TEXT_INFORMATION) { ?>
<div id="" class="content"><?php echo TEXT_INFORMATION; ?></div>
<?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 } ?>

<?php
  $show_display_category = $db->Execute(SQL_SHOW_PRODUCT_INFO_MAIN);
  while (!$show_display_category->EOF) {
?>

<?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 } ?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_SPECIALS_PRODUCTS') { ?>
<?php
/**
 * display the Special Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_specials_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_specials_default.php'); ?>
<?php } ?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_NEW_PRODUCTS') { ?>
<?php
/**
 * display the New Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_whats_new.php'); ?>
<?php } ?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_UPCOMING') { ?>
<?php
/**
 * display the Upcoming Products Center Box
 */
?>
<?php include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS)); ?><?php } ?>


<?php
  $show_display_category->MoveNext();
} // !EOF
?>

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

</div>

I defined my page 2 at the beginning of the code, and added the necessary code to call the page... If anybody has better suggestions, I am looking forward to it !

Thanks !:bigups:

29 Mar 2010, 6:39 PM
#12
ncflanagan avatar

ncflanagan

New Zenner

Join Date:
Nov 2009
Posts:
14
Plugin Contributions:
0

Re: Adding content to main page above and below "Featured" products???

:thumbsup:
thank you!

Noreen Flanagan Johnson
http://merrimackvalleydiapers.com
I would like to thank you in advance for your help!

15 Jul 2010, 2:19 PM
#13
nowadays avatar

nowadays

New Zenner

Join Date:
Jul 2010
Posts:
1
Plugin Contributions:
0

Re: Adding content to main page above and below "Featured" products???

I needed to place jquery tabs underneath the featured products,
I added the following and it works:

<!--additional content below featured products--> <?php if ($this_is_home_page) { ?>

INSERT JQUERY RELATED HTML

<?php } ?>

Placed the Extra div content in,
It's been useful for adding extra content without stretching the page
Example

12 Sep 2010, 6:52 PM
#14
ggbarnum avatar

ggbarnum

New Zenner

Join Date:
Jul 2010
Posts:
37
Plugin Contributions:
0

Re: Adding content to main page above and below "Featured" products???

Thanks very much for this, its exactly what I was looking for :)