If this is your first visit, check our documentation. To post, register or login.
Forums / Templates, Stylesheets, Page Layout / Check Box pre selected

Check Box pre selected

Started by northwoodinc on 5 Jun 2013, 8:17 AM · Views: 811

Results 1 to 5 of 5
5 Jun 2013, 8:17 AM
#1
northwoodinc avatar

northwoodinc

New Zenner

Join Date:
Jun 2013
Location:
United States
Posts:
4
Plugin Contributions:
0

Check Box pre selected

Hello, Hope this is the correct place to ask this question!

I am running Zen-cart 1.5.1 and have installed the Module "Priority Order Handling". When active, it gives an option to add priority shipping at a cost via checking a box. I wanted to know if anyone could tell me how to configure it to default the box checked (pre selected option)

5 Jun 2013, 8:37 AM
#2
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Check Box pre selected

I do no have that plugin currently installed to test but I can give you an example from the /templates/tpl_modules_create_account.php file

code for the Newsletter Checkbox:

<?php echo zen_draw_checkbox_field('newsletter', '1', $newsletter, 'id="newsletter-checkbox"'** . 'checked'**) . '<label class="checkboxLabel" for="newsletter-checkbox">' . ENTRY_NEWSLETTER . '</label>' . (zen_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="alert">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?>

Note: code in red makes it pre-checked!

5 Jun 2013, 8:57 AM
#3
northwoodinc avatar

northwoodinc

New Zenner

Join Date:
Jun 2013
Location:
United States
Posts:
4
Plugin Contributions:
0

Re: Check Box pre selected

rbarbour:

I do no have that plugin currently installed to test but I can give you an example from the /templates/tpl_modules_create_account.php file

code for the Newsletter Checkbox:

<?php echo zen_draw_checkbox_field('newsletter', '1', $newsletter, 'id="newsletter-checkbox"'** . 'checked'**) . '<label class="checkboxLabel" for="newsletter-checkbox">' . ENTRY_NEWSLETTER . '</label>' . (zen_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="alert">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?>

Note: code in red makes it pre-checked!

Thank you for your reply, The codeing is much different in there php files. Here is a snip of the php I was thinking would need to be changed.

function credit_selection()
{
$selected = (($_SESSION['priority_handling'] == '1') ? true : false);
$selection = array(
'id' => $this->code,
'module' => $this->title, 'redeem_instructions' => MODULE_ORDER_TOTAL_PRIORITY_HANDLING_TEXT_DESCR.'<br><br>',
'fields' => array(array(
'field' => zen_draw_checkbox_field('opt_priority_handling', '1', $selected),
'title' => MODULE_ORDER_TOTAL_PRIORITY_HANDLING_TEXT_ENTER_CODE
))
);
return $selection;
}

5 Jun 2013, 9:14 AM
#4
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Check Box pre selected

Northwoodinc:

Thank you for your reply, The codeing is much different in there php files. Here is a snip of the php I was thinking would need to be changed.

function credit_selection()
{
$selected = (($_SESSION['priority_handling'] == '1') ? true : false);
$selection = array(
'id' => $this->code,
'module' => $this->title, 'redeem_instructions' => MODULE_ORDER_TOTAL_PRIORITY_HANDLING_TEXT_DESCR.'<br><br>',
'fields' => array(array(
'field' => zen_draw_checkbox_field('opt_priority_handling', '1', $selected** . 'checked'**),
'title' => MODULE_ORDER_TOTAL_PRIORITY_HANDLING_TEXT_ENTER_CODE
))
);
return $selection;
}

try the above

5 Jun 2013, 10:51 PM
#5
northwoodinc avatar

northwoodinc

New Zenner

Join Date:
Jun 2013
Location:
United States
Posts:
4
Plugin Contributions:
0

Re: Check Box pre selected

rbarbour:

try the above

Worked perfect! Thank you very much! :D