Post by steveopoly » Wed Oct 26, 2011 10:15 am

I have 50 checkboxes that I don't want in one long vertical column. Is there a way make make it 10 x 10?

Newbie

Posts

Joined
Wed Oct 26, 2011 10:03 am

Post by labeshops » Wed Oct 26, 2011 11:00 am

with that many options, I usually switch to a dropdown select instead of checkboxes. Is there some reason you have to use checkboxes? I really think that many is not only a design problem, but confusing for your customers.

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by steveopoly » Thu Oct 27, 2011 6:17 am

I need the customer to pick 5 different options. If I had 5 different dropdowns then they could pick the same options. I am not sure of the exact number of options, but I am thinking 25 now, so 5 x 5 would be best. Any idea on how to customize how the checkboxes appear, so they aren't in one long column?

Newbie

Posts

Joined
Wed Oct 26, 2011 10:03 am

Post by uksitebuilder » Thu Oct 27, 2011 4:59 pm

You will have to play with this to get it looking right for your store, but try the following

open: catalog/view/theme/YOURTHEME/template/product/product.php

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 } ?>
change to

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 $j = 0; foreach ($option['option_value'] as $option_value) { $j++; ?>
          <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>
          <?php if($j==2){ $j=0; ?><br /><?php } ?>
          <?php } ?>
        </div>
        <br />
        <?php } ?>
change the value of $j in the following line to howmany checkboxes to show accross

Code: Select all

          <?php if($j==2){ $j=0; ?><br /><?php } ?>

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by steveopoly » Wed Nov 02, 2011 7:59 am

thanks that did it! do you know how to force the customer to pick a certain number of checkboxes?

Newbie

Posts

Joined
Wed Oct 26, 2011 10:03 am

Post by PaoloS » Mon Apr 20, 2020 3:17 am

I used the code you wrote, but it didn't work. the checkboxes have disappeared. I wanted to tell you that at this positioning "catalog / view / theme / YOURTHEME / template / product /" I found a product.tpl file and not php. I am using opencart version 2.3.0.2. Can you help me make sure that the checkboxes are positioned next to each other so as not to have a long column? Thanks in advance.

Newbie

Posts

Joined
Sat Apr 18, 2020 12:49 am
Who is online

Users browsing this forum: No registered users and 18 guests