I have 50 checkboxes that I don't want in one long vertical column. Is there a way make make it 10 x 10?
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.
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?
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
change to
change the value of $j in the following line to howmany checkboxes to show accross
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 } ?>
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 } ?>
Code: Select all
<?php if($j==2){ $j=0; ?><br /><?php } ?>
thanks that did it! do you know how to force the customer to pick a certain number of checkboxes?
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.
Who is online
Users browsing this forum: No registered users and 32 guests