sasha23 Posted June 4, 2008 Posted June 4, 2008 hello i wanted to rearrange things on the product_info.php page but messed up couple of things. here is some code: <?php if (tep_not_null($product_info['products_image'])) { ?> <table cellspacing="0" cellpadding="0" border="0" class="product"> <tr><td> <table cellspacing="0" cellpadding="0" border="0"> <tr><td height="100%"> <table cellpadding="0" cellspacing="0" border="0" align="left" class="prod_info2"> <tr><td><em><?php echo $products_name; ?></em></td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td rowspan="2"> <?php echo stripslashes($product_info['products_description']); ?></td> <td> </td> <td rowspan="4"><?php if ($product_info['products_image_med']!='') { $new_image = $product_info['products_image_med']; $image_width = MEDIUM_IMAGE_WIDTH; $image_height = MEDIUM_IMAGE_HEIGHT; } else { $new_image = $product_info['products_image']; $image_width = SMALL_IMAGE_WIDTH; $image_height = SMALL_IMAGE_HEIGHT;}?> <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image_med']) . '" rel="lightbox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], ULT_THUMB_IMAGE_WIDTH, ULT_THUMB_IMAGE_HEIGHT, 'hspace="1" vspace="1"') . '<br>' . tep_image_button('image_enlarge.gif', TEXT_CLICK_TO_ENLARGE) . '</a>'; ?> <span class="productSpecialPrice"><br><?=$products_price?> </span> <?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) { ?> <table cellpadding="0" cellspacing="0" class="box_width_cont product"> <?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; } ?> <tr> <td ><?php echo $products_options_name['products_options_name'] . ':'; ?></td> <td ><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td> </tr> <?php } ?> </table><br> <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_add_to_cart1.png', IMAGE_BUTTON_IN_CART); ?> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> </td></tr> </table> </td> </tr> </table> <?php } ?> <?php } ?> <?php // BOF MaxiDVD: Modified For Ultimate Images Pack! if (ULTIMATE_ADDITIONAL_IMAGES == 'enable') { include(DIR_WS_MODULES . 'additional_images.php'); } // EOF MaxiDVD: Modified For Ultimate Images Pack! ; ?> not this is suppose to do this: As you can see when i have attributes the buy now button is displayed. but for product without attributes the button is gone. can someone help?i guess i deleted some code.thanks
dmnalven Posted June 4, 2008 Posted June 4, 2008 The code above is very difficult to follow. Just make certain that: <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_add_to_cart1.png', IMAGE_BUTTON_IN_CART); ?> is outside of the control structure: if ($products_attributes['total'] > 0) { An editor that automatically highlights structures and/or opening and closing brackets comes in very handy here. For ALL problems, please review this link first -> osCommerce Knowledge Base
sasha23 Posted June 4, 2008 Author Posted June 4, 2008 solved it somehow..don't know how..it seems i had deleted a ?> or a <?php thanks
dmnalven Posted June 4, 2008 Posted June 4, 2008 nevermind For ALL problems, please review this link first -> osCommerce Knowledge Base
Recommended Posts
Archived
This topic is now archived and is closed to further replies.