Ejemplo n.º 1
0
 /**
  * @return EventgalleryLibraryMethodsPayment|EventgalleryLibraryMethodsShipping|EventgalleryLibraryMethodsSurcharge
  */
 public function getMethod()
 {
     if ($this->isPaymentMethod()) {
         /* @var EventgalleryLibraryManagerPayment $paymentMgr */
         $paymentMgr = EventgalleryLibraryManagerPayment::getInstance();
         return $paymentMgr->getMethod($this->_lineitem->methodid, false);
     }
     if ($this->isShippingMethod()) {
         /* @var EventgalleryLibraryManagerShipping $shippingMgr */
         $shippingMgr = EventgalleryLibraryManagerShipping::getInstance();
         return $shippingMgr->getMethod($this->_lineitem->methodid, false);
     }
     if ($this->isSurcharge()) {
         /* @var EventgalleryLibraryManagerSurcharge $surchargeMgr */
         $surchargeMgr = EventgalleryLibraryManagerSurcharge::getInstance();
         return $surchargeMgr->getMethod($this->_lineitem->methodid, false);
     }
     return null;
 }
Ejemplo n.º 2
0
 /**
  *
  * @param EventgalleryLibraryCart $cart
  *
  * @return array Errors
  */
 public function updateShippingMethod(EventgalleryLibraryCart $cart = NULL)
 {
     $errors = array();
     if ($cart == NULL) {
         $cart = $this->getCart();
     }
     /**
      * SHIPPING UPDATE
      */
     $shippingmethodid = JRequest::getString('shippingid', NULL);
     if ($shippingmethodid != NULL || $cart->getShippingMethod() == NULL) {
         /**
          * @var EventgalleryLibraryManagerShipping $shippingMgr
          * @var EventgalleryLibraryMethodsShipping $method
          */
         $shippingMgr = EventgalleryLibraryManagerShipping::getInstance();
         $method = $shippingMgr->getMethod($shippingmethodid, true);
         if ($method == NULL || $method->isEligible($cart) == false) {
             if ($shippingMgr->getDefaultMethod()->isEligible($cart)) {
                 $method = $shippingMgr->getDefaultMethod();
             }
         }
         $cart->setShippingMethod($method);
     }
     if ($cart->getShippingMethod() == null) {
         $errors[] = new Exception(JText::_('COM_EVENTGALLERY_CART_CHECKOUT_FORM_SHIPPINGMETHOD_INVALID'));
     }
     return $errors;
 }
Ejemplo n.º 3
0
 public function testMethodes()
 {
     /**
      * @var EventgalleryLibraryManagerCart $cartMgr
      */
     $cartMgr = EventgalleryLibraryManagerCart::getInstance();
     // CREATE
     $cart = $cartMgr->getCart();
     $this->assertEmpty($cart->getLineItems());
     $cart->addItem("test", "A_001_2013-03-17_IMG_1294.jpg", "1");
     $this->assertNotEmpty($cart->getLineItems());
     /**
      * @var EventgalleryLibraryManagerShipping $shippingMgr
      */
     $shippingMgr = EventgalleryLibraryManagerShipping::getInstance();
     $methods = $shippingMgr->getMethods();
     foreach ($methods as $method) {
         /**
          * @var EventgalleryLibraryInterfaceMethod $method
          */
         $method->isEligible($cart);
     }
     /**
      * @var EventgalleryLibraryManagerPayment $paymentMgr
      */
     $paymentMgr = EventgalleryLibraryManagerPayment::getInstance();
     $methods = $paymentMgr->getMethods();
     foreach ($methods as $method) {
         /**
          * @var EventgalleryLibraryInterfaceMethod $method
          */
         $method->isEligible($cart);
     }
     /**
      * @var EventgalleryLibraryManagerSurcharge $surchargeMgr
      */
     $surchargeMgr = EventgalleryLibraryManagerSurcharge::getInstance();
     $methods = $surchargeMgr->getMethods();
     foreach ($methods as $method) {
         /**
          * @var EventgalleryLibraryInterfaceMethod $method
          */
         $method->isEligible($cart);
     }
 }
Ejemplo n.º 4
0
<?php

// no direct access
/**
 * @package     Sven.Bluege
 * @subpackage  com_eventgallery
 *
 * @copyright   Copyright (C) 2005 - 2013 Sven Bluege All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die('Restricted access');
/**
 * @var EventgalleryLibraryManagerShipping $shippingMgr
 */
$shippingMgr = EventgalleryLibraryManagerShipping::getInstance();
$methods = $shippingMgr->getMethods(true);
$currentMethod = $this->cart->getShippingMethod() == NULL ? $shippingMgr->getDefaultMethod() : $this->cart->getShippingMethod();
?>

<div class="control-group">
    <?php 
echo JText::_('COM_EVENTGALLERY_CART_CHECKOUT_FORM_SHIPPINGMETHOD_LABEL');
?>
    <div class="controls">


        <select class="" name="shippingid">
            <?php 
foreach ($methods as $method) {
    ?>