Witam,

korzystam z rozszerzenia VirtueMart do Joomla.

W niektórych przypadkach przy wyborze metody płatności dostępna jest tylko jedna metoda.
Trzeba zaznaczyć ją i kliknąć "Zapisz" - chciałbym, aby jeśli na liście dostępna jest tylko jedna opcja została automatycznie zaznaczona i automatycznie wykonało się "Submit".

Obecnie kod wygląda tak:

  1. <form method="post" id="userForm" name="chooseShipmentRate" action="<?php echo JRoute::_('index.php'); ?>" class="form-validate">
  2. <?php
  3.  
  4. echo "<h1>".JText::_('COM_VIRTUEMART_CART_SELECT_SHIPMENT')."</h1>";
  5. if($this->cart->getInCheckOut()){
  6. $buttonclass = 'default';
  7. } else {
  8. $buttonclass = 'default';
  9. }
  10. ?>
  11. <div class="buttonBar-right">
  12.  
  13. <button class="<?php echo $buttonclass ?>" type="submit" ><?php echo JText::_('COM_VIRTUEMART_SAVE'); ?></button> &nbsp;
  14. <button class="<?php echo $buttonclass ?>" type="reset" onClick="window.location.href='<?php echo JRoute::_('index.php?option=com_virtuemart&view=cart'); ?>'" ><?php echo JText::_('COM_VIRTUEMART_CANCEL'); ?></button>
  15. </div>
  16. <?php
  17. if ($this->found_shipment_method) {
  18.  
  19.  
  20. echo "<fieldset>\n";
  21. // if only one Shipment , should be checked by default
  22. foreach ($this->shipments_shipment_rates as $shipment_shipment_rates) {
  23. if (is_array($shipment_shipment_rates)) {
  24. foreach ($shipment_shipment_rates as $shipment_shipment_rate) {
  25. echo $shipment_shipment_rate."<br />\n";
  26. }
  27. }
  28. }
  29. echo "</fieldset>\n";
  30. } else {
  31. echo "<h1>".$this->shipment_not_found_text."</h1>";
  32. }
  33.  
  34. ?>
  35.  
  36. <input type="hidden" name="option" value="com_virtuemart" />
  37. <input type="hidden" name="view" value="cart" />
  38. <input type="hidden" name="task" value="setshipment" />
  39. <input type="hidden" name="controller" value="cart" />
  40. </form>


Bardzo proszę o pomoc.