コード例 #1
0
 public function buildModelCriteria()
 {
     $search = FreeShippingQuery::create();
     $id = $this->getId();
     if (!is_null($id)) {
         $search->filterById($id, Criteria::IN);
     }
     return $search;
 }
コード例 #2
0
 /**
  * This method is called by the Delivery  loop, to check if the current module has to be displayed to the customer.
  * Override it to implements your delivery rules/
  *
  * If you return true, the delivery method will de displayed to the customer
  * If you return false, the delivery method will not be displayed
  *
  * @param Country $country the country to deliver to.
  *
  * @return boolean
  */
 public function isValidDelivery(Country $country)
 {
     $cart = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher());
     $amount = $cart->getTaxedAmount($country);
     $areaId = $country->getAreaId();
     $area = FreeShippingQuery::create()->findOneByAreaId($areaId);
     if (isset($area)) {
         $maxAmount = $area->getAmount();
         if ($amount >= $maxAmount) {
             return true;
         }
     }
     return false;
 }