Originally Posted by
gjh42
That is a defect in the coding for the new products sidebox - it repeats the .sideBoxContent div for each product, instead of having one .sideBoxContent div with three inner divs for the products. I fixed it on my test installation a couple of years ago. You can copy
/includes/templates/template_default/sideboxes/tpl_whatsnew.php to
/includes/templates/your_template/sideboxes/tpl_whatsnew.php, and replace its contents with this:
PHP Code:
<?php
/**
* Side Box Template
*
* @package templateSystem
* @copyright Copyright 2003-2007 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_whats_new.php 6128 2007-04-08 04:53:32Z birdbrain $ divs corrected by gjh42 20080930
*/
$content = "";
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';
$whats_new_box_counter = 0;
while (!$random_whats_new_sidebox_product->EOF) {
$whats_new_box_counter++;
$whats_new_price = zen_get_products_display_price($random_whats_new_sidebox_product->fields['products_id']);
$content .= '<div class="sideBoxContentItem">';
$content .= '<a href="' . zen_href_link(zen_get_info_page($random_whats_new_sidebox_product->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($random_whats_new_sidebox_product->fields['master_categories_id']) . '&products_id=' . $random_whats_new_sidebox_product->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $random_whats_new_sidebox_product->fields['products_image'], $random_whats_new_sidebox_product->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
$content .= '<br />' . $random_whats_new_sidebox_product->fields['products_name'] . '</a>';
$content .= '<div>' . $whats_new_price . '</div>';
$content .= '</div>';
$random_whats_new_sidebox_product->MoveNextRandom();
}
$content .= '</div>';
?>
This question and the previous few do not really have anything to do with the Future Zen template as such, and would be better as separate topics where someone with the same questions might find them.
Okay, so I am trying to do the same for 'specials, taking Glenn's code and using it for tpl_specials.php this is the code I came up with...
PHP Code:
<?php
/**
* tpl_specials.php
*
* @package templateSystem
* @copyright Copyright 2003-2007 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_specials.php 6128 2007-04-08 04:53:32Z birdbrain $ divs corrected by gjh42 20080930
*/
$content = "";
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';
$specials_box_counter = 0;
while (!$random_specials_sidebox_product->EOF) {
$specials_box_counter++;
$specials_box_price = zen_get_products_display_price($random_specials_sidebox_product->fields['products_id']);
$content .= '<div class="sideBoxContent">'; $content .= '<a href="' . zen_href_link(zen_get_info_page($random_specials_sidebox_product->fields["products_id"]), 'cPath=' . zen_get_generated_category_path_rev($random_specials_sidebox_product->fields["master_categories_id"]) . '&products_id=' . $random_specials_sidebox_product->fields["products_id"]) . '">' . zen_image(DIR_WS_IMAGES . $random_specials_sidebox_product->fields['products_image'], $random_specials_sidebox_product->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
$content .= '<br />' . $random_specials_sidebox_product->fields['products_name'] . '</a>';
$content .= '<div>' . $specials_box_price . '</div>';
$content .= '</div>';
$random_specials_sidebox_product->MoveNextRandom();
}
$content .= '</div>';
?>
and below is the result I get... I'm not actually so bothered about it, just showing one special is enough, it was more a learning exercise than anything, but if anyone could work it out I'd be grateful for the tips
Bookmarks