this is the complete code for:
/includes/templates/YOUR_TEMPLATE/sideboxes/tpl_featured.php
and it works with multiple products activated for the features sidebox
PHP Code:
<?php /** * Side Box Template * * @package templateSystem * @copyright Copyright 2003-2010 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_featured.php 17617 2010-09-25 20:13:29Z drbyte $ * @rbarbour zcadditions alterations 2012-01-21 */
$content = "";
$content .= '<div class="sideBoxContent centeredContent">'; $featured_box_counter = 0; while (!$random_featured_product->EOF) { $featured_box_counter++; $featured_box_price = zen_get_products_display_price($random_featured_product->fields['products_id']); $content .= "\n" . ' <div class="sideBoxContentItem">'; $content .= '<a href="' . zen_href_link(zen_get_info_page($random_featured_product->fields["products_id"]), 'cPath=' . zen_get_generated_category_path_rev($random_featured_product->fields["master_categories_id"]) . '&products_id=' . $random_featured_product->fields["products_id"]) . '">' . zen_image(DIR_WS_IMAGES . $random_featured_product->fields['products_image'], $random_featured_product->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); $content .= '<br />' . $random_featured_product->fields['products_name'] . '</a>'; $content .= '<div>' . $featured_box_price . '</div>';
if (zen_has_product_attributes($random_featured_product->fields['products_id'])) {
$content .= '<div>' . '<a href="' . zen_href_link(zen_get_info_page($random_featured_product->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($random_featured_product->fields['master_categories_id']) . '&products_id=' . $random_featured_product->fields['products_id']) . '">' . zen_image_button(BUTTON_MORE_INFO_SMALL, BUTTON_MORE_INFO_SMALL_ALT) . '</a></div>';
} else {
$content .= '<div>' . '<a href="' . zen_href_link(zen_get_info_page($random_featured_product->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($random_featured_product->fields['master_categories_id']) . '&products_id=' . $random_featured_product->fields['products_id']) . '">' . zen_image_button(BUTTON_MORE_INFO_SMALL, BUTTON_MORE_INFO_SMALL_ALT) . '</a><a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $random_featured_product->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW_SMALL, BUTTON_BUY_NOW_SMALL_ALT, 'class="sideBoxContentItemBuyNowImage"') . '</a></div>';
}
$content .= '</div>';
$random_featured_product->MoveNextRandom();
}
$content .= '</div>' . "\n";
Bookmarks