Page 1 of 1

Remove Option Title when options = 0

Posted: Thu Apr 25, 2013 9:05 am
by KatGirl
Hi all

I'm trying to find a solution to remove the Option Name if the product options = 0 of a particular option. By default, OC removes the options but not the Title itself, which doesn't make any sense. ???

For example:
I have checkboxes enabled for my product options. I created : 'Stock Options' for my option, and then created S, M, L, etc.... for my product options.

This works great, but when I have zero qty & zero product option qty for any given product, the product options (S, M, L, etc) are removed from the single product page but the actual Option Title Name is not.

I need to remove this. Can someone explain how I do this please?

Thanks in advance.

Re: Remove Option Title when options = 0

Posted: Thu Apr 25, 2013 7:45 pm
by labeshops
It does remove it on mine. Perhaps it is a template issue?

Check your template.tpl file.

Make sure

Code: Select all

<?php echo $text_option; ?>
is inside the option if statements

Code: Select all

       <?php if ($options) { ?>
. Sounds like it might be outside the if statement for some reason.

Re: Remove Option Title when options = 0

Posted: Thu Apr 25, 2013 9:47 pm
by KatGirl
I did check before I posted this help request. :-)
The template has the Option Title Name inside both

Code: Select all

<?php if ($options) { ?>
<?php foreach ($options as $option) { ?>
and yet it still shows up. Any suggestions?

Re: Remove Option Title when options = 0

Posted: Thu Apr 25, 2013 9:58 pm
by KatGirl
Specially, here is the code in question:

Code: Select all

 <!-- .start options -->
<?php if ($options) { ?>
<div class="options">										
<div class="contentset"><b style="display:none;"><?php echo $text_option; ?></b></div>
<?php foreach ($options as $option) { ?>
<!-- Checkbox -->
<?php if ($option['type'] == 'checkbox') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="control-group">
This line still shows even when there is no options to display:

Code: Select all

<label class="control-label"><?php if ($option['required']) { ?><span class="required">*</span><?php } ?><b><?php echo $option['name']; ?>:</b></label>

Code: Select all

<?php foreach ($option['option_value'] as $option_value) { ?>		
<div class="optionBox">												
<label for="option-value-<?php echo $option_value['product_option_value_id']; ?>" class="checkbox">
<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']; ?> "/>  
<?php echo $option_value['name']; ?>														
<?php if ($option_value['price']) { ?>(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)<?php } ?>
</label>	
</div>													
<?php } ?>													
</div>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
Image
Hope that helps.

Re: Remove Option Title when options = 0

Posted: Wed Sep 10, 2014 3:11 am
by gartheman
hi, did you ever resolve this?