Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

2.3.3 product_info gallery shows all pictures like an onion when loaded


Guest

Recommended Posts

Hi everyone,

 

I spent many many hours on looking for tips and tricks and tried A LOT to fix my problem. Couldn't fix it though.

 

Please have a look on this link: http://www.gradefive.eu/catalog/product_info.php?cPath=125&products_id=503&language=en

to see my problem.

 

When the page is loaded, alle images are loaded into the gallery. When hovering a picture of the thumbnails (the little ones under the large image), the right picture gets loaded.

 

What I want: Loading the website and showing only ONE image, not all of them.

 

 

I use a oscommerce 2.3.3 version.

 

This is the code of the product_info:

 

<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2010 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
if (!isset($HTTP_GET_VARS['products_id'])) {
tep_redirect(tep_href_link(FILENAME_DEFAULT));
}
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_check = tep_db_fetch_array($product_check_query);
require(DIR_WS_INCLUDES . 'template_top.php');
if ($product_check['total'] < 1) {
?>
<div class="contentContainer">
<div class="contentText">
<?php echo TEXT_PRODUCT_NOT_FOUND; ?>
</div>
<div style="float: right;">
<?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?>
</div>
</div>
<?php
} else {
// osc-support-edition BOF
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
// osc-support-edition EOF
$product_info = tep_db_fetch_array($product_info_query);
tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
// osc-support-edition BOF
 $products_price = '<del>' . $currencies->display_price_normal($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
// osc-support-edition EOF
} else {
 $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}
if (tep_not_null($product_info['products_model'])) {
 $products_name = $product_info['products_name'] . '<br /><span class="smallText">[' . $product_info['products_model'] . ']</span>';
} else {
 $products_name = $product_info['products_name'];
}
//display manufacturer
 if (isset($HTTP_GET_VARS['products_id'])) {
	 $manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");
	 if (tep_db_num_rows($manufacturer_query)) {
		 $manufacturer = tep_db_fetch_array($manufacturer_query);
 }
 }
?>
<?php //Start ask product question
if ($messageStack->size('product') > 0) {
echo $messageStack->output('product');
} //end ask product question
?>
<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>
<div>
<h1 style="float: right;"><?php echo $products_price; ?></h1>
<h1><?php echo $products_name; ?></h1>
</div>
<div class="contentContainer">
<div class="contentText">
<?php
if (tep_not_null($product_info['products_image'])) {
 $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");
 if (tep_db_num_rows($pi_query) > 0) {
?>
<div id="piGal" style="float: right;">
 <ul>
<?php
 $pi_counter = 0;
 while ($pi = tep_db_fetch_array($pi_query)) {
	 $pi_counter++;
	 $pi_entry = '	 <li><a href="';
	 if (tep_not_null($pi['htmlcontent'])) {
	 $pi_entry .= '#piGalimg_' . $pi_counter;
	 } else {
	 $pi_entry .= tep_href_link(DIR_WS_IMAGES . $pi['image'], '', 'NONSSL', false);
	 }
	 $pi_entry .= '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $pi['image']) . '</a>';
	 if (tep_not_null($pi['htmlcontent'])) {
	 $pi_entry .= '<div style="display: none;"><div id="piGalimg_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div></div>';
	 }
	 $pi_entry .= '</li>';
	 echo $pi_entry;
 }
?>
 </ul>
</div>
<script type="text/javascript">
$('#piGal ul').bxGallery({
maxwidth: 300,
maxheight: 200,
thumbwidth: <?php echo (($pi_counter > 1) ? '75' : '0'); ?>,
thumbcontainer: 300,
load_image: 'ext/jquery/bxGallery/spinner.gif'
});
</script>
<?php
 } else {
?>

<?php
 }
?>
<script type="text/javascript">
$("#piGal a[rel^='fancybox']").fancybox({
cyclic: true
});
</script>
<?php
}
?>

<?php //Start Better Together
require(DIR_FS_CATALOG. 'better_together_marketing.php');
if (sizeof($bt_strings) > 0) {
for ($i = 0, $n = sizeof($bt_strings); $i < $n; $i++) {
 echo '<tr><td>' . $bt_strings[$i] . '</td></tr>';
}
} //End Better Together
?>
<div class="description"><?php echo stripslashes($product_info['products_description']); ?></div>
<?php
$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
$products_attributes = tep_db_fetch_array($products_attributes_query);
if ($products_attributes['total'] > 0) {
?>
<div class="options">

<p><?php echo TEXT_PRODUCT_OPTIONS; ?></p>
<p>
<?php
 $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
 while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
 $products_options_array = array();
//<!-- AJAX Attribute Manager -->
// Standardcode:	 $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
 $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.options_values_price, pa.products_attributes_id");
//<!-- AJAX Attribute Manager end -->
 while ($products_options = tep_db_fetch_array($products_options_query)) {
	 $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
	 if ($products_options['options_values_price'] != '0') {
//osc-support-edition BOF
	 $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . strip_tags($currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id']))) .') ';
//osc-support-edition EOF
	 }
 }
 if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
	 $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
 } else {
	 $selected_attribute = false;
 }
?>
 <strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong><br /><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?><br />
<?php
 }
?>
</p>
</div>

<?php
}
?>
<div style="clear: both;"></div>
<?php
// Start PDF Datasheet
//echo '<a href="' . tep_href_link( 'pdf_datasheet.php', 'products_id=' . ( int )$_GET['products_id'] . '&language=' . $language ) . '" alt="' . TEXT_DOWNLOAD_PDF . '" title="' . TEXT_DOWNLOAD_PDF . '">' . tep_image( DIR_WS_ICONS . 'pdf_small.png', TEXT_DOWNLOAD_PDF ) . ' ' . addslashes( $product_info['products_name'] ) . TEXT_PDF_DATASHEET . '</a>';
?>
<!-- <div style="clear: both;"></div>
<br />		 -->
<?php
// End PDF Datasheet
?>
<?php
if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
<p style="text-align: center;"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></p>
<?php
}
?>
</div>
<!-- start display manufacturer-->
<div class="options" style="float: left;">
 <p><?php echo TEXT_MANUFACTURER; ?></p>
 <p><a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $product_info['manufacturers_id']); ?>"><?php echo tep_image(DIR_WS_IMAGES . $manufacturer['manufacturers_image'], $manufacturers_name); ?></a></p>
</div>
<!-- end display manufacturer -->
<!--start Product Questions-->
<div class="options">
<p><?php echo TEXT_PRODUCT_QUESTIONS; ?></p>
<p><?php
$qtns_qry = tep_db_query("select * from " . TABLE_PRODUCT_QUESTIONS . " where product_id='" . $HTTP_GET_VARS['products_id'] . "' and status='1' order by date_added limit 2");
$tab2content = '';
if (tep_db_num_rows($qtns_qry) == 0)
{
$tab2content .= NO_PRODUCT_QUESTIONS;
}
else
{
$i = 1;
while($qtnslist = tep_db_fetch_array($qtns_qry))
{
$tab2content .= $i . '. ' .$qtnslist['question'] . ' <br />   - By ' . $qtnslist['customer_name'] . ' <br>  ';
$tab2content .= $qtnslist['answer'] .'<br />';
$i++;
}
// $tab2content .= '<a style=" font-weight:bold; text-decoration:none; font-size:13px; padding-right:25px;" href="' . tep_href_link(FILENAME_PRODUCT_QUESTIONS, 'products_id='.$HTTP_GET_VARS['products_id']) . '">   '. TEXT_VIEW_ALL .'</a>';
}
$tab2content .= '<a style="font-weight:bold; font-size:13px;" href="' . tep_href_link(FILENAME_ASK_QUESTION, 'products_id='.$HTTP_GET_VARS['products_id']) . '">  ' . TEXT_ASK_QUESTION . '</a><br /><br />';
echo $tab2content;
?>
</p></div>
<!--end Product Questions-->
<?php
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and reviews_status = 1");
$reviews = tep_db_fetch_array($reviews_query);
?>
<div class="buttonSet">
<span class="buttonAction"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></span>
<?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); ?>
</div>
<?php
if ((USE_CACHE == 'true') && empty($SID)) {
 echo tep_cache_also_purchased(3600);
} else {
 include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
?>
</div>
</form>
<?php
}
require(DIR_WS_INCLUDES . 'template_bottom.php');
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

 

 

I appreciate any hints very much.

 

Thank you, Ameli

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...