Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

What am I doing wrong


Darklings

Recommended Posts

Hi, can someone tell me what i'm doing wrong here?

 

(This is just an ex.)

 

Say i got:

 

$lc_text = '<table><tr><td>some words</td><tr></table>';

 

is it correct then to do:

 

$lc_text = '<table><tr>';

$lc_text .= '<td>some words</td>';

$ls_text .= '<tr></table>';

 

maybe you ask yourself why want he to do this.. simple:

 

$lc_text = '<table><tr>';

if(someconditions) {

$lc_text .= '<td>some words</td>';

} else {

$lc_text .= '<td>some other words</td>';

}

$ls_text .= '<tr></table>';

 

Get the point?

Is this something that normaly should work? I cant find anything in php.net about this - or i simply dont know where to search as it gives strange results when i search for ".="

 

The problem is -i have done that a couple of times - and it works great ...

But now i wanted to do it again - so cut some code from above my if statement - to make another one - and now my tables colapsed... my td - tr en table all look messed up....

 

Anyone has an idea? pls... i'm sure this wont take up long - but i'm been searching for a whole day now :(

 

Kind Regards,

Tom

Even in this dark place, yes, I am afraid of my own shadow.

 

 

 

Contributions | KnowledgeBase | osCommerce 2.2 pdf

Link to comment
Share on other sites

roflmao... okey - must have slipped in whyle typing my example fast - but realy - there are no typos in mine - everything works fine - and to get rid of the type thing -i'll just post it here - pls take a look...

 

$lc_text = '<table border="0" cellpadding="1" cellspacing="0" bgcolor="#660033">
						<tr>
							<td>' . tep_draw_form('cart_quantity', tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=add_product'),'post','target="_top"') . '
								<table border="1" cellpadding="0" cellspacing="0" bgcolor="#E4E5E6" width="550">
									<tr>
										<td colspan="4" align="center" width="100"><font size="+1">' . $listing[$x]['products_name'] . '</font></td>
									</tr>
									<tr>
										<td colspan="3">' . stripslashes($listing[$x]['products_description']) . '</td>
										<td class="pageHeading" align="right" valign="top"><font size="+2">' . $lc_text = $pf->getPriceStringShort() . '</font></td>
									</tr>
									<tr>
									<td colspan="2">';

$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing[$x]['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) {

   $lc_text .= '<table border="0" cellspacing="0" cellpadding="2">
		<tr>
		  <td class="main" colspan="2">' . TEXT_PRODUCT_OPTIONS . '</td>
		</tr>';

  $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='" . $listing[$x]['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();
	// aanpassing attrib sort: original osC-Code : $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 from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $listing[$x]['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.attribute_sort");
	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;
	}

 $lc_text .='<tr>
		  <td class="main">' . $products_options_name['products_options_name'] . ':</td>
		  <td class="main">' . tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . '</td>
		</tr>';

  }

 $lc_text .='</table>';

  }
$lc_text .='
</td>
									<!-- form field mist hier; eindtag form paar regels verderop neergezet -->
									<td align="right">Hoeveelheid : ' . tep_draw_form('buy_now_'. $listing[$x]['products_id'], tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort','page')) . 'action=buy_now&products_id='. $listing[$x]['products_id']), 'post') .  tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="2"') . '</td>
									<td width="80" align="center">' . (($listing[$x]['products_price'] > 0) ?  tep_draw_hidden_field('products_id', $listing[$x]['products_id']) . tep_image_submit('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ' : ' ') . '<br> </form></td>
									</tr>
								</table>
							</td>
						</tr>
					</table>';

 

 

 

 

Just to make sure - the above code works perfect.

BUT...

 

If i change the first part - meaning this:

 

			$lc_text = '<table border="0" cellpadding="1" cellspacing="0" bgcolor="#660033">
						<tr>
							<td>' . tep_draw_form('cart_quantity', tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=add_product'),'post','target="_top"') . '
								<table border="1" cellpadding="0" cellspacing="0" bgcolor="#E4E5E6" width="550">
									<tr>
										<td colspan="4" align="center" width="100"><font size="+1">' . $listing[$x]['products_name'] . '</font></td>
									</tr>
<tr>
										<td colspan="3">' . stripslashes($listing[$x]['products_description']) . '</td>
										<td class="pageHeading" align="right" valign="top"><font size="+2">' . $lc_text = $pf->getPriceStringShort() . '</font></td>
									</tr>
									<tr>
									<td colspan="2">';

 

 

To this:

 

			$lc_text = '<table border="0" cellpadding="1" cellspacing="0" bgcolor="#660033">
						<tr>
							<td>' . tep_draw_form('cart_quantity', tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=add_product'),'post','target="_top"') . '
								<table border="1" cellpadding="0" cellspacing="0" bgcolor="#E4E5E6" width="550">
									<tr>
										<td colspan="4" align="center" width="100"><font size="+1">' . $listing[$x]['products_name'] . '</font></td>
									</tr>';
									$lc_text .= '<tr>
										<td colspan="3">' . stripslashes($listing[$x]['products_description']) . '</td>
										<td class="pageHeading" align="right" valign="top"><font size="+2">' . $lc_text = $pf->getPriceStringShort() . '</font></td>
									</tr>
									<tr>
									<td colspan="2">';

 

Then all my tables colapse and looks realy strange - my td's - tr's en table gets shuffled...

 

any feedback is welcome.. i'm getting disperate....

 

Kind Regards,

Tom

Even in this dark place, yes, I am afraid of my own shadow.

 

 

 

Contributions | KnowledgeBase | osCommerce 2.2 pdf

Link to comment
Share on other sites

Tom,

$lc_text .= '<tr>
<td colspan="3">' . stripslashes($listing[$x]['products_description']) . '</td>
<td class="pageHeading" align="right" valign="top"><font size="+2">' . $lc_text = $pf->getPriceStringShort() . '</font></td>
</tr>
<tr>
<td colspan="2">';

I think you go wrong with using twice $lc_text.

I would say it should be:

$lc_text .= '<tr>
<td colspan="3">' . stripslashes($listing[$x]['products_description']) . '</td>
<td class="pageHeading" align="right" valign="top"><font size="+2">' . $pf->getPriceStringShort() . '</font></td>
</tr>
<tr>
<td colspan="2">';

Link to comment
Share on other sites

Tom,

$lc_text .= '<tr>
<td colspan="3">' . stripslashes($listing[$x]['products_description']) . '</td>
<td class="pageHeading" align="right" valign="top"><font size="+2">' . $lc_text = $pf->getPriceStringShort() . '</font></td>
</tr>
<tr>
<td colspan="2">';

I think you go wrong with using twice $lc_text.

I would say it should be:

$lc_text .= '<tr>
<td colspan="3">' . stripslashes($listing[$x]['products_description']) . '</td>
<td class="pageHeading" align="right" valign="top"><font size="+2">' . $pf->getPriceStringShort() . '</font></td>
</tr>
<tr>
<td colspan="2">';

 

 

Hi JanZ,

 

Thnx - i'm ashamed now :$ cause i just found out to :s how could i overlook that :s

 

But thank you verry much for having a look - and thanks to all others too

 

kind regards,

Tom

Even in this dark place, yes, I am afraid of my own shadow.

 

 

 

Contributions | KnowledgeBase | osCommerce 2.2 pdf

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...