Beispiel #1
0
 /**
  * plgVmOnCheckAutomaticSelectedPayment
  * Checks how many plugins are available. If only one, the user will not have the choice. Enter edit_xxx page
  * The plugin must check first if it is the correct type
  * @author Valerie Isaksen
  * @param VirtueMartCart cart: the cart object
  * @return null if no plugin was found, 0 if more then one plugin was found,  virtuemart_xxx_id if only one plugin is found
  *
  */
 function plgVmOnCheckAutomaticSelectedPayment(VirtueMartCart $cart, array $cart_prices = array(), &$paymentCounter)
 {
     $nbMethod = 0;
     if ($this->getPluginMethods($cart->vendorId) === 0) {
         return false;
     }
     foreach ($this->methods as $method) {
         $cData = KlarnaHandler::getcData($method, $this->getCartAddress($cart, $type, false));
         if ($cData) {
             if ($nb = (int) $this->checkCountryCondition($method, $cData['country_code_3'], $cart)) {
                 $nbMethod = $nbMethod + $nb;
             }
         }
     }
     $paymentCounter = $paymentCounter + $nbMethod;
     if ($nbMethod == 0) {
         return NULL;
     } else {
         return 0;
     }
 }