Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Loginbox form missing


FridayNight

Recommended Posts

Posted

Hi, I have a strange problem and I have no idea what is wrong.

Since I was working on my shop the last days I cannot tell what could have caused this.

 

The Problem:

I have a loginbox in the right column and when I enter a testaccount name and password and press the submit button I am not logged in but just redirected to the same page, like nothing happend.

The source code of the loginbox:

<!-- loginbox //-->
<?php
if (!tep_session_is_registered('customer_id')){
?>		  
<div class="column_r">
<div class="column_header">
	<div class="column_header_none"><h4><?php echo BOX_LOGINBOX_HEADING;?></h4></div>
</div>
<form name="login" method="post" action="<?php echo tep_href_link(FILENAME_LOGIN, 'action=process'); ?>">
<ul>
	<li><b><?php echo tep_box_greeting_top(); ?></b></li>
	<li><?php echo BOX_LOGINBOX_EMAIL; ?></li>
	<li><input type="text" name="email_address" maxlength="96" size="20" value=""></li>
	<li><?php echo BOX_LOGINBOX_PASSWORD; ?><a href="<?php echo tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'NONSSL'); ?>"><?php echo  BOX_LOGINBOX_FORGOT_PASSWORD; ?></a></li>
	<li><input type="password" name="password" maxlength="40" size="20" value=""></li>
	<li><?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?></li>
	<li><?php echo BOX_LOGINBOX_NEW; ?></li>
</ul>
</form>
</div>
<?php
 } 
else {
// If you want to display anything when the user IS logged in, put it
// in here...  Possibly a "You are logged in as :" box or something.
}
?>
<!-- loginbox_eof //-->

 

The problem seems to be the form, because if I look at the source code from the loginbox in my browser following code is generated with the missing form-tag:

 

<!-- loginbox //-->


<div class="column_r">
<div class="column_header">
	<div class="column_header_none"><h4>Kunden Login</h4></div>
</div>

<ul>
	<li><b>Willkommen Gast<br><br></b></li>
	<li>E-Mail Adresse:</li>

	<li><input name="email_address" maxlength="96" size="20" value="" type="text"></li>
	<li>Passwort:<a href="http://www.tools4golf.de/password_forgotten.php"><i>(Passwort vergessen?)</i></a></li>
	<li><input name="password" maxlength="40" size="20" value="" type="password"></li>
	<li><input src="includes/languages/german/images/buttons/button_login.gif" alt="Anmelden" title=" Anmelden " type="image"></li>
	<li>Noch kein Kundenkonto?<br><a href="https://ssl-id.de/tools4golf.de/create_account.php?osCsid=50c5fab84480ba03e7921743dbafd470"><u><b>Hier</b></u> klicken um ein neues Kundenkonto zu erstellen.</a></li>
</ul>


</div>
<!-- loginbox_eof //-->

 

 

I have no idea why there is no form tag anymore and how to fix this....

 

Any idea could help!

Posted

... still working on this problem.

 

I found out that I can login from the loginbox in the left column when I have an item in my basket. If there is no item I cannot login from the loginbox, just from the normal login page....

 

maybe now somebody a clue?

Posted

and so I compared the code in the browser and it is like I said the form element is the problem!

 

so with an item in the cart I have the usual:

 

<form name="login" method="post" action="http://www.mydomain.de/login.php?action=process"> ... </form>

 

and if there is no item in the cart this tag is missing and so the login not working.

 

I really would like solve this riddle...

Posted

ok I am getting closer now...

 

it looks like the shopping cart box above is involved. When I remove it from the column right the login is working!

 

here ist the code of the shopping cart box, maybe somebody spot the error:

 

<!-- shopping_cart //-->

<div class="column_r">
<div class="column_header">
	<div class="column_header_right"><h4><?php echo BOX_HEADING_SHOPPING_CART;?></h4></div>
</div>

<script type="text/javascript" src="includes/boxes/rollovers.js"></script>
<script type="text/javascript">
// <![CDATA[
function decrement(index) {
if(document.forms["cart_box"].elements["cart_quantity[]"][index].value >1) {
  document.forms["cart_box"].elements["cart_quantity[]"][index].value--;
  document.cart_box.submit();
}
}
function increment(index) {
  document.forms["cart_box"].elements["cart_quantity[]"][index].value++;
  document.cart_box.submit();
}
function mark(pid) {
  document.forms["remove_product"].elements["cart_delete[]"][0].value=pid;
  document.forms["remove_product"].elements["products_id[]"][0].value=pid;
  document.remove_product.submit();
}
var sURL = document.URL.toString();
if (sURL.indexOf("?") > 0){
urlsplitter = '';
} else {
urlsplitter = '?';
}
document.write('<form ');
document.write(' name="remove_product" ');
document.write(' action="' + document.URL + urlsplitter + '&action=update_product"');
document.write(' method="post">');
//one element is not an array so add 2 of each!
document.write('<input type="hidden" name="products_id[]">');
document.write('<input type="hidden" name="cart_delete[]">');
document.write('<input type="hidden" name="products_id[]">');
document.write('<input type="hidden" name="cart_delete[]">');
document.write('<\/form>');
document.write('<form ');
document.write(' name="cart_box" ');
document.write(' action="' + document.URL + urlsplitter + '&action=update_product"');
document.write(' method="post">');
// ]]>
</script>

<?php
if ($cart->count_contents() > 0) {
$any_out_of_stock = 0;
$products = $cart->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
// Push all attributes information in an array
	if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
		while (list($option, $value) = each($products[$i]['attributes'])) {
			echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
			$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $products[$i]['id'] . "' and pa.options_id = '" . $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
			$attributes_values = tep_db_fetch_array($attributes);
			$products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
			$products[$i][$option]['options_values_id'] = $value;
			$products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
			$products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
			$products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
		}
	}
}
//Build the infobox...
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
	$cur_row = sizeof($info_box_contents);
	if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
		$style_text = '<span class="newItemInCart">';
	} else {
		$style_text ='<span class="infoBoxContents">';
	}
//Product Details First...
	$products_name = '<li><a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], '30', '' , 'class="imgframe" align="right"') . '</a><a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products[$i]['id']) . '"><b>'  . $style_text . $products[$i]['name'] . '</span></b></a>';
//--Add any attributes...
	if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
		reset($products[$i]['attributes']);
		while (list($option, $value) = each($products[$i]['attributes'])) {
			$products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
		}
	}
  $products_name .= '</li>';
//Now build the Quantity form...
//--Make sure we have a form array...one element is not an array and
//--javascript doesn't like elements with [] so add some extra fields if there is only one product in the cart!
	if (sizeof($products)==1){
		$j =$i+1;
		$extra_elements = tep_draw_hidden_field('cart_quantity[]', $products[$i]['quantity']) . tep_draw_hidden_field('products_id[]', $products[$i]['id']);
	} else {
		$j =$i;
		$extra_elements = '';
	}
	$products_form ='<li>' . $extra_elements . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'class="quantitybox"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']) . ' <a href="java script:void(increment('. $j . '));" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'document.up' . $i . '\',\'document.up' . $i . '\',\'images/btn-up-ov.gif\')" ><img name="up' . $i . '" src="images/btn-up.gif" alt="+"></a><a href="java script:void(decrement('. $j . '));" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'document.dn' . $i . '\',\'document.dn' . $i . '\',\'images/btn-dn-ov.gif\')" ><img name="dn' . $i . '" src="images/btn-dn.gif" alt="-"></a> ' . $currencies->display_price2($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</li><li style="text-align:right;"><a href="java script:void(mark(\'' . $products[$i]['id'] . '\'));" class="removeProduct"><small>' . TABLE_HEADING_REMOVE . ' <img src="images/remove.gif" height="8" width="8" alt="löschen"></small></a></li><li>' . tep_draw_separator('pixel_silver.gif') . '</li>';
	$cart_contents .= $products_name . $products_form;
}
//Finally, add the total...
	$total = '<li>' . tep_draw_separator('pixel_silver.gif') . '</li><li><small>Zwischensumme: </small>' . $currencies->format($cart->show_total()) . '<br><div class="tax_info">inkl. 19% MwSt<br>zzgl. <a href="http://www.tools4golf.de/shipping.php" class="tax_info"><u>Versandkosten</u></a></div></li>';
	$cart_contents .= $total;
	echo '<ul>' . $cart_contents . '</ul>';
?>
<script type="text/javascript">
// <![CDATA[
document.write('<\/form>');
// ]]>
</script>
<?php
} else {
echo '<ul><li class="column_li_center">'. BOX_SHOPPING_CART_EMPTY .'</li></ul>';
 }
?>
<table width="174" border="0" style="font-size:11px;">
<tr>
	<td width="50%" align="center"><a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" title="Zum Warenkorb">Warenkorb<br><img src="images/icons/cart_in.gif" alt="<?php echo HEADER_TITLE_CART_CONTENTS; ?>"></a></td>
	<td width="50%" align="center"><a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" title="Zur Kasse">Kasse<br><img src="images/icons/cart_out.gif" alt="<?php echo HEADER_TITLE_CHECKOUT; ?>"></a></td>
</tr>
</table>
</div>
<!-- shopping_cart_eof //-->

Posted

.... solved!

 

it was the shopping cart box .... the javascript document.write('<\/form>'); had to be at the end of the box.... :D

Archived

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

×
×
  • Create New...