News:

Support the VirtueMart project and become a member

Main Menu

Payment Plugin Development Help

Started by jibon57, June 30, 2015, 21:49:04 PM

Previous topic - Next topic

jibon57

Hello,

I was trying to develop payment plugin for moneris. I was about to complete that but for some reason I can't show credit card information fields in the cart page. But when I am activating other payment plugin with that one those fields are showing. As soon as I disabled other plugin my payment plugin's fields are disappeared again. What may be the problem? I am using  VirtueMart 3.0.9 with Joomla 3.4.1. I was following standard & paypal payment plugin for implementing my code.

public function plgVmDisplayListFEPayment(VirtueMartCart $cart, $selected = 0, &$htmlIn) {

if ($this->getPluginMethods($cart->vendorId) === 0) {
if (empty($this->_name)) {
$app = JFactory::getApplication();
$app->enqueueMessage(vmText::_('COM_VIRTUEMART_CART_NO_' . strtoupper($this->_psType)));
return false;
} else {
return false;
}
}
$method_name = $this->_psType . '_name';
//echo $method_name;
$htmla = array();
foreach ($this->methods as $this->_currentMethod) {
//echo "<pre>";
//print_r($this->_currentMethod);
//echo "</pre>";
if ($this->checkConditions($cart, $this->_currentMethod, $cart->cartPrices)) {

$html = '';
$cartPrices=$cart->cartPrices;
if (isset($this->_currentMethod->cost_method)) {
$cost_method=$this->_currentMethod->cost_method;
} else {
$cost_method=true;
}
$methodSalesPrice = $this->setCartPrices($cart, $cartPrices, $this->_currentMethod, $cost_method);

$this->_currentMethod->$method_name = $this->renderPluginName($this->_currentMethod);
$cvv_images = $this->_displayCVVImages($this->_currentMethod);
$html .= $this->getPluginHtml($this->_currentMethod, $selected, $methodSalesPrice);

$html .= $this->renderByLayout('creditcardform', array(
'virtuemart_paymentmethod_id' => $this->_currentMethod->virtuemart_paymentmethod_id,
'method' =>$this->_currentMethod,
));


$htmla[] = $html;
}
}
$htmlIn[] = $htmla;
return true;

}


creditcardform.php

<?php

defined
('_JEXEC') or die();

//$customerData = $viewData['customerData'];

JHTML::_('behavior.tooltip');
JHTML::script('vmcreditcard.js''components/com_virtuemart/assets/js/'false);
VmConfig::loadJLang('com_virtuemart'true);
vmJsApi::jCreditCard();

?>


<div id="paymentMethodOptions_<?php echo $viewData['virtuemart_paymentmethod_id']; ?>" class="paymentMethodOptions" >
    <br />
    <span class="vmpayment_cardinfo">
       
        <table border="0" cellspacing="0" cellpadding="2" width="100%">           
            <tr valign="top">
                <td nowrap width="10%" align="right">
                    <label for="cc_type">Credit Card Number:</label>
                </td>
                <td>
                    <input type="text" size="30" class="inputbox" id="cc_number_<?php echo $viewData['virtuemart_paymentmethod_id']; ?>"
                        name="cc_number_<?php echo $viewData['virtuemart_paymentmethod_id']; ?>" value=""
                        autocomplete="off" />
                    <div id="cc_cardnumber_errormsg_<?php echo $viewData['virtuemart_paymentmethod_id']; ?>"></div>
                </td>
            </tr>
            <tr valign="top">
                <td nowrap width="10%" align="right">
                    <label for="cc_cvv">CVV:</label>
                </td>
                <td>
                    <input type="text" class="inputbox" id="cc_cvv_<?php echo $viewData['virtuemart_paymentmethod_id']; ?>" name="cc_cvv_<?php echo $viewData['virtuemart_paymentmethod_id']; ?>" maxlength="4" size="5" value="" autocomplete="off" />
                    <span class="hasTip" title="<?php echo "What" ?>::Tip ">
                        What
                    </span>
                </td>
            </tr>
            <tr>
                <td nowrap width="10%" align="right">Expiration Date:</td>
                <td>
                    <?php 
                    
echo shopfunctions::listMonths('cc_expire_month_' $viewData['virtuemart_paymentmethod_id'], "");
                    echo 
" / ";
                    echo 
shopfunctions::listYears('cc_expire_year_' $viewData['virtuemart_paymentmethod_id'], ""nullnull"onchange=\"var month = document.getElementById('cc_expire_month_'".$viewData['virtuemart_paymentmethod_id']."); if(!CreditCardisExpiryDate(month.value,this.value, '".$viewData['virtuemart_paymentmethod_id']."')){this.value='';month.value='';}\" ");
                    
?>

                    <div id="cc_expiredate_errormsg_<?php echo $viewData['virtuemart_paymentmethod_id']; ?>"></div>
                </td>
            </tr>
        </table>
    </span>
</div>


In where I did mistake? Thanks in advance.

Studio 42

Hi,
perhaps you have simply check in config : auto select paiement ?