ridesign Posted June 9, 2005 Posted June 9, 2005 I have modified this code but what have i done wrong? I get the error when i remove <?php } ?> it wrecks the rest of my template, it works fine if a attribute is added if not then it doesn't show anything past the product price here is the code: <table width="358" border="0" cellpadding="0" cellspacing="5" background="/dots_s4.gif" bgcolor="#0033FF"> <!--DWLayoutTable--> <tr> <td width="348" align="center" valign="top" bgcolor="#FFFFFF">Price: </b> <?php echo $products_price; ?></td> </tr> <?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 } ?> <?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 . "'"); 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; } ?> <td width="348" align="center" valign="top" bgcolor="#FFFFFF"> <?php echo $products_options_name['products_options_name'] . ''; ?></td> <tr> <td align="center" valign="top" bgcolor="#FFFFFF"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td> </tr> <tr> <td align="center" valign="top" bgcolor="#FFFFFF"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_template_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?> </td> </tr> <tr> <td height="19" align="center" valign="top" bgcolor="#FFFFFF"> <?php 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, " . TABLE_PRODUCTS . " p where p.products_id = '" . $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); $has_manufacturer_name = ($manufacturer_name_values['manufacturers_name']) ? 'true' : 'false'; } ?> <!-- manufacturer_info //--> <?php } if (tep_not_null($manufacturer['manufacturers_name'])) { ?> <?php } ?> Manufacturer: </b><?php echo ($manufacturer['manufacturers_name']); ?> </td> </tr> <tr> <td align="center" valign="top" bgcolor="#FFFFFF"> <?php if (tep_not_null($product_info['products_model'])) { ?> <?php echo sprintf(TEXT_MODEL, ($product_info['products_model'])); ?><?php echo ($product_info['products_model']); ?> <?php } else { } ?> </td> </tr> <tr> </tr> </table> <?php } ?>
user99999999 Posted June 9, 2005 Posted June 9, 2005 PHP is a little tricky like that //All PHP <?php for ($a=0; $a<10; $a++) { echo 'Hello World<br>'; } ?> //Mixed mode PHP/HTML <?php for ($a=0; $a<10; $a++) { ?> Hello World<br> <?php } ?> Really you need a good editor and/or debuger http://www.ultraedit.com http://www.zend.com
Recommended Posts
Archived
This topic is now archived and is closed to further replies.