Search

Change Language

Friday, April 8, 2011

Getting Virtuemart Product Attributes Use Radio Buttons

Replace the complete code of the file:
components/com_virtuemart/themes/default/templates/product_details/includes/addtocart_advanced_attribute.tpl.php

with the following:
 

<?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );

foreach($attributes as $attribute) {      
    ?>
    <div class="vmAttribChildDetail" style="float: left;text-align:right;margin:3px;">
        <label for="<?php echo $attribute['titlevar'] ?>_field"><?php echo $attribute['title'] ?></label>:
    </div>
    <div class="vmAttribChildDetail" style="float: left;text-align:left;margin:3px;">
    <?php
    $chek = 1;
    foreach ( $attribute['options_list'] as $options_item )  { ?>
          <?php if( isset( $options_item['display_price']) ) : ?>
           <input type="radio" style="margin-top: 15px;"
            id="<?php echo $attribute['titlevar'] ?>_field"
            name="<?php echo $attribute['titlevar'].$attribute['product_id'] ?>"
            value="<?php echo $options_item['base_var'] ?>"
            <?php if ($chek==1) { echo " checked"; $chek=0; }; ?>
            >
            <?php echo $options_item['base_value'] ?> (
            <?php echo $options_item['sign'].$options_item['display_price']
            ?>)
          <br />
           <?php else : ?>
           <input type="radio" style="margin-top: 15px;"
            id="<?php echo $attribute['titlevar'] ?>_field"
            name="<?php echo $attribute['titlevar'].$attribute['product_id'] ?>"
            value="<?php echo $options_item['base_var'] ?>"
            <?php if ($chek==1) { echo " checked"; $chek=0; }; ?>
            >
            <?php echo $options_item['base_value']
            ?><br />
           <?php endif; ?>
    <?php } ?>
    </div>
    <br style="clear:both;" />
   
<?php
} ?>



Remember to save a coy of the original code just in case!
 

1 comments:

I can select more than one?

Post a Comment