Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Remove drop down box "i have old code that needs updating"


Recommended Posts

So i found what i finally need to remove the drop down boxes from the product listings. The problem though is the old code that doesent seem to work. If anyone can take a look at it and help out by posting the new code here. please do.

 

I only need the part of removing the drop down box and using plain text to list the attribues

 

 

HERE IS WHAT THE CODE WAS:

 

 

 

 

 

 

This is only to be used if ALL your products are downloadable. It makes the following possible:

 

1. removes the product attribute drop-down box being shown on the product page if product ONLY HAS ONE ATTRIBUTE as most downloads, especially mp3s, have

2. removes the quantity column from the shopping cart - no need for this as it is always one

3. even if the customer clicks to buy the product again the cart will only accept the item once

 

Most of the postings on this matter are quite confusing and complicated. This is simple. Please remember though that without modifications it is not possible to order more than 1 unit of each product.

 

******************************************************************************

1. Hide the drop down box and (if required) the option description (if required)

 

File: \product_info.php

 

approx line 128

 

Comment out this code or remove the table row if you do not want the option names to show up.

<!-- <tr>

<td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>

</tr> -->

 

approx. line 148

 

original code:

 

<tr>

<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>

</tr>

 

new code:

 

 

<?php

//trevs basic mysql query to get the option value ID to avoid having a select box, keeping it tidy

 

$Option_IDNumber_Query = tep_db_query("select options_values_id from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

$Option_IDNumber = tep_db_fetch_array($Option_IDNumber_Query);

$Option_IDNumber = $Option_IDNumber['options_values_id'];

 

// end of query

?>

<tr>

<!-- If you want to display the product option name then uncomment, if not then delete or leave commented

 

<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

 

-->

 

<?php

// trevs drop down menu replacement with a tidy hidden attribute

 

echo '<input type="hidden" name="id[' . $products_options_name['products_options_id'] . ']" value="' . $Option_IDNumber . '">'; ?>

</tr>

 

 

<?php

 

 

******************************************************************************

2. removes the quantity column from the shopping cart

 

\shopping_cart.php

 

Removes the column header

 

approx. line 67

 

remove this:

 

$info_box_contents[0][] = array('align' => 'center',

'params' => 'class="productListing-heading"',

'text' => TABLE_HEADING_QUANTITY);

 

Removes the quantity column

 

approx. line 143

 

original code:

 

$info_box_contents[$cur_row][] = array('align' => 'center',

'params' => 'class="productListing-data" valign="top"',

'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

 

 

 

new code:

 

$info_box_contents[] = array('text' => tep_draw_hidden_field('cart_quantity[]', $products[$i]['quantity'], 'products_id[]', $products[$i]['id']));

 

******************************************************************************

3. Set the amount in the cart to a default of 1 item per order

 

File: \includes\classes\shopping_cart.php approx. line 125

 

original code:

$this->contents[$products_id_string] = array('qty' => $quantity);

 

new code:

$this->contents[$products_id_string] = array('qty' => 1);

 

******************************************************************************

 

There you go, that wasn't difficult was it!

 

Trevor Wilson 09 Feb. 2006

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...