Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tep_draw_checkbox_field problem


jGirlyGirl1

Recommended Posts

The problem is that the tep_draw_checkbox_field isn't checked. This is a problem because if the customer views these pages within their account, doesn't make an changes, and clicks continue, their product notifications will be cleared and they will be unsubscribed from the newsletter without even realizing it.

 

I've come across this problem in two places.

 

account_notifications.php

account_newsletters.php

 

In account_newsletters.php, this is the line of code in question:

<?php echo tep_draw_checkbox_field("products[" . $counter . "]", $products["products_id"], true); ?>

The "true' statement means that the checkbox should be checked by default. It's not.

 

The code in html_output.php looks like this:

// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()
 function tep_draw_selection_field($name, $type, $value = '', $checked = false, $compare = '', $parameter = '') {
$selection = '<input type="' . $type . '" name="' . $name . '"';
if ($value != '') {
  $selection .= ' value="' . $value . '"';
}
if ( ($checked == true) || ($GLOBALS[$name] == 'on') || ($value && ($GLOBALS[$name] == $value)) || ($value && ($value == $compare)) ) {
  $selection .= ' CHECKED';
}
if ($parameter != '') {
  $selection .= ' ' . $parameter;
}
$selection .= '>';

return $selection;
 }

////
// Output a form checkbox field
function tep_draw_checkbox_field($name, $value = '', $checked = false, $compare = '', $parameter = '') {
return tep_draw_selection_field($name, 'checkbox', $value, $checked, $compare, $parameter);
 }

 

I also tried entering in a blank value for compare and parameter, like this:

<?php echo tep_draw_checkbox_field("products[" . $counter . "]", $products["products_id"], true, '', ''); ?>

 

Nothing works.

 

In account_newsletters, I was able to change the checkbox to a drop-down, using an array. This fixed the problem there, but I'm not having any luck with product notifications.

 

Can anyone tell what the problem is by looking at this code?

Link to comment
Share on other sites

Am I the only one with this issue?

 

To check if you have this problem:

 

1 - Create a customer account

2 - Subscribe to the newsletter

3 - Go to account_newsletters.php (Subscribe or Unsubscibe from Newsletters)

 

If the box is checked, you do NOT have this problem.

If the box is NOT checked, you do the problem.

 

If you do have the problem, and you click continue as the page instructs, you will be unsubscribed from the newsletter.

 

Any help would be greatly appreciated.

 

Thank you.

Link to comment
Share on other sites

Am I the only one with this issue?

 

To check if you have this problem:

 

1 - Create a customer account

2 - Subscribe to the newsletter

3 - Go to account_newsletters.php (Subscribe or Unsubscibe from Newsletters)

 

If the box is checked, you do NOT have this problem.

If the box is NOT checked, you do the problem.

 

If you do have the problem, and you click continue as the page instructs, you will be unsubscribed from the newsletter.

 

Any help would be greatly appreciated.

 

Thank you.

Jacine,

 

I wouldn't be to hasty in changing all kind of code as this problem must be related to something else with your shop and not the the osC checkbox function.

You should check if you have made any changes in this area for some kind of contribution and also if your sessions are working properly and variables are saved/transferred between pages.

 

regards,

Howard

Link to comment
Share on other sites

Hi Howard,

 

Thank you so much for your response. It turns out I was looking at the wrong file while trying to troubleshoot. I was looking at my admin/functions/html_ouput.php, rather than the /functions/html_output.php.

 

I don't know how I missed this before, but this contribution is the culprit:

Automatic remove button in shopping cart

 

Thanks again!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...