Post by ssjal » Tue Nov 15, 2011 12:32 pm

Using opencart_v1.5.1.1
while setting the product options, the options are displayed in a single column. can we set the options to appear in multiple columns. eg: if we have total 9 options, after displaying 1-3 options in 1st column, options 4-6 are displayed in 2nd column and 7-9 are displayed in 3rd column.

Thanks

Attachments

options.jpg

options.jpg (14.28 KiB) Viewed 7037 times


New member

Posts

Joined
Thu Sep 17, 2009 4:45 pm

Post by ssjal » Fri Nov 25, 2011 4:18 pm

i tried to display options in multiple columns. The following code is only for checkbox and do not apply to other options like radio.

here edit "$cols = 5;" to number of columns you want to have

catalog > view > theme > default > template > product > product.tpl
Find:

Code: Select all

        <?php if ($option['type'] == 'checkbox') { ?>
        <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
          <?php if ($option['required']) { ?>
          <span class="required">*</span>
          <?php } ?>
          <b><?php echo $option['name']; ?>:</b><br />
          <?php foreach ($option['option_value'] as $option_value) { ?>
          <input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
          <label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"> <?php echo $option_value['name']; ?>
            <?php if ($option_value['price']) { ?>
            (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
            <?php } ?>
          </label>
          <br />
          <?php } ?>
        </div>
        <br />
        <?php } ?>
Replace with:

Code: Select all

        <?php if ($option['type'] == 'checkbox') { ?>
        <div id="option-<?php echo $option['product_option_id']; ?>" class="option">        
        <?php if ($option['required']) { ?>
        <span class="required">*</span>
        <?php } ?>
        <b><?php echo $option['name']; ?>:</b><br />
        <? 
        $cols = 5;
		$c = 1;
		?>
        <table border="0" cellspacing="0" cellpadding="0">
  <tr>
  <?php foreach ($option['option_value'] as $option_value) { ?>
    <td>
              <input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
          <label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"> <?php echo $option_value['name']; ?>
            <?php if ($option_value['price']) { ?>
            (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
            <?php } ?>
          </label> &nbsp;&nbsp;
    </td>
       <? 
          if ($c == $cols) {
            echo "</tr><tr><td height='5'></td></tr><tr>";
            $c = 1;
        } else { $c++; }
      ?> <?php } ?>
  </tr>         
</table>     
        </div>
        <br />
        <?php } ?>

New member

Posts

Joined
Thu Sep 17, 2009 4:45 pm

Post by jonesofmaine » Tue Apr 17, 2012 9:20 pm

Thank you VERY VERY much!

Karen

New member

Posts

Joined
Wed Mar 14, 2012 2:28 am

Post by jonesofmaine » Tue Apr 17, 2012 9:25 pm

also M. ssjal,

will using this for checkboxes, affect other options listed as radio or text? Also: list of options with 2 checkbox and 10 radio and 2 text box - what happens on this Product Page?

Thank you,
k

New member

Posts

Joined
Wed Mar 14, 2012 2:28 am

Post by OpusVista » Sun Dec 09, 2012 12:58 am

Hello!
Is there a fix for radio?

Newbie

Posts

Joined
Sun Dec 09, 2012 12:56 am

Post by djkfunk » Wed Nov 06, 2013 3:04 pm

works on 1.5.6 thanks!

Newbie

Posts

Joined
Thu Sep 15, 2011 10:19 pm

Post by rasheedraj » Wed Mar 01, 2017 7:14 pm

my site is in Open Cart 2.3.0.2, i want make these options in Grid View, how can I?

Attachments

error.jpg

error.jpg (234.76 KiB) Viewed 4701 times


New member

Posts

Joined
Sat Apr 02, 2016 3:05 pm
Who is online

Users browsing this forum: No registered users and 191 guests