Problem: In Shopp (1.1.9) the default variations drop-down list shows prices. This isn’t always desired. This is the default usage:
<ul class="variations">
<?php shopp('product', 'variations', 'mode=multiple&label=true&defaults=Select an option&before_menu=<li>&after_menu=</li>'); ?>
</ul>
And this outputs a list that shows options as “Option Label (price)”.
Fix: The code above can be replaced with this code to manually create the same thing, giving complete control over output:
<ul class="variations">
<li>
<label for="options-1">Quantity</label>
<select name="products[<?php shopp('product', 'id'); ?>][options][]" class="category-catalog product<?php shopp('product', 'id'); ?> options" id="options-1">
<option value="">Select an option</option>
<?php
$i=1;
while (shopp('product', 'variations')): ?>
<option value="<?php echo $i;$i++; ?>"><?php shopp('product', 'variation', 'label'); ?></option>
<?php endwhile; ?>
</select>
</li>
</ul>
The $i;$i++ was a bit of a work-around as I couldn’t get it to work with variation ID, so if you know a better way, please tell us below!
Leave a Reply