Example #1
0
 function onPaymentDisplay(&$order, &$methods, &$usable_methods)
 {
     $user = JFactory::getUser();
     if (empty($user->id)) {
         return false;
     }
     $ordered_methods = array();
     foreach ($methods as &$method) {
         if ($method->payment_type != $this->name || !$method->enabled || !$method->payment_published) {
             continue;
         }
         if (!empty($method->payment_params->virtual_coupon)) {
             $ordered_methods[] =& $method;
         }
     }
     foreach ($methods as &$method) {
         if ($method->payment_type != $this->name || !$method->enabled || !$method->payment_published) {
             continue;
         }
         if (empty($method->payment_params->virtual_coupon)) {
             $ordered_methods[] =& $method;
         }
     }
     if (empty($ordered_methods)) {
         return;
     }
     $config =& hikashop_config();
     $this->main_currency = $config->get('main_currency', 1);
     $this->currency_id = hikashop_getCurrency();
     $this->points = $this->getUserPoints(null, 'all');
     $this->virtualpoints = $this->getVirtualPoints($order, 'all');
     $this->virtual_coupon_used = false;
     parent::onPaymentDisplay($order, $ordered_methods, $usable_methods);
 }
Example #2
0
 function onPaymentDisplay(&$order, &$methods, &$usable_methods)
 {
     if (!$this->init()) {
         return false;
     }
     return parent::onPaymentDisplay($order, $methods, $usable_methods);
 }
 function onPaymentDisplay(&$order, &$methods, &$usable_methods)
 {
     if (!$this->isShippingValid(@$order->shipping)) {
         return true;
     }
     $this->user = hikashop_loadUser(true);
     return parent::onPaymentDisplay($order, $methods, $usable_methods);
 }
 function onPaymentDisplay(&$order, &$methods, &$usable_methods)
 {
     if (empty($methods)) {
         return false;
     }
     switch (@$order->shipping->shipping_params->shipping_price_type) {
         case 'quote':
         case 'from':
             break;
         default:
             return false;
     }
     return parent::onPaymentDisplay($order, $methods, $usable_methods);
 }
Example #5
0
 function canDisplayButton(&$view, $type = 'checkout')
 {
     static $method = null;
     if (is_null($method)) {
         $class = hikashop_get('class.cart');
         $cart = $class->loadFullCart(true);
         $methods = $this->loadPaymentMethod('', 'all', $cart);
         if ($methods) {
             $already = array();
             $max = 0;
             foreach ($methods as $k => $method) {
                 if (!empty($method->payment_params)) {
                     $methods[$k]->payment_params = @unserialize($method->payment_params);
                 }
                 $methods[$k]->enabled = true;
                 if (empty($method->ordering)) {
                     $max++;
                     $methods[$k]->ordering = $max;
                 }
                 while (isset($already[$methods[$k]->ordering])) {
                     $max++;
                     $methods[$k]->ordering = $max;
                 }
                 $already[$methods[$k]->ordering] = true;
             }
             $usable_methods = array();
             parent::onPaymentDisplay($cart, $methods, $usable_methods);
             if (count($usable_methods)) {
                 $method = reset($usable_methods);
             }
         }
     }
     if (is_object($method) && empty($method->errors)) {
         if ($method->payment_params->displaycart && $type == 'cart') {
             return true;
         } elseif ($method->payment_params->displaycheckout && $type == 'checkout') {
             return true;
         }
     }
     return false;
 }