Hi
I'd like to use some boxes like "new products" etc, but they may only be visible on the mainpage of the shop, not on the categorie pages or on the shopping-cart page. I can't find were to edit this.
Thank You
Jelle
Hi
I'd like to use some boxes like "new products" etc, but they may only be visible on the mainpage of the shop, not on the categorie pages or on the shopping-cart page. I can't find were to edit this.
Thank You
Jelle
Sideboxes can be customized ...
To know if you are on the main home page there is a variable:
$this_is_home_page
That can be used in an IF statement on the sidebox to allow/stop it from displaying ...
Using your templates and override directories, you can customize the sideboxes to display when you want them to ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
hi ajeh,
i am still a new zenner and need the same help. if you could take a moment, could you explain this in detail or point me to a thread that may have the answer. what coding do i need and where does is need to be placed to ensure the sidebox will only appear on the main page. thanks in adavance:-D
Let's say you want the sidebox
/includes/modules/sideboxes/whats_new.php
to only appear on the main page ...
Copy to your templates and overrides directory:
/includes/modules/sideboxes/your_templates_dir/whats_new.php
The original code looks like this:
Let's change it a bit ...PHP Code:// display limits
//$display_limit = zen_get_products_new_timelimit();
$display_limit = zen_get_new_date_range();
$random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price
from " . TABLE_PRODUCTS . " p
where p.products_status = 1 " . $display_limit . "
limit " . MAX_RANDOM_SELECT_NEW;
$random_whats_new_sidebox_product = zen_random_select($random_whats_new_sidebox_product_query);
if ($random_whats_new_sidebox_product->RecordCount() > 0 ) {
$whats_new_price = zen_get_products_display_price($random_whats_new_sidebox_product->fields['products_id']);
$random_whats_new_sidebox_product->fields['products_name'] = zen_get_products_name($random_whats_new_sidebox_product->fields['products_id']);
$random_whats_new_sidebox_product->fields['specials_new_products_price'] = zen_get_products_special_price($random_whats_new_sidebox_product->fields['products_id']);
require($template->get_template_dir('tpl_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_whats_new.php');
$title = BOX_HEADING_WHATS_NEW;
$title_link = FILENAME_PRODUCTS_NEW;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
We want to add a condition for an IF statement to test should this show ...
Change the code to read:
Now it will only show when the variable $this_is_home_page evaluates to true ...PHP Code:// test if box should display
$show_whats_new= true;
// only show if the main page
if ($this_is_home_page == true) {
$show_whats_new= true;
} else {
$show_whats_new= false;
}
if ($show_whats_new == true) {
// display limits
//$display_limit = zen_get_products_new_timelimit();
$display_limit = zen_get_new_date_range();
$random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price
from " . TABLE_PRODUCTS . " p
where p.products_status = 1 " . $display_limit . "
limit " . MAX_RANDOM_SELECT_NEW;
$random_whats_new_sidebox_product = zen_random_select($random_whats_new_sidebox_product_query);
if ($random_whats_new_sidebox_product->RecordCount() > 0 ) {
$whats_new_price = zen_get_products_display_price($random_whats_new_sidebox_product->fields['products_id']);
$random_whats_new_sidebox_product->fields['products_name'] = zen_get_products_name($random_whats_new_sidebox_product->fields['products_id']);
$random_whats_new_sidebox_product->fields['specials_new_products_price'] = zen_get_products_special_price($random_whats_new_sidebox_product->fields['products_id']);
require($template->get_template_dir('tpl_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_whats_new.php');
$title = BOX_HEADING_WHATS_NEW;
$title_link = FILENAME_PRODUCTS_NEW;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
} // eof: test $show_whats_new
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Hi,
Your reply was great help to me. Are there variable for other pages too ? Lets say I want to hide "shopping cart" side box on checkout page.
How do I do that ? If the variable not existing then how can we define the variable ?
this will be great help in customizing side bad based on current page.
Thanks,
Sena
I did it.
$current_page = is always having current page name .. by checking the page name I manage to hide side boxes as and when needed.
thanks,
Sena.
I am struggling with this...
for the featured sidebox, I have changed my code to read:
// test if box should display
  $show_featured= true;
// only show if the main page
  if ($this_is_home_page == true) {
    $show_featured= true;
  } else {
    $show_featured= false;
  }
    
changing the "whats_new" above to "featured".
i get the following error on my main page:
Parse error: syntax error, unexpected T_VARIABLE in /home/animalve/public_html/zencart/includes/modules/sideboxes/custom/featured.php on line 13
I also tried following the instructions on page https://www.zen-cart.com/tutorials/i...hp?article=270 with the same result.
what am i missing?
What's on lines 10 - 15 on your file?
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
first 30 lines are:
<?php
/**
* featured sidebox - displays a random Featured Product
*
* @package templateSystem
* @copyright Copyright 2003-2005 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: featured.php 2808 2006-01-06 17:17:32Z drbyte $
*/
// test if box should display
  $show_featured= true;
// only show if the main page
  if ($this_is_home_page == true) {
    $show_featured= true;
  } else {
    $show_featured= false;
  }
if ($show_featured == true) {
$random_featured_products_query = "select p.products_id, p.products_image, pd.products_name
from (" . TABLE_PRODUCTS . " p
left join " . TABLE_FEATURED . " f on p.products_id = f.products_id
left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
where p.products_id = f.products_id and p.products_id = pd.products_id and p.products_status = 1 and f.status = 1 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
order by pd.products_name desc
limit " . MAX_RANDOM_SELECT_FEATURED_PRODUCTS;
produces error message:
Parse error: syntax error, unexpected T_IF in /home/animalve/public_html/zencart/includes/modules/sideboxes/custom/featured.php on line 15
Last edited by kmh; 7 Jul 2007 at 03:53 AM. Reason: clarity
I cannot seem to break mine based on the code you are displaying ...![]()
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!