Post by frame » Sun Dec 07, 2008 6:46 am

Hi All,

I think it would be a good idea to change the product option dropdown menu under 'Available options:' to radio buttons. Is it complicated? Only the catalog/template/default/content/product.tpl file has to be modified or other file as well?
thanks
frame

New member

Posts

Joined
Sat Apr 26, 2008 7:24 pm

Post by Qphoria » Sun Dec 07, 2008 8:43 am

Yep, you only need to change the tpl file.

I'd like to add the option in 0.8 for product options to have the option to choose the style of button or dropdown for each product

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by frame » Mon Dec 08, 2008 2:55 am

I have changed my code from:

Code: Select all

<table class="b">
      <?php foreach ($options as $option) { ?>
      <tr>
        <td><?php echo $option['name']; ?>:</td>
        <td><select name="option[<?php echo $option['option_id']; ?>]">
            <?php foreach ($option['value'] as $option_value) { ?>
            <option value="<?php echo $option_value['product_to_option_id']; ?>"><?php echo $option_value['name']; ?>
            <?php if ($option_value['price']) { ?> 
            <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?><?php echo " (".$option_value['sub_quantity'].$text_on_stock.")";  ?>
		<?php } else { ?><?php echo $option_value['price']; ?><?php echo " (".$option_value['sub_quantity'].$text_on_stock.")";  ?>
            <?php } ?>
            </option>
            <?php } ?>
          </select></td>
      </tr>
      <?php } ?>
    </table>
to:

Code: Select all

<table class="b">
      <?php foreach ($options as $option) { ?>
      <tr>
        <td><?php echo $option['name']; ?>:</td>
        <tr><td>
            <?php foreach ($option['value'] as $option_value) { ?>
	    <input type="radio" name="option[<?php echo $option['option_id']; ?>]">
            <value="<?php echo $option_value['product_to_option_id']; ?>"><?php echo $option_value['name']; ?>
            <?php if ($option_value['price']) { ?> 
            <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?><?php echo " (".$option_value['sub_quantity'].$text_on_stock.")";  ?>
		<?php } else { ?><?php echo $option_value['price']; ?><?php echo " (".$option_value['sub_quantity'].$text_on_stock.")";  ?>
            <?php } ?>
            <br>
            <?php } ?>
          </tr></td>
      </tr>
      <?php } ?>
    </table>
The radio buttons are visible but clicking on the Add to Cart button something's wrong. Only the product's name is given to the cart, the product option and the stock (quantity) unfortunately not. What am I doing wrong?

New member

Posts

Joined
Sat Apr 26, 2008 7:24 pm

Post by Qphoria » Mon Dec 08, 2008 11:31 pm

frame wrote:
     
     
        :
       
           
    ]">
            ">
           
           

           
           
           
         
     
     
   

The radio buttons are visible but clicking on the Add to Cart button something's wrong. Only the product's name is given to the cart, the product option and the stock (quantity) unfortunately not. What am I doing wrong?




You have "value" as a separate tag. value is part of the input tag. Remove the > from the end of the input name and remove the at the end of value

That will fix it
Last edited by Qphoria on Mon Dec 08, 2008 11:36 pm, edited 1 time in total.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by frame » Tue Dec 09, 2008 2:06 am

Thank you! It works as expected!

New member

Posts

Joined
Sat Apr 26, 2008 7:24 pm
Who is online

Users browsing this forum: No registered users and 3 guests