Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2012
    Location
    South West UK
    Posts
    17
    Plugin Contributions
    0

    Default zen_draw_checkbox_field - how do I get my custom field to show selection in checkbox?

    Hi guys

    I recently added some new fields to my admin product info page. I have four fields - two of them are checkboxes. All are working fine. I can view them frontend too, and have customised it exactly how I need it, thanks to this awesome forum and its generous users, documenting their work.

    I can get the checkbox values to apply to the database, but when revisiting the product, the checkbox state is not observed. eg the box is no longer checked (value 0) even though the db states value 1. Not good.

    I suppose I need to store the checkbox state as a new variable and use it, but how? Here's my code for one checkbox, which is a yes/no 1/0 answer.

    PHP Code:
    <tr>
    <td class="main"><?php echo 'Organic '?></td>
    <td class="main"><?php echo zen_draw_checkbox_field('products_organic''1', (($pinfo->fields['products_organic'] == '1') ? true false), 'id="products_organic"') . "Organic"?><br /></td>
    </tr>
    Trial and error got me this far - I'm soooo close to completion its paining me! Anyone?

    Thanks guys.

  2. #2
    Join Date
    Jan 2012
    Location
    South West UK
    Posts
    17
    Plugin Contributions
    0

    Default Re: zen_draw_checkbox_field - how do I get my custom field to show selection in check

    Bump - can nobody show me how to retrieve the checkbox status from the DB and mark accordingly?

  3. #3
    Join Date
    Oct 2007
    Posts
    146
    Plugin Contributions
    0

    Default Re: zen_draw_checkbox_field - how do I get my custom field to show selection in check

    Quote Originally Posted by johnlewisdesign View Post
    Bump - can nobody show me how to retrieve the checkbox status from the DB and mark accordingly?
    what happens if you change to this: (not an expert by any means, but my custom fields and all other fields on page use $pinfo->xxxxx instead of $pinfo->fields['xxxxx']

    PHP Code:
    <tr>
    <td class="main"><?php echo 'Organic '?></td>
    <td class="main"><?php echo zen_draw_checkbox_field('products_organic''1', (($pinfo->products_organic == '1') ? true false), 'id="products_organic"') . "Organic"?><br /></td>
    </tr>

 

 

Similar Threads

  1. CheckBox Maximum Selection
    By phoenix80 in forum Setting Up Categories, Products, Attributes
    Replies: 9
    Last Post: 16 May 2011, 09:33 AM
  2. Adding a custom checkbox to sign-up form
    By LarryDavidson in forum Customization from the Admin
    Replies: 0
    Last Post: 16 Jun 2009, 04:11 PM
  3. Attributes selection field in Admin
    By travellers in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 9 Feb 2009, 10:00 PM
  4. How to force selection of a checkbox?
    By karma-lab in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 5 Jun 2008, 07:09 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •