Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Default option in product info coming from cart


patator

Recommended Posts

Posted

Hello

 

After 1 year or so of work I have nearly finished to build up my website, www.clubfitting.net

 

Here is my issue :

 

To see the problem, select a product option from the following page : Product info page, shaft selection

Take Flex : "Regular"

 

Add the item to the cart and click on the product link from the cart. It correctly comes back to the added product but the option previously selected is not set to default. (it should be set to Regular, it's set to "Select"

 

Is it normal or is there something wrong in my code, if so how to change it.

 

 

Thanks for your help

Patrice

 

Copy of the product_info

<?php
/*
 $Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
C'est ici que l'on affiche les infos sur le produit s?lectionn?
*/

 require('includes/application_top.php');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
//################## Added Enable / Disable Categories #################"
//  $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_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 . "'");
//################## End Added Enable / Disable Categories #################


 $product_check = tep_db_fetch_array($product_check_query);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>

<head>
<!-- coolMenu //-->
<?php 
if (DISPLAY_DHTML_MENU == 'CoolMenu') {
	echo '<script LANGUAGE="JavaScript1.2" SRC="includes/coolMenu.js">
</SCRIPT>';
}
?>
<!-- coolMenu_eof //-->
<?php
// BOF: WebMakers.com Changed: Header Tag Controller v1.0
// Replaced by header_tags.php
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
 require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?> 
 <title><?php echo TITLE; ?></title>
<?php
}
// EOF: WebMakers.com Changed: Header Tag Controller v1.0
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">

<script language="javascript"><!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=250,height=350,screenX=150,screenY=150,top=150,le
ft=150')


}
//--></script>



<?php //available attrib for current product
//echo $HTTP_GET_VARS['products_id'];

$Main_gauche="NON";
$Attrib_exist="false";

  $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_sort,popt.products_options_name");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {	
	//echo $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
	$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,pa.RH,pa.LH 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_options_sort_order, pa.options_values_price");

	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'],'RH' => $products_options['RH'],'LH' => $products_options['LH']);

	}

if  ($products_options_name['products_options_id']=='6' ||   
$products_options_name['products_options_id']=='25'||
$products_options_name['products_options_id']=='26'||
$products_options_name['products_options_id']=='27') {
$Attrib_exist="true";
?>

<script language=JavaScript>;
<!--  hide from older browsers;

function FaceAngle(RH,LH,Angle,id)
{
this.RH = RH;
this.LH = LH;
this.Angle = Angle;
this.id = id
};

var FaceAngleList = new Array();

<? foreach ($products_options_array as $key => $products_options_array)
{
if ($products_options_array[RH]=='1'){$MainD="44";} else {$MainD="NO_RIGHT";}
if ($products_options_array[LH]=='1'){$MainG="45";$Main_gauche="OUI";} else {$MainG="NO_LEFT";}

?>
FaceAngleList[<? echo $key?>] = new FaceAngle ('<? echo $MainD?>','<? echo $MainG ?>','<? echo $products_options_array[text] ?>','<? echo $products_options_array[id] ?>');
<?
}
?>

function getHands(frm)
{
frm.SelHand.options[frm.SelHand.options.length] = new Option('<? echo SELECT ?>', 'NO_SELECTION');
frm.SelHand.options[frm.SelHand.options.length] = new Option('<? echo RIGHT_HAND ?>', '44');
<? if ($Main_gauche=="OUI") {
?>
frm.SelHand.options[frm.SelHand.options.length] = new Option('<? echo LEFT_HAND ?>', '45');
<?}?>
};

function getFaceAngleList(Hand)
{
document.getElementById('id[24]').value=Hand;
document.getElementById('id[<? echo $products_options_name['products_options_id'] ?>]').value="NO_SELECTION";
var current = (frm.SelLoft.value) ? FaceAngleList[frm.SelLoft.value] : 'NO_SELECTION';//enlev? .name mais probl?me si on ne touche pas au loft apr?s changement de main

for(i = frm.SelLoft.length - 1; i >= 0; i--)
{
	frm.SelLoft.options[i] = null;
}

frm.SelLoft.options[0] = new Option('<? echo SELECT ?>', 'NO_SELECTION', true, true);
for(i = 0; i < FaceAngleList.length; i++)
{
var Face = FaceAngleList[i];
	if (Face.RH == Hand || Face.LH == Hand)
	{
	frm.SelLoft.options[frm.SelLoft.options.length] = new Option(Face.Angle, Face.id, (Face.Angle==current), (Face.Angle==current));
	}
}

}

function changeDependantAttribute(x)
{
document.getElementById('id[<? echo $products_options_name['products_options_id'] ?>]').value=x;
}

frm = null;

function init()
{
frm = document.getElementById('cart_quantity');
getHands(frm);
getFaceAngleList(frm.SelHand.value);
}

// -->\n";
</script>
<?
}

}
?>




</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onLoad="init()";>


<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="800" cellspacing="3" cellpadding="3" align="center">
<!-- body //-->
<table border="0" width="800" cellspacing="3" cellpadding="3" align="center" bgcolor="#FFFFFF" class="internal">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->


<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
 if ($product_check['total'] < 1) {
?>

  <tr>
	<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></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, pd.technical_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 . "'");

// Big Image Amended Line
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description,  pd.technical_description,p.products_model, p.products_quantity, p.products_image, p.products_mediumimage, p.products_largeimage, 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 . "'");

$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'])) {
  $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 {
  $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'] . '<span class="smallText"> (' . $product_info['products_model'] . ')</span>';
} else {
  $products_name = $product_info['products_name'];
}

//Option must be selected (mustselect)
if ($messageStack->size('product_info') > 0) {
?>
	<tr>
			<td><?php echo $messageStack->output('product_info'); ?></td>
	</tr>
	<tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	</tr>
<?php  }
// EoF CB
?>


  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<?php
// BOF: WebMakers.com Added: Show Category and Image
if (SHOW_CATEGORIES=='1') {
?>
	  <tr><td colspan="2"><table align="right">
		<tr>
		  <td class="main" align="center"><?php echo tep_image(DIR_WS_IMAGES . tep_get_categories_image(tep_get_products_catagory_id($product_info_values['products_id']))); ?></td>
		</tr>
		<tr>
		  <td class="main" align="center"><?php echo tep_get_categories_name(tep_get_products_catagory_id($product_info_values['products_id'])); ?></td>
		</tr>
	  </table></td></tr>
<?php
}
// EOF: WebMakers.com Added: Show Category and Image
?>


	  <tr>
		<table border="0" width="100%" cellspacing="0" cellpadding="0" class="productListing">
		  <tr>
			  <td class="pageHeading2">
				<?php echo $products_name; ?>
			  </td> 
		   </tr>

		   </table>
  </tr>

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


<tr><td>

<table width="100%"  border="0" align="left" cellspacing="0" cellpadding="0">
<tr>
	<TD>

	<?php // A gauche, on met la photo, le prix, les attributs et la quantit? MODIF PAR PAT?>
		<table width="22%"  border="0" align="left" cellspacing="0" cellpadding="0" class="product_info_photo" >		
			   <tr>
			   <td width="100%" align="center" valign="top" >
				<script language="javascript"><!--
				document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_mediumimage'], addslashes($product_info['products_name']), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
				//--></script>
				<noscript>
				<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_mediumimage']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_mediumimage'], $product_info['products_name'], MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>				
				</noscript>
				</td>
				</tr>

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

<?php //s'il y a des attributs, on affiche "attributs disponibles
$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) {
?>


		<tr><td>
				<table frame="below" width="100%" cellspacing="0" cellpadding="0">
				<tr><td></td></tr>
				</table>					
		</tr></td>					

		<tr><td>
				<tr>					
				<td class="product_info_attributs"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '3'); ?></td>
				</tr>
				<tr>
					<td class="product_info_attributs_title"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
				</tr>
				<tr>
				<td class="product_info_attributs_title"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '7'); ?></td>
				</tr>
<?php
}
?>		







<?php // on indique les attributs disponibles

  $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_sort,popt.products_options_name");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {	
	$products_options_array = array();

	// BOF: WebMakers.com Added: Attributes Copy and Sort
 if ( PRODUCTS_OPTIONS_SORT_BY_PRICE !='1' ) {
	$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.RH,pa.LH 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_options_sort_order, pov.products_options_values_name");
 } else {
	$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.RH,pa.LH 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_options_sort_order, pa.options_values_price");
 }
// EOF: WebMakers.com Added: Attributes Copy and Sort

	//$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 . "'");
	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'],'RH' => $products_options['RH'],'LH' => $products_options['LH']);
	  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>
		<table width="100%"  class="product_info_attributs" border="0" align="left" cellspacing="0" cellpadding="0">




		<tr>

		<td class="product_info_attributs_title_line" valign="middle" ><?php echo $products_options_name['products_options_name'] . ''; ?></td>
		<td class="product_info_attributs" valign="middle" align="right">
		<?php if ($products_options_name['products_options_id']=='24' && $Attrib_exist=="true"){?>
		<select id="SelHand" name="SelHand" onChange="getFaceAngleList(this.value)"></select>
		<input type="hidden" name="id[24]" id="id[24]"></td></tr>
		<? } elseif (	$products_options_name['products_options_id']=='6'
				 	 ||	$products_options_name['products_options_id']=='25'
					 ||	$products_options_name['products_options_id']=='26'||
						$products_options_name['products_options_id']=='27'){?>
		<select id="SelLoft" name="SelLoft" onChange="changeDependantAttribute(this.value)"></select>
		<input type="hidden" name="id[<? echo $products_options_name['products_options_id'] ?>]" id="id[<? echo $products_options_name['products_options_id'] ?>]"></td></tr>
		<? }
else {		
		echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array,$selected_attribute);

		}
		?>
<? //<tr><td>Atribut : <? echo [$HTTP_GET_VARS['products_id']]['attributes'];></td></tr> ?>


<td></td>






<td></td>
		</tr>
				<tr>
				<td class="product_info_attributs"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>
				</tr>

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

	<?php
  }
?>




				<tr><td>			
				<table frame="below" width="100%" cellspacing="0" cellpadding="0">
				<tr><td></td></tr>
				</table>					
				</tr></td>			

				<tr>
				<td class="product_info_Price" align="right"><?php echo TRADUC_TARIF; ?><?php echo $products_price; ?></td>
				</tr>

		</table>	


		<table width="77%"  border="0" align="left" cellspacing="0" cellpadding="0">	
		<tr >
		<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		<td class="boxText_justify"><?php echo $product_info['products_description']; ?></td>		
		</tr>
		<tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
		</tr>
		<tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		<td class="boxText"><p><?php echo $product_info['technical_description']; ?></p></td>
		</tr>
		</td>			
		</table>


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

</tr></td>	



  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
$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);
if ($reviews['count'] > 0) {
?>
  <tr>
	<td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}

if (tep_not_null($product_info['products_url'])) {
?>
  <tr>
	<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}

if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
  <tr>
	<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
  </tr>
<?php
} else {
?>
  <tr>
	<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
  </tr>
<?php
}
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></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 class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
			<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td>
<?php
if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
} else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
 }
?>
	</td>
  </tr>
</table></form></td>
<!-- body_text_eof //-->

 </tr>
</table>
<!-- body_eof //-->


<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>

</body>

</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Posted

sorry to knock again but could somebody, at least, tell me if the behaviour of my site is normal or is there a bug occuring ?

 

Thanks

Patrice

Posted
sorry to knock again but could somebody, at least, tell me if the behaviour of my site is normal or is there a bug occuring ?

 

Thanks

Patrice

 

Hi Patrice,

 

no this is not default behaviour. Default is that the attributes get recognized (see the painted4kids page in my profile, lots of drop downs). You are having the correct link in the cart (hover and you should see it bottom left of browser window), but the URLs you are generating lost them. Is this the osC inbuilt search engine safe URLs? That one does have issues ... so if you use it, try to switch it off and all should be well. You might want to try chemo's version of it. I do not use these so no tips on it.

 

BTW, I get a JS error on that page you gave us the link for.

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted

Thanks for your answer Monika.

 

I already have the safe URL version of Chemo.

 

One small question :

 

here is what I use to retrieve the attribute:

 

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']];

....

and further

echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array,$selected_attribute);

 

Is it wrong to do so ?

 

Thanks for your help

Patrice

Posted
Thanks for your answer Monika.

 

I already have the safe URL version of Chemo.

 

One small question :

 

here is what I use to retrieve the attribute:

 

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']];

....

and further

echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array,$selected_attribute);

 

Is it wrong to do so ?

 

Thanks for your help

Patrice

 

you could check the id's of the dropdown items in your source code, and compare with an echo of the $selected_attribute variable ...

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted

Dear Monica,

 

The selected_attribute variable is empty despite the following code :

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;
	$selected_attribute = false;
	}

 

Any idea, where to look for ?

My site is supposed to be offcially launched next week and I would really like to fix this issue, so your help will be greatly appreciated

 

Patrice

you could check the id's of the dropdown items in your source code, and compare with an echo of the $selected_attribute variable ...
Posted

does the info go into the database just fine?

 

I'd next do a check if the echo of

$HTTP_GET_VARS['products_id']

shows something ...

 

I hope someone using that contrib by chemo pops in because the if/else you have there is vanilla, and it is what works just fine for me ...

 

oh and I'd do another test logging in because then the cart is not only in the session but also in the table, nice for debugging ...

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted

The $HTTP_GET_VARS['products_id'] works before and after adding the item to the cart.

Nothing different when I'm logged.

 

Patrice

does the info go into the database just fine?

 

I'd next do a check if the echo of

$HTTP_GET_VARS['products_id']

shows something ...

 

I hope someone using that contrib by chemo pops in because the if/else you have there is vanilla, and it is what works just fine for me ...

 

oh and I'd do another test logging in because then the cart is not only in the session but also in the table, nice for debugging ...

Posted

Can anybody help ?

I'm desperate for an answer as this is the last step before the official launch of the site

 

Thanks

Patrice

Archived

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

×
×
  • Create New...