Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add to cart button Not working in Product Info page


Recommended Posts

I have BTS template system installed. I have a problem with the add to cart button on product_info_tpl. Sometimes the button works and sometimes it doesn't. When I use IE to check the page, sometimes the button will not work. Depending on the layout on the page. eg. If I add an image on top of the product information section then sometimes the Add to cart button will work. It always works in Firefox - why? I have been wrestling with this problem for a long time and have searched and search but haven't found the answer anywhere. I have also tried restructuring the template but without success.

 

Can anyone help or point me in the right direction.

 

Here is the code on my product_info_tlp.php

<head>
</head>

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>

<br>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="pinkoutline">
 <?php
 if ($product_check['total'] < 1) {
?>
 <tr> 
<td>
  <?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?>
</td>
 </tr>

 <tr> 
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	<tr class="infoBoxContents"> 
	  <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr> 
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	</tr>
  </table></td>
 </tr>
 <?php
 } else {
$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_retail_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 . "'");
$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'])) {
// ***** Begin Separate price per customer mod *****
		global $customer_id;
	  $customer_group_query = tep_db_query("select customers_group_id from " . TABLE_CUSTOMERS . "		where customers_id =  '" . $customer_id . "'");
	  $customer_group = tep_db_fetch_array($customer_group_query);

	$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id =  '" . $customer_group['customers_group_id'] . "'");
	if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query))
	$product_info['products_price']= $scustomer_group_price['customers_group_price'];
// ***** Begin Separate price per customer mod *****
  $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {
//************Begin Separate Price per Customer mod **************
//	 $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
global $customer_id;
$customer_group_query = tep_db_query("select customers_group_id from " . TABLE_CUSTOMERS . " where customers_id =  '" . $customer_id . "'");
$customer_group = tep_db_fetch_array($customer_group_query);
$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_group_id =  '" . $customer_group['customers_group_id'] . "'");
if ( $customer_group['customers_group_id'] != 0) {
 if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
$products_price = $currencies->display_price($customer_group_price['customers_group_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
 } else {
  $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}
} else {
$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
 }
//***********End Separate Price per Customer mod **************
}

if (tep_not_null($product_info['products_model'])) {
  $products_name = $product_info['products_name'];
} else {
  $products_name = $product_info['products_name'];
}
?>
 <tr> 
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	<tr> 
	  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '0'); ?></td>
	</tr>


	<td valign="top" bgcolor="#F3E4F3" class="main"><strong><?php echo $products_name; ?></strong></td>
	<td align="left" valign="top" bgcolor="#F3E4F3" class="main"><div align="right"><strong><?php echo $products_price; ?></strong></div></td>
	</tr>
  </table></td>
 </tr>
 <tr> 
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>
 </tr>
 <tr> 
<td> 
  <?php
	//// BEGIN:  Added for Dynamic MoPics v3.000
if (tep_not_null($product_info['products_image'])) {
?>
	  <table border="0" cellspacing="0" cellpadding="2" align="right">
		<tr>
		  <td align="center" class="pinkOutline">
<?php
		$image_lg = mopics_get_imagebase($product_info['products_image'], DIR_WS_IMAGES . DYNAMIC_MOPICS_BIGIMAGES_DIR);
		if ($lg_image_ext = mopics_file_exists(DIR_FS_CATALOG . $image_lg, DYNAMIC_MOPICS_BIG_IMAGE_TYPES)) {
			$image_size = @getimagesize(DIR_FS_CATALOG . $image_lg . '.' . $lg_image_ext);
?>
	  <script language="javascript" type="text/javascript"><!--
		document.write('<a href="javascript:popupImage(\'<?php echo tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id'] . '&type=' . $lg_image_ext); ?>\',\'<?php echo ((int)$image_size[1] + 30); ?>\',\'<?php echo ((int)$image_size[0] + 5); ?>\');"><?php echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); ?><br /><span class="smallText"><?php echo TEXT_CLICK_TO_ENLARGE; ?></span></a>');
	  //--></script>
	  <noscript>
		<a href="<?php echo tep_href_link($image_lg . '.' . $lg_image_ext); ?>" target="_blank"><?php echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], stripslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); ?><br /><span class="smallText"><?php echo TEXT_CLICK_TO_ENLARGE; ?></span></a>
	  </noscript>
<?php
		} else {
	  echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], stripslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
		}
?>
		  </td>
		</tr><tr><td align="center" class="main"><strong><?php include(DIR_WS_MODULES . 'ezier_new_fields.php'); ?></strong>
 </td></tr><tr> 
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr>


		<tr>
 <td align="center"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
</tr>

	  </table>
<?php
}
	//// END:  Added for Dynamic MoPics v3.000
?>


<?php
}
?>	  
<p class="main"><?php echo stripslashes($product_info['products_description']); ?></p>


  <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
	<tr>
	  <td class="main"><table width="100%" border="0" cellpadding="0" cellspacing="0">

	<tr> 
	  <td class="main"><strong><?php echo TEXT_PRODUCT_OPTIONS; ?></strong></td>
	</tr>

	<?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();$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 . "' order by pa.products_attributes_id");
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') {
		$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
	  }
	}

	if (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;
	}
?>
	<tr> 
	  <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
	  </tr><tr><td><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td></tr>
	<?php
  }
?>
  </table></td>
	</tr>

  </table>

  <?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) {
?>
  <?php
}
?>
</td>
 </tr>

 <tr>
<td><table width="100%" align="center" cellpadding="0">
  <tr>
	<td width="50%" bgcolor="#F0EDF8" class="main"><?php // ################### Shipping ############## ?><img src="images/delivery.gif"><a href="shipping.php" target="_blank"> Delivery information </a></td>
	<td width="50%" bgcolor="#F0EDF8" class="main"><?php // ################### Payment Methods ############## ?><img src="images/payment_method.gif"><a href="payment_methods.php" target="_blank"> Payment Methods</a></td>
  </tr>

  <tr>
	<td colspan="2" bgcolor="#F0EDF8" class="main"><?php // ################### Ask a question ############## ?>	
	  <img src="images/ask_question.gif"><a href="ask_a_question.php?products_id=<?php echo $product_info['products_id']; ?>" ONMOUSEOVER="window.status='.<?php echo TEXT_QUESTION; ?> .'; return true">
  <?php echo TEXT_QUESTION; ?></a>
<?php // ################ end added ask a question ############ ?>
 </td>
  </tr>

  <tr>
	<td colspan="2" bgcolor="#F0EDF8" class="main"><img src="images/warning.gif"> Actual colors may vary from displayed images. Images are not shown at actual size. Delivery times vary according to stock and location.</td>
  </tr>




</table></td>
 </tr>

<?php
	//// BEGIN:  Added for Dynamic MoPics v3.000
?>
		<tr>

  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

<?php
//// START:  Added for Dynamic MoPics v3.000
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
$reviews = tep_db_fetch_array($reviews_query);
//// END:  Added for Dynamic MoPics v3.000
if ($reviews['count'] > 0) {
?>

 <tr> 
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '60'); ?></td>
 </tr>
 <?php
}

if (tep_not_null($product_info['products_url'])) {
?>

 <?php
}
if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>

 <?php
} else {
?>
 <?php
}
?>

<td> 
  <?php

//Commented for x-sell
//	if ((USE_CACHE == 'true') && empty($SID)) {
//	  echo tep_cache_also_purchased(3600);
//	} else {
//	  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
//	}
//  }
//Added for x sell
  if ( (USE_CACHE == 'true') && !SID) { 
echo tep_cache_also_purchased(3600); 
//	 include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); 
  } else { 
  include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); 
//	include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}

?>
</td>
 </tr>  <tr>
  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></td>
</tr>
 <tr><td><?php require(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); ?></td></tr>

</table>
</form>

 

Here is url on my site of an example of the button not working in IE but working in Firefox.

 

My Webpage

Mary-Ann

Chief Cook and Bottlewasher

Jack-of-All-Trades

Running 2.2MS2

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...