Forums / Templates, Stylesheets, Page Layout / How do I display Featured Products on top of the screen?

How do I display Featured Products on top of the screen?

Locked

Views: 1,298

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
8 Jun 2007, 10:31 AM
#1
bearaman avatar

bearaman

New Zenner

Join Date:
Jun 2006
Posts:
57
Plugin Contributions:
0

How do I display Featured Products on top of the screen?

Hi There,
I've searched the forums but can't find an answer to this simple question. How do I get my featured product listing to display at the top of the page? Currently, my categories are displayed on the main page with the featured products at the bottom. I want shoppers to see these products first.
Thnaks,
Bearaman

8 Jun 2007, 10:42 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: How do I display Featured Products on top of the screen?

Sorry for the long code post but this was easier than explaining how to move this...

Copy this code and paste into a "PLAIN" text editor like notepad and save it as tpl_index_default.php and upload this to your template/common folder.(iOnly if you are using Zen Cart 1.3.7)

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

<?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
?>
</div>

If you look this is only re-ordering of the sequence these are displayed in.

Zen-Venom Get Bitten

8 Jun 2007, 10:57 AM
#3
bearaman avatar

bearaman

New Zenner

Join Date:
Jun 2006
Posts:
57
Plugin Contributions:
0

Re: How do I display Featured Products on top of the screen?

Thanks Kobra.
I'll do this over the weekend and let you know how I get on.
I'm surprised it's a code change I needed, I felt sure I just missed some admin setting. Are there any plans to allow users to control the sort order on the index page in the future?
Thanks,
Bearaman

8 Jun 2007, 11:15 AM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: How do I display Featured Products on top of the screen?

I am only a poster here and do not know what the Dev's have planned over what is in the road map

Zen-Venom Get Bitten

9 Jun 2007, 7:49 AM
#5
nu2u2 avatar

nu2u2

New Zenner

Join Date:
Jun 2007
Posts:
6
Plugin Contributions:
0

Re: How do I display Featured Products on top of the screen?

I'm trying to do this too. Searched all over for a solution and came across this post. Created the file, uploaded it and nothing. Everything's the same. Any suggestions? You'd think this would be something simple.

9 Jun 2007, 9:45 AM
#6
nu2u2 avatar

nu2u2

New Zenner

Join Date:
Jun 2007
Posts:
6
Plugin Contributions:
0

Re: How do I display Featured Products on top of the screen?

Ok, I did a little more searching, guess I'm impatient. Found a little more info and got it to work for me. This is the how I got it to work for me. If it's the wrong way to do it, let me know.
I copied includes/templates/template_default/templates/tpl_index_categories.php
to
includes/templates/CUSTOM/templates/tpl_index_categories.php
and then started moving things around. This is what my file ended up looking like.

<?php
/**
* Page Template
*
* Loaded by main_page=index<br />
* Displays category/sub-category listing<br />
* Uses tpl_index_category_row.php to render individual items
*
* @package templateSystem
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license [URL]http://www.zen-cart.com/license/2_0.txt[/URL] GNU Public License V2.0
* @version $Id: tpl_index_categories.php 4678 2006-10-05 21:02:50Z ajeh $
*/
?>
<div class="centerColumn" id="indexCategories">
<?php if ($show_welcome == true) { ?>
<h1 id="indexCategoriesHeading"><?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
<?php if (TEXT_MAIN) { ?>
<div id="" class="content"><?php echo TEXT_MAIN; ?></div>
<?php } ?>-->

<?php if (SHOW_CUSTOMER_GREETING == 1) { ?>
<h2 class="greeting"><?php echo zen_customer_greeting(); ?></h2>
<?php } ?>
<!-- deprecated - to use - uncomment
<?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) { ?>
<div id="indexCategoriesMainContent" class="content"><?php
/**
* require the html_define for the index/categories page
*/
include($define_page);
?></div>
<?php } ?>
<?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 } else { ?>
<h1 id="indexCategoriesHeading"><?php echo $breadcrumb->last(); ?></h1>
<?php } ?>

<?php
if (PRODUCT_LIST_CATEGORIES_IMAGE_STATUS_TOP == 'true') {
// categories_image
if ($categories_image = zen_get_categories_image($current_category_id)) {
?>
<div id="categoryImgListing" class="categoryImg"><?php echo zen_image(DIR_WS_IMAGES . $categories_image, '', SUBCATEGORY_IMAGE_TOP_WIDTH, SUBCATEGORY_IMAGE_TOP_HEIGHT); ?></div>
<?php
}
} // categories_image
?>

<?php
// categories_description
if ($current_categories_description != '') {
?>
<div id="categoryDescription" class="catDescContent"><?php echo $current_categories_description; ?></div>
<?php } // categories_description ?>
<!-- BOF: Display grid of available sub-categories, if any -->
<?php
if (PRODUCT_LIST_CATEGORY_ROW_STATUS == 0) {
// do nothing
} else {
// display subcategories
/**
* require the code to display the sub-categories-grid, if any exist
*/
require($template->get_template_dir('tpl_modules_category_row.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_row.php');
}
?>
<!-- EOF: Display grid of available sub-categories -->
<?php
$show_display_category = $db->Execute(SQL_SHOW_PRODUCT_INFO_CATEGORY);

while (!$show_display_category->EOF) {
// // echo 'I found ' . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS);

?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_CATEGORY_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_CATEGORY_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_CATEGORY_UPCOMING') { ?>
<?php include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS)); ?><?php } ?>
<?php
$show_display_category->MoveNext();
} // !EOF
?>
</div>

I'm sure you could play with it more and move other parts around if needed. I may go back later and move the Specials up above the categories as well. For now, this works. I know absolutely nothing about PHP so if I've screwed things up by doing this, please let me know.

11 Jun 2007, 8:51 AM
#7
bearaman avatar

bearaman

New Zenner

Join Date:
Jun 2006
Posts:
57
Plugin Contributions:
0

Re: How do I display Featured Products on top of the screen?

Hi,
I tried Kobra's instructions and it didn't change anything so I'll try yours Nu2u2 tonight and let you know how I get on.
Thanks,
Bearaman

20 Jun 2007, 9:11 AM
#8
bearaman avatar

bearaman

New Zenner

Join Date:
Jun 2006
Posts:
57
Plugin Contributions:
0

Re: How do I display Featured Products on top of the screen?

Hi Nu2u2,
The code worked fine! the only issue I saw was that the welcome guest message appeared twice. That's easily solved by removing the first instance of:

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

Thanks,
John

20 Jun 2007, 3:40 PM
#9
jacque427 avatar

jacque427

Zen Follower

Join Date:
Apr 2005
Location:
Spokane, Washington
Posts:
324
Plugin Contributions:
0

Re: How do I display Featured Products on top of the screen?

I'm going to give this a shot and see how it works. Will post back here.
Does anyone have a url with a working example?

Jacque
http://www.freshabundance.com

Just knowledgeable enough to be dangerous.

19 Jul 2007, 7:41 PM
#10
stuff4toys avatar

stuff4toys

Totally Zenned

Join Date:
May 2007
Location:
SW Florida
Posts:
1,062
Plugin Contributions:
1

Re: How do I display Featured Products on top of the screen?

kobra:

Sorry for the long code post but this was easier than explaining how to move this...

Copy this code and paste into a "PLAIN" text editor like notepad and save it as tpl_index_default.php and upload this to your template/common folder.(iOnly if you are using Zen Cart 1.3.7)

If you look this is only re-ordering of the sequence these are displayed in.

THANKS kobra
That sure the work/pain out of this project. Works like a charm and a little more defined that the original file so moving stuff around will be eveneasier next time.

Good Job
JOhn ><>

Newest Site: ChargerPros - Stuff4Toys