News:

Looking for documentation? Take a look on our wiki

Main Menu

Credit Card Form Class

Started by webryant_2000, July 19, 2013, 05:48:13 AM

Previous topic - Next topic

webryant_2000

Hello;

I am using VM2 with latest updates and I am having a problem with the credit card form showing the dropdowns correctly.  I have a dark template and I have had this problem with other Virtuemart checkout forms as well.  It first appeared on the Add/Edit billing address information form but through much trial and error, I was able to modify the template css.css to include a class for the Add/Edit billing address information form that is used for the checkout.  However I have not been able to do the same thing for the credit card form.

I have used Firebug to try and locate the class for that form, and the only class I can find is the Inputbox class, which works ok for the State dropdown in the User Information form.

I anyone direct me to the file I would modify to set the class for the Credit Card Form dropdown?


The site is www.fredwhitfield.com


[attachment cleanup by admin]

jenkinhill

Please don't use big text as it is not easy to speed read and is a bit like shouting.

Edit the Authorize file  plugins/vmpayment/authorizenet/authorizenet.php to add in a class or id so you can then style it (or use in-line style). Unfortunately you cannot use an override for this file, so will need to re-edit the file at each VM update.

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

webryant_2000

Thanks for you reply.  I was having problems seeing the text, so I thought if I increased it a bit it would be easier for others to read.  Sorry; I did not mean to shout.  I have modified the post.

I'm not sure where I add the class, would you direct me to where I should go to add the class="INPUTBOX" for the Credit Card Type, the Expiration Month and Expiration Year?   See a copy of the code below.


   /**

    * This shows the plugin for choosing in the payment list of the checkout process.

    *

    * @author Valerie Cartan Isaksen

    */

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



      //JHTML::_ ('behavior.tooltip');



      if ($this->getPluginMethods ($cart->vendorId) === 0) {

         if (empty($this->_name)) {

            $app = JFactory::getApplication ();

            $app->enqueueMessage (JText::_ ('COM_VIRTUEMART_CART_NO_' . strtoupper ($this->_psType)));

            return FALSE;

         } else {

            return FALSE;

         }

      }

      $html = array();

      $method_name = $this->_psType . '_name';



      JHTML::script ('vmcreditcard.js', 'components/com_virtuemart/assets/js/', FALSE);

      JFactory::getLanguage ()->load ('com_virtuemart');

      vmJsApi::jCreditCard ();

      $htmla = '';

      $html = array();

      foreach ($this->methods as $method) {

         if ($this->checkConditions ($cart, $method, $cart->pricesUnformatted)) {

            $methodSalesPrice = $this->setCartPrices ($cart, $cart->pricesUnformatted,$method);

            $method->$method_name = $this->renderPluginName ($method);

            $html = $this->getPluginHtml ($method, $selected, $methodSalesPrice);

            if ($selected == $method->virtuemart_paymentmethod_id) {

               $this->_getAuthorizeNetFromSession ();

            } else {

               $this->_cc_type = '';

               $this->_cc_number = '';

               $this->_cc_cvv = '';

               $this->_cc_expire_month = '';

               $this->_cc_expire_year = '';

            }

            $creditCards = $method->creditcards;



            $creditCardList = '';

            if ($creditCards) {

               $creditCardList = ($this->_renderCreditCardList ($creditCards, $this->_cc_type, $method->virtuemart_paymentmethod_id, FALSE));

            }

            $sandbox_msg = "";

            if ($method->sandbox) {

               $sandbox_msg .= '<br />' . JText::_ ('VMPAYMENT_AUTHORIZENET_SANDBOX_TEST_NUMBERS');

            }



            $cvv_images = $this->_displayCVVImages ($method);

            $html .= '<br /><span class="vmpayment_cardinfo">' . JText::_ ('VMPAYMENT_AUTHORIZENET_COMPLETE_FORM') . $sandbox_msg . '

          <table border="0" cellspacing="0" cellpadding="2" width="100%">

          <tr valign="top">

              <td nowrap width="10%" align="right">

                 <label for="creditcardtype">' . JText::_ ('VMPAYMENT_AUTHORIZENET_CCTYPE') . '</label>

              </td>

              <td>' . $creditCardList .

               '</td>

          </tr>

          <tr valign="top">

              <td nowrap width="10%" align="right">

                 <label for="cc_type">' . JText::_ ('VMPAYMENT_AUTHORIZENET_CCNUM') . '</label>

              </td>

              <td>

            <script type="text/javascript">

            //<![CDATA[

              function checkAuthorizeNet(id, el)

               {

                 ccError=razCCerror(id);

               CheckCreditCardNumber(el.value, id);

               if (!ccError) {

               el.value=\'\';}

               }

            //]]>

            </script>

              <input type="text" class="inputbox" id="cc_number_' . $method->virtuemart_paymentmethod_id . '" name="cc_number_' . $method->virtuemart_paymentmethod_id . '" value="' . $this->_cc_number . '"    autocomplete="off"   onchange="javascript:checkAuthorizeNet('.$method->virtuemart_paymentmethod_id.', this);"  />

              <div id="cc_cardnumber_errormsg_' . $method->virtuemart_paymentmethod_id . '"></div>

          </td>

          </tr>

          <tr valign="top">

              <td nowrap width="10%" align="right">

                 <label for="cc_cvv">' . JText::_ ('VMPAYMENT_AUTHORIZENET_CVV2') . '</label>

              </td>

              <td>

                  <input type="text" class="inputbox" id="cc_cvv_' . $method->virtuemart_paymentmethod_id . '" name="cc_cvv_' . $method->virtuemart_paymentmethod_id . '" maxlength="4" size="5" value="' . $this->_cc_cvv . '" autocomplete="off" />



         <span class="hasTip" title="' . JText::_ ('VMPAYMENT_AUTHORIZENET_WHATISCVV') . '::' . JText::sprintf ("VMPAYMENT_AUTHORIZENET_WHATISCVV_TOOLTIP", $cvv_images) . ' ">' .

               JText::_ ('VMPAYMENT_AUTHORIZENET_WHATISCVV') . '

         </span></td>

          </tr>

          <tr>

              <td nowrap width="10%" align="right">' . JText::_ ('VMPAYMENT_AUTHORIZENET_EXDATE') . '</td>

              <td> ';

            $html .= shopfunctions::listMonths ('cc_expire_month_' . $method->virtuemart_paymentmethod_id, $this->_cc_expire_month);

            $html .= " / ";

            $html .= '

            <script type="text/javascript">

            //<![CDATA[

              function changeDate(id, el)

               {

                 var month = document.getElementById(\'cc_expire_month_\'+id); if(!CreditCardisExpiryDate(month.value,el.value, id))

                {el.value=\'\';

                month.value=\'\';}

               }

            //]]>

            </script>';

            $html .= shopfunctions::listYears ('cc_expire_year_' . $method->virtuemart_paymentmethod_id, $this->_cc_expire_year, NULL, 2022, " onchange=\"javascript:changeDate(".$method->virtuemart_paymentmethod_id.", this);\" ");

            $html .= '<div id="cc_expiredate_errormsg_' . $method->virtuemart_paymentmethod_id . '"></div>';

            $html .= '</td>  </tr>     </table></span>';



            $htmla[] = $html;

         }

      }

      $htmlIn[] = $htmla;



      return TRUE;

   }