Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Jul 2011
    Posts
    106
    Plugin Contributions
    0

    Default dropdown to radio buttons

    Hi All,

    After searching and trying to get it to work... i just cannot get either.

    I am using the column grid layout module by Drbyte and would like to change...

    Code:
    echo '<div id="viewControl">' . zen_draw_pull_down_menu('view', array(array('id'=>'rows','text'=>PRODUCT_LISTING_LAYOUT_ROWS),array('id'=>'columns','text'=>PRODUCT_LISTING_LAYOUT_COLUMNS)), (isset($_GET['view']) ? $_GET['view'] : (defined('PRODUCT_LISTING_LAYOUT_STYLE')? PRODUCT_LISTING_LAYOUT_STYLE: 'rows')), 'onchange="this.form.submit()"') . '</div>';
    to radio buttons rather so that I can style them to be icons (it looks much nicer).

    I have tried using: 'zen_draw_radio_field', but not sure if I am placing the right values/code in the right place or if I need to change some settings in the database for radios to work correctly.

    If anyone can help, I would be most greatful.

    thanks,
    jay

  2. #2
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: dropdown to radio buttons

    Quote Originally Posted by 4jDesigns View Post
    Hi All,

    After searching and trying to get it to work... i just cannot get either.

    I am using the column grid layout module by Drbyte and would like to change...

    Code:
    echo '<div id="viewControl">' . zen_draw_pull_down_menu('view', array(array('id'=>'rows','text'=>PRODUCT_LISTING_LAYOUT_ROWS),array('id'=>'columns','text'=>PRODUCT_LISTING_LAYOUT_COLUMNS)), (isset($_GET['view']) ? $_GET['view'] : (defined('PRODUCT_LISTING_LAYOUT_STYLE')? PRODUCT_LISTING_LAYOUT_STYLE: 'rows')), 'onchange="this.form.submit()"') . '</div>';
    to radio buttons rather so that I can style them to be icons (it looks much nicer).

    I have tried using: 'zen_draw_radio_field', but not sure if I am placing the right values/code in the right place or if I need to change some settings in the database for radios to work correctly.

    If anyone can help, I would be most greatful.

    thanks,
    jay
    What about posting the code that you are trying to use so able to provide guidance on what is wrong?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jul 2011
    Posts
    106
    Plugin Contributions
    0

    Default Re: dropdown to radio buttons

    This is the code I tried using:

    Code:
    <div class="listRadio">
    <?php
    echo zen_draw_pull_down_menu('view', array(array('id'=>'rows','text'=>PRODUCT_LISTING_LAYOUT_ROWS)), (isset($_GET['view']) ? $_GET['view'] : (defined('PRODUCT_LISTING_LAYOUT_STYLE')? PRODUCT_LISTING_LAYOUT_STYLE: 'rows')), 'onchange="this.form.submit()"'); 
    ?>
    </div>
    <div class="gridRadio">
    <?php
    echo zen_draw_pull_down_menu('view', array(array('id'=>'columns','text'=>PRODUCT_LISTING_LAYOUT_COLUMNS)), (isset($_GET['view']) ? $_GET['view'] : (defined('PRODUCT_LISTING_LAYOUT_STYLE')? PRODUCT_LISTING_LAYOUT_STYLE: 'columns')), 'onchange="this.form.submit()"'); 
    ?>
    </div>
    I was trying to compare what I had found:

    zen_draw_pull_down_menu( $name, $values, [ $default = ''], [ $parameters = ''], [ $required = false])

    zen_draw_radio_field( $name, [ $value = ''], [ $checked = false], [ $parameters = ''])

    but after playing around i.e. experimenting with what PHP skills I do have, thought I was not quite getting what I was hoping.

  4. #4
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: dropdown to radio buttons

    Quote Originally Posted by 4jDesigns View Post
    This is the code I tried using:

    Code:
    <div class="listRadio">
    <?php
    echo zen_draw_pull_down_menu('view', array(array('id'=>'rows','text'=>PRODUCT_LISTING_LAYOUT_ROWS)), (isset($_GET['view']) ? $_GET['view'] : (defined('PRODUCT_LISTING_LAYOUT_STYLE')? PRODUCT_LISTING_LAYOUT_STYLE: 'rows')), 'onchange="this.form.submit()"'); 
    ?>
    </div>
    <div class="gridRadio">
    <?php
    echo zen_draw_pull_down_menu('view', array(array('id'=>'columns','text'=>PRODUCT_LISTING_LAYOUT_COLUMNS)), (isset($_GET['view']) ? $_GET['view'] : (defined('PRODUCT_LISTING_LAYOUT_STYLE')? PRODUCT_LISTING_LAYOUT_STYLE: 'columns')), 'onchange="this.form.submit()"'); 
    ?>
    </div>
    I was trying to compare what I had found:

    zen_draw_pull_down_menu( $name, $values, [ $default = ''], [ $parameters = ''], [ $required = false])

    zen_draw_radio_field( $name, [ $value = ''], [ $checked = false], [ $parameters = ''])

    but after playing around i.e. experimenting with what PHP skills I do have, thought I was not quite getting what I was hoping.
    So, here's what I get from what I see above, what I am familiar with (without booting up a computer), and what I seem to "sense":
    zen_draw_pull_down_menu appears to provide a drop down menu... Not a list of radio buttons. If I am not mistaken, it is desired to display radio buttons then you would need to call a radio function or the drop down menu code would need to recognize that it should present radios instead of whatever it is providing for the conditions where you would want radio buttons instead. Beyond that, the attempted code doesn't provide enough information to the function to obtain useful results.

    I would suggest looking at how attributes display in radio button fashion including how to make one required to be selected. Also there is at least one plugin out there that displays images next to a radio or checkbox attribute list. Perhaps something related could be found in one of those.

    Further beyond that, each entry/radiobutton object would need to have an image assigned to it at the parameter level I believe. Or it might be the values level to then possibly be assigned to a parameter depending on how the code splits out the information; however, seems to me that an image is an extra piece of information not typically required for a selection.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Jul 2011
    Posts
    106
    Plugin Contributions
    0

    Default Re: dropdown to radio buttons

    Sorry, just saw my code and it is supposed to be calling the radio function... this is what I meant:

    Code:
    <div class="listRadio">
    <?php
    echo zen_draw_radio_field('view', array(array('id'=>'rows','text'=>PRODUCT_LISTING_LAYOUT_ROWS)), (isset($_GET['view']) ? $_GET['view'] : (defined('PRODUCT_LISTING_LAYOUT_STYLE')? PRODUCT_LISTING_LAYOUT_STYLE: 'rows')), 'onchange="this.form.submit()"'); 
    ?>
    </div>
    <div class="gridRadio">
    <?php
    echo zen_draw_radio_field('view', array(array('id'=>'columns','text'=>PRODUCT_LISTING_LAYOUT_COLUMNS)), (isset($_GET['view']) ? $_GET['view'] : (defined('PRODUCT_LISTING_LAYOUT_STYLE')? PRODUCT_LISTING_LAYOUT_STYLE: 'columns')), 'onchange="this.form.submit()"'); 
    ?>
    </div>
    But anyway, will definitely take on your idea of looking at the attributes method.

    Thanks.

  6. #6
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: dropdown to radio buttons

    Quote Originally Posted by 4jDesigns View Post
    Sorry, just saw my code and it is supposed to be calling the radio function... this is what I meant:

    Code:
    <div class="listRadio">
    <?php
    echo zen_draw_radio_field('view', array(array('id'=>'rows','text'=>PRODUCT_LISTING_LAYOUT_ROWS)), (isset($_GET['view']) ? $_GET['view'] : (defined('PRODUCT_LISTING_LAYOUT_STYLE')? PRODUCT_LISTING_LAYOUT_STYLE: 'rows')), 'onchange="this.form.submit()"'); 
    ?>
    </div>
    <div class="gridRadio">
    <?php
    echo zen_draw_radio_field('view', array(array('id'=>'columns','text'=>PRODUCT_LISTING_LAYOUT_COLUMNS)), (isset($_GET['view']) ? $_GET['view'] : (defined('PRODUCT_LISTING_LAYOUT_STYLE')? PRODUCT_LISTING_LAYOUT_STYLE: 'columns')), 'onchange="this.form.submit()"'); 
    ?>
    </div>
    But anyway, will definitely take on your idea of looking at the attributes method.

    Thanks.
    Don't know if the problem got resolved or not. If it did, please post the solution. If not, I haven't looked up the standard way to attach a photo to radio button (ie. Internet search for identifying an image associated with a radio button): however, if it is something that can be in the declaration statement, then it would go in the portion of the coded line between the apostrophes of 'onchange="this.form.submit()"', otherwise would need to pre-declare/assign the image as part of the echo statement outside of the zen_draw function.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. Option Values Dropdown displays as Radio Buttons
    By princessatron in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 26 Sep 2011, 02:47 AM
  2. Attributes dropdown or radio buttons not wronging
    By cshart in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 15 Aug 2010, 09:45 PM
  3. Attribute Showing As Radio Set For Dropdown
    By LoveToBeCraftin in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 21 Aug 2008, 03:30 PM
  4. Adding attributes as dropdown gives radio buttons
    By marksu in forum Setting Up Categories, Products, Attributes
    Replies: 7
    Last Post: 24 Nov 2007, 01:29 PM
  5. Adding Radio Buttons
    By slabadoo in forum General Questions
    Replies: 2
    Last Post: 2 May 2007, 03:52 PM

Posting Permissions

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