News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

[Select Payment] radio button change to dropdown and insert in cart page

Started by rzrz, August 19, 2012, 11:26:51 AM

Previous topic - Next topic

rzrz

#1 Currently my payment methods are in radio buttons, I wondered how to change to dropdown?

This is my current code:


echo "<fieldset>"; // <fieldset>should change to <select>
foreach ($this->paymentplugins_payments as $paymentplugin_payments) {
    if (is_array($paymentplugin_payments)) {
foreach ($paymentplugin_payments as $paymentplugin_payment) {
    echo $paymentplugin_payment.'<br />';
}
    }
}
    echo "</fieldset>";


#2 On the cart page its currently display as a link [select payment] and will direct to another page to select in radio buttons. I wondered how to insert the dropdown select payment directly into cart page?


[attachment cleanup by admin]

lancebekistan

I would be happy if I could change the list to a drop down list.  I use the off-line credit card extension and people put in their information and neglect to select the radio  button for credit card.  When they hit save the information is cleared and the page is reloaded.  It is frustrating and apparently the text "select your payment method" doesn't help them.  They think typing their card information in does that......

rzrz

Successfully changed to select dropdown, but still finding the ways to put it directly on cart page....

<?php 
/**
 *
 * Template for the shipment selection
 *
 * @package VirtueMart
 * @subpackage Cart
 * @author Max Milbers
 *
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public Licenseor
 * other free or open source software licenses.
 * @version $Id: cart.php 2400 2010-05-11 19:30:47Z milbo $
 */
?>

<?php 
if (VmConfig::get('oncheckout_show_steps'1)) {
    echo 
'<div class="checkoutStep" id="checkoutStep2">' JText::_('COM_VIRTUEMART_USER_FORM_CART_STEP2') . '</div>';
}
    
/*********** Add ***********/
    
function extractstr ($content$start$end){
        if (((
$content AND $start) AND $end)){
              
$r explode ($start$content);
              if (isset (
$r[1])){
                
$r explode ($end$r[1]);
                return 
$r[0];
              }
        return 
'';
        }
    }
    
/*********** Add ***********/
?>

<form method="post" id="userForm" name="chooseShipmentRate" action="<?php  echo JRoute::_('index.php'); ?>" class="form-validate">
<?php 
echo 
"<h5>".JText::_('COM_VIRTUEMART_CART_SELECT_SHIPMENT')."</h5>";
?>

<?php 
    
if ($this->found_shipment_method) {
  
/*********** EDIT ***********/
        
echo '<select id="group1" name="virtuemart_shipmentmethod_id"  onchange="this.form.submit()">\n';
        
/*********** EDIT ***********/
// if only one Shipment , should be checked by default
    foreach ($this->shipments_shipment_rates as $shipment_shipment_rates) {
if (is_array($shipment_shipment_rates)) {
    foreach ($shipment_shipment_rates as $shipment_shipment_rate) {
                   
/*********** EDIT ***********/
                    
$shipment_value=extractstr($shipment_shipment_rate,'value="','"');
                   
//$shipment_text=extractstr($shipment_shipment_rate,'<span class="vmshipment">','</span>');
                    /*********** EDIT ***********/
   $shipment_text1=extractstr($shipment_shipment_rate,'<span class="vmshipment_name">','</span>');
$shipment_text2=extractstr($shipment_shipment_rate,'<span class="vmshipment_cost">','</span>');
$shipment_text=$shipment_text1.' '.$shipment_text2;
                    
/*********** EDIT END ***********/
   
                    echo 
'<option value="'.$shipment_value.'">'.$shipment_text.'</option><br />\n';
                    
/*********** EDIT ***********/
    }
}
    }
    echo "</select>\n";
    } else {
 echo "<h3>".$this->shipment_not_found_text."</h3>";
    }
    
?>


<div>
<button  type="submit" ><?php  echo JText::_('COM_VIRTUEMART_SAVE'); ?></button>
<button  type="reset" onClick="window.location.href='<?php  echo JRoute::_('index.php?option=com_virtuemart&view=cart'); ?>'" ><?php  echo JText::_('COM_VIRTUEMART_CANCEL'); ?></button>
</div>
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="cart" />
<input type="hidden" name="task" value="setshipment" />
<input type="hidden" name="controller" value="cart" />
</form>