Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product attribute checkbox


Djunity

Recommended Posts

Hi there,

 

I have been searching a week now for a module that does what i want sadly it looks like it doesn't exist.

What i want is that for some attribute sets the selection must be a checkbox say like if you have an attribute set for accesiores so that an costumer can select more options.

 

I did some editing of the osc code and managed to let the attributes to be shown in a verticly checkbox menu but saidly when you select more than one option only one is added to the shopping cart.

 

The code i did is/

 

in catalog/includes/functions/html_output.php i added the following code

 

  function tep_draw_checkbox_field_attrib($name, $values, $default = '', $parameters = '', $required = false) {
$field ='<table border="0" cellspacing="0" cellpadding="0"><tr><td class="main">';   
if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

for ($i=0, $n=sizeof($values); $i<$n; $i++) {
  $value = tep_output_string($values[$i]['id']);
  $field .= '<input type="checkbox" name="' . $name . '" value="' . $value . '"';
	if ($i == 0) if ($i == 0) $field .= ' checked';

  $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '<br>';
}
$field .= '</td></tr></table>';

if ($required == true) $field .= TEXT_FIELD_REQUIRED;

return $field;
 }

 

and in catalog/product_info.php i changed one line of code to

 

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

 

 

Does any one know either an existing contribution that does what i want to do or can some one help me out to fix it so we can make the contibution.

 

Current version can be seen at http://nbm.123hostingservice.nl/product_in...?products_id=44

 

Beste Regards Djunity

Edited by Djunity
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...