Code:
<?php
/**
* Tabs Template
* Tabbed Products Lite v3.8
* QHome (qhomezone######################)
*
* Loaded automatically by index.php?main_page=product_info.<br />
* Displays tabbed interface for any product
*
* @package templateSystem
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_tabbed_products_lite.php v3.7 2006-10-11 05:31:21Z qhome $
*
*/
// ------------------------------------------------------------
// ----------------- Custom Tab - Tab Strip -------------------
// ------------------------------------------------------------
?>
<!-- Tabbed Products Lite v3.8 :: 25-Oct-2006 :: (tpl_tabbed_products_lite.php) -->
<?php
if ($chkTabStart || $chkTabEnd) { // BEGIN custom tab exist check
$FindEnd = explode("<!--@EndTabs@-->", $proddata);
$pieces = explode("<!--%", $FindEnd[0]);
//echo '<br />'; //lowers the tabs from top a bit so no collision.
if ($pieces[0] != "") {?>
<div id="productDescription" class="productGeneral biggerText"><?php echo $pieces[0]; ?></div>
<?php }
echo '<div id="slidetabsmenu" style="display:none;">' . "\n";
echo '<ul>' . "\n";
for ($g = 1; $g < count($pieces); $g++) {
$sTmp = explode("%-->", $pieces[$g]);
$sName[$g] = $sTmp[0];
$sText[$g] = $sTmp[1];
echo '<li><a href="javascript:void(0)" onclick="expandcontent(\'sc'.$g.'\', this)"><span>'.$sName[$g].'</span></a></li>' . "\n";
} // END FOR loop
}
// ------------------------------------------------------------
// ------------------ Core Tab - Tab Strip --------------------
// ------------------------------------------------------------
// ===> Check for any core tabs if there are no custom tabs (tabstrip)
if (($chkTabStart === false && $chkTabEnd === false) && ($bAddToCart || $bMediaCollection || $bAdditionalImages || $bCustomersAlsoPurchased || $bCrossSell_Tab || $bReviews_Tab)) {
$bHardCodeTagsOnly = true;
$g = 1;
echo '<div id="slidetabsmenu" style="display:none;"><ul>';
// ===> Check if Add to cart should be SEPARATE tab or not (used when only hardcode tags are used ONLY!) (tabstrip)
if ($bAddToCart != false) {
echo '<li><a href="javascript:void(0)" onclick="expandcontent(\'sc'.$g.'\', this)"><span>'.$addtocart_tab_name.'</span></a></li>' . "\n";
$g++;
}
}
// ===> Check if Media Collection should be a tab or not (FOR MUSIC PRODUCT TYPE ONLY!!!) (tabstrip)
if ($bMediaCollection != false) {
echo '<li><a href="javascript:void(0)" onclick="expandcontent(\'sc'.$g.'\', this)"><span>'.$media_collection_tab_name.'</span></a></li>' . "\n";
$g++;
}
// ===> Check if Additional Images should be a tab or not (tabstrip)
if ($bAdditionalImages != false) {
if ($products_image != '') {
// prepare image name
$products_image_extension = substr($products_image, strrpos($products_image, '.'));
$products_image_base = ereg_replace($products_image_extension . '$', '', $products_image);
// if in a subdirectory
if (strrpos($products_image, '/')) {
$products_image_match = substr($products_image, strrpos($products_image, '/')+1);
$products_image_match = ereg_replace($products_image_extension, '', $products_image_match) . '_';
$products_image_base = $products_image_match;
}
$products_image_directory = ereg_replace($products_image, '', substr($products_image, strrpos($products_image, '/')));
if ($products_image_directory != '') {
$products_image_directory = DIR_WS_IMAGES . ereg_replace($products_image_directory, '', $products_image) . "/";
} else {
$products_image_directory = DIR_WS_IMAGES;
}
// Check for additional matching images
$file_extension = $products_image_extension;
$products_image_match_array = array();
if ($dir = @dir($products_image_directory)) {
while ($file = $dir->read()) {
if (!is_dir($products_image_directory . $file)) {
if(preg_match("/" . $products_image_base . "/i", $file) == '1') {
if (substr($file, 0, strrpos($file, '.')) != substr($products_image, 0, strrpos($products_image, '.'))) {
if ($products_image_base . ereg_replace($products_image_base, '', $file) == $file) {
$images_array[] = $file;
}
}
}
}
}
if (sizeof($images_array)) {
sort($images_array);
}
$dir->close();
}
} // end $products_image
// Build output based on images found
$num_images = sizeof($images_array);
if ($num_images != 0) {
echo '<li><a href="javascript:void(0)" onclick="expandcontent(\'sc'.$g.'\', this)"><span>'.$add_images_tab_name.'</span></a></li>' . "\n";
$g++;
}
unset ($images_array);
}
// ===> Check if Customer Also Purchased should be a tab or not (tabstrip)
if ($bCustomersAlsoPurchased != false) {
$also_purchased_products = $db->Execute(sprintf(SQL_ALSO_PURCHASED, (int)$_GET['products_id'], (int)$_GET['products_id']));
$CustAlsoPur = $also_purchased_products->RecordCount();
if ($CustAlsoPur != 0) {
echo '<li><a href="javascript:void(0)" onclick="expandcontent(\'sc'.$g.'\', this)"><span>'.$cust_also_purchased_tab_name.'</span></a></li>' . "\n";
$g++;
}
}
// ===> Check if Cross Sell should be a tab or not (tabstrip)
if ($bCrossSell_Tab != false) {
$xsell_query = $db->Execute("select distinct p.products_id, p.products_image, pd.products_name
from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where xp.products_id = '" . $_GET['products_id'] . "'
and xp.xsell_id = p.products_id
and p.products_id = pd.products_id
and pd.language_id = '" . $_SESSION['languages_id'] . "'
and p.products_status = 1
order by xp.sort_order asc limit " . MAX_DISPLAY_XSELL);
$num_products_xsell = $xsell_query->RecordCount();
if ($num_products_xsell != 0) {
echo '<li><a href="javascript:void(0)" onclick="expandcontent(\'sc'.$g.'\', this)"><span>'.$cross_sell_tab_name.'</span></a></li>' . "\n";
$g++;
}
}
// ===> Check if Reviews should be a tab or not (tabstrip)
if ($bReviews_Tab != false) {
echo '<li><a href="javascript:void(0)" onclick="expandcontent(\'sc'.$g.'\', this)"><span>'.$reviews_tab_name.'</span></a></li>' . "\n";
$g++;
}
// ===> Close the tabstrip creation if started
if ((intval($chkTabStart) >= 0 && intval($chkTabEnd) > 0) || ($bAddToCart || $bMediaCollection || $bAdditionalImages || $bCustomersAlsoPurchased || $bCrossSell_Tab || $bReviews_Tab)) {
echo '</ul>' . "\n" . '</div>' . "\n\n"; //end the slidetabsmenu
echo '<br style="clear: both" />' . "\n\n"; //prevent tabs from appearing inside the box
}
// ------------------------------------------------------------
// ---------------- Custom Tab - Tab Contents -----------------
// ------------------------------------------------------------
if ($chkTabStart != false || $chkTabEnd != false) { //if tags aren't created properly, do not apply tabs
echo '<div id="tabcontentcontainer">' . "\n";
for ($a = 1; $a < count($pieces); $a++) {
if ($a == 1) { // if $a is equal to the first tab, load
echo '<div id="sc'.$a.'" class="tabcontent" style="display:block;">' . "\n";
if ($bShowHeadersNoJavascript) {
echo '<div class="centerBoxWrapper" id="ProductDescriptionHeader" style="display:block;">' . "\n";
} else {
echo '<div class="centerBoxWrapper" id="ProductDescriptionHeader" style="display:none;">' . "\n";
}
?>
<h2 class="centerBoxHeading"><?php $b[$a]=str_replace('<br>', ' ', $sName[$a]); $c[$a]=str_replace('<br />', ' ', $b[$a]); echo strip_tags($c[$a]);?></h2>
<?php
echo '</div>' . "\n";
echo '<div style="width:100%;">' . "\n";
If ($bMainImageOnTabs != false) { ?>
<!--bof Add to Cart Box -->
<?php
if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
// do nothing
} else {
$display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
// hide the quantity box and default to 1
$the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
} else {
// show the quantity box
$the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
}
$display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
if ($display_qty != '' or $display_button != '') { ?>
<div id="cartAdd">
<?php
echo $display_qty;
echo $display_button;
?>
</div>
<?php
} // display qty and button
} // CUSTOMERS_APPROVAL == 3 ?>
<!--eof Add to Cart Box-->
<!--bof Quantity Discounts table -->
<?php
if ($products_discount_type != 0) {
// display the products quantity discount
require($template->get_template_dir('/tpl_modules_products_quantity_discounts.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_products_quantity_discounts.php');
}
?>
<!--eof Quantity Discounts table -->
<!--bof Main Product Image -->
<?php
if (zen_not_null($products_image)) {
/* display the main product image */
require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php');
}
?>
<!--eof Main Product Image-->
<!--bof Product Name-->
<h1 id="productName" class="productGeneral"><?php echo $products_name; ?></h1>
<!--eof Product Name-->
<!--bof Product Price block -->
<!-- <h2 id="productPrices" class="productGeneral">
<?php
// base price
if ($show_onetime_charges_description == 'true') {
$one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />';
} else {
$one_time = '';
}
echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
?>
</h2>
-->
<!--eof Product Price block -->
<!--bof free ship icon -->
<?php
if(zen_get_product_is_always_free_shipping($products_id_current)) { ?>
<div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div>
<?php } ?>
<!--eof free ship icon -->
<!--bof Product details list -->
<?php
if ( (($flag_show_product_info_model == 1 and $products_model != '') or ($flag_show_product_info_weight == 1 and $products_weight !=0) or ($flag_show_product_info_quantity == 1) or ($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name))) ) { ?>
<ul id="productDetailsList" class="floatingBox back">
<?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '<li>' . TEXT_PRODUCT_MODEL . $products_model . '</li>' : '') . "\n"; ?>
<?php echo (($flag_show_product_info_weight == 1 and $products_weight !=0) ? '<li>' . TEXT_PRODUCT_WEIGHT . $products_weight . TEXT_PRODUCT_WEIGHT_UNIT . '</li>' : '') . "\n"; ?>
<?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>' : '') . "\n"; ?>
<?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li>' . TEXT_PRODUCT_MANUFACTURER . $manufacturers_name . '</li>' : '') . "\n"; ?>
</ul>
<?php
}
?>
<!--eof Product details list -->
<?php
} // end show_main_image_in_tabs if statement
} else { // if $a not equal to the first tab
echo '<div id="sc'.$a.'" class="tabcontent" style="display:block;">' . "\n";
if ($bShowHeadersNoJavascript) {
echo '<div class="centerBoxWrapper" id="CustomHeader_' . $a . '" style="display:block;">' . "\n";
} else {
echo '<div class="centerBoxWrapper" id="CustomHeader_' . $a . '" style="display:none;">' . "\n";
}
if ($bShowHeaders != true) {
echo ("<script type=\"text/javascript\">
<!--
if (document.getElementById('CustomHeader_" . $a . "') != null) {
document.getElementById('CustomHeader_" . $a . "').style.display = \"none\";
}
//-->
</script>");
}
?>
<h2 class="centerBoxHeading"><?php $b[$a]=str_replace('<br>', ' ', $sName[$a]); $c[$a]=str_replace('<br />', ' ', $b[$a]); echo strip_tags($c[$a]);?></h2>
<?php
echo '</div>' . "\n";
echo '<div style="width:100%;">' . "\n";
}
// Write out the Tab content here
echo '<div id="productDescription'.$a.'" class="productGeneral biggerText">'.$sText[$a].'</div>' . "\n";
if ($bAddToCart && $a == 1) { // this puts 'add to cart' and attributes inside tab on first tab if active.
?>
<!-- Added Table to prevent Add to Cart button from floating off the div -->
<table border="0" width="100%"><tr><td colspan="2">
<br class="clearBoth" />
<!--bof Attributes Module -->
<?php
if ($pr_attr->fields['total'] > 0) {
// display the product atributes
echo '<br />';
require($template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_attributes.php');
}
?>
<!--eof Attributes Module -->
</td></tr><tr><td valign="bottom">
<br />
</td><td valign="bottom">
</td></tr></table>
<?php
} //end if add to cart is tab
// call sub tag check
if ($bGblUseSubTags != 0) {
require($template->get_template_dir('/tpl_tabbed_products_lite_subtabs.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_tabbed_products_lite_subtabs.php');
}
echo '</div>' . "\n" . '</div>' . "\n" . '<!--eof Custom sc'.$a.'-->';
} // End FOR loop
}//end the Tab tag check
Bookmarks