0

Здравствуйте,есть вывод из базы формы с radiobutton:

    <form id = "shipping_form" name = "shipping_form" action = "<?php print $this->action ?>" method = "post" onsubmit = "return validateShippingMethods()">
<?php print $this->_tmp_ext_html_shipping_start?>
<?php foreach($this->shipping_methods as $shipping){?>
      <input type = "radio" name = "sh_pr_method_id" id = "shipping_method_<?php print $shipping->sh_pr_method_id?>" value="<?php print $shipping->sh_pr_method_id ?>" <?php if ($shipping->sh_pr_method_id==$this->active_shipping){ ?>checked = "checked"<?php } ?> />
      <label for = "shipping_method_<?php print $shipping->sh_pr_method_id ?>"><?php
      if ($shipping->image){
        ?><span class="shipping_image"><img src="<?php print $shipping->image?>" alt="<?php print htmlspecialchars($shipping->name)?>" /></span><?php
      }
      ?><?php print $shipping->name?> (<?php print formatprice($shipping->calculeprice); ?>)</label>

<?php    
echo JHTML::_('list.users', $name, $active, $nouser = 0, $javascript = NULL, $order = 'name', $reg = 1);
?>

      <?php if ($this->config->show_list_price_shipping_weight && count($shipping->shipping_price)){ ?>
          <br />
          <?php foreach($shipping->shipping_price as $price){?>
                    <?php if ($price->shipping_weight_to!=0){?>
                        <?php print formatweight($price->shipping_weight_from);?> - <?php print formatweight($price->shipping_weight_to);?>
                    <?php }else{ ?>
                        <?php print _JSHOP_FROM." ".formatweight($price->shipping_weight_from);?>
                    <?php } ?>
                    <?php print formatprice($price->shipping_price); ?>
          <?php } ?>
      <?php } ?>
      <div class="shipping_descr"><?php print $shipping->description?></div>
      <?php if ($shipping->delivery){?>
      <div class="shipping_delivery"><?php print _JSHOP_DELIVERY_TIME.": ".$shipping->delivery?></div>
      <?php }?>
      <?php if ($shipping->delivery_date_f){?>
      <div class="shipping_delivery_date"><?php print _JSHOP_DELIVERY_DATE.": ".$shipping->delivery_date_f?></div>
      <?php }?>      
<?php } ?>
<?php print $this->_tmp_ext_html_shipping_end?>

<input type = "submit" class = "button" value = "<?php print _JSHOP_NEXT ?>" />
</form>

Подскажите пожалуйста, как сделать вместо множества кнопок один выпадающий список?

1 ответ 1

0

Слушайте ну как-то так:

  <form id = "shipping_form" name = "shipping_form" action = "<?php print $this->action ?>" method = "post" onsubmit = "return validateShippingMethods()">
<?php print $this->_tmp_ext_html_shipping_start?>
<select name = "sh_pr_method_id">
<?php foreach($this->shipping_methods as $shipping){?>
<option id = "shipping_method_<?php print $shipping->sh_pr_method_id?>" value="<?php print $shipping->sh_pr_method_id ?>" <?php if ($shipping->sh_pr_method_id==$this->active_shipping){ ?>selected<?php } ?>>
 <?php
      if ($shipping->image){
        ?><span class="shipping_image"><img src="<?php print $shipping->image?>" alt="<?php print htmlspecialchars($shipping->name)?>" /></span><?php
      }
      ?><?php print $shipping->name?> (<?php print formatprice($shipping->calculeprice); ?>)</option>

<?php    
echo JHTML::_('list.users', $name, $active, $nouser = 0, $javascript = NULL, $order = 'name', $reg = 1);
?>

      <?php if ($this->config->show_list_price_shipping_weight && count($shipping->shipping_price)){ ?>
          <br />
          <?php foreach($shipping->shipping_price as $price){?>
                    <?php if ($price->shipping_weight_to!=0){?>
                        <?php print formatweight($price->shipping_weight_from);?> - <?php print formatweight($price->shipping_weight_to);?>
                    <?php }else{ ?>
                        <?php print _JSHOP_FROM." ".formatweight($price->shipping_weight_from);?>
                    <?php } ?>
                    <?php print formatprice($price->shipping_price); ?>
          <?php } ?>
      <?php } ?>
      <div class="shipping_descr"><?php print $shipping->description?></div>
      <?php if ($shipping->delivery){?>
      <div class="shipping_delivery"><?php print _JSHOP_DELIVERY_TIME.": ".$shipping->delivery?></div>
      <?php }?>
      <?php if ($shipping->delivery_date_f){?>
      <div class="shipping_delivery_date"><?php print _JSHOP_DELIVERY_DATE.": ".$shipping->delivery_date_f?></div>
      <?php }?>      
<?php } ?>
</select>
<?php print $this->_tmp_ext_html_shipping_end?>

<input type = "submit" class = "button" value = "<?php print _JSHOP_NEXT ?>" />
</form>

Может работать не очень верно т.к. непонятно где заканчивается label у radiobutton и такое ощущение что он может быть картинкой что не допустимо в select.

1
  • Работает! Вы мой спаситель!=)
    – xmocartx
    Commented 1 сент. 2013 в 14:03

Ваш ответ

Нажимая «Отправить ответ», вы соглашаетесь с условиями пользования и подтверждаете, что прочитали политику конфиденциальности.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.