Exemplo n.º 1
0
 /**
  * Assign last used payment method
  *
  * @return \XLite\Model\Payment\Transaction|void
  */
 protected function assignLastPaymentMethod()
 {
     $found = null;
     if ($this->isPaymentMethodRequired() && $this->getProfile() && $this->getProfile()->getLastPaymentId()) {
         $paymentMethods = $this->getPaymentMethods();
         $found = \Includes\Utils\ArrayManager::findValue($paymentMethods, array($this, 'checkLastPaymentMethod'), $this->getProfile()->getLastPaymentId());
     }
     return $found ? $this->getFirstOpenPaymentTransaction() : null;
 }
Exemplo n.º 2
0
 /**
  * Check if the re-order button is shown
  *
  * @param \XLite\Model\Order $order Order
  *
  * @return boolean
  */
 protected function showReorder(\XLite\Model\Order $order)
 {
     $items = $order->getItems();
     return (bool) \Includes\Utils\ArrayManager::findValue($items, array($this, 'checkIsAvailableToOrder'), false);
 }
Exemplo n.º 3
0
 /**
  * Get the errors which are connected with the membership of the user who placed the order
  *
  * @param \XLite\Model\Order $order
  *
  * @return array
  */
 protected function getMembershipErrors(\XLite\Model\Order $order)
 {
     $found = true;
     $memberships = $this->getMemberships();
     // Memberhsip
     if (0 < count($memberships)) {
         $membership = $order->getProfile() ? $order->getProfile()->getMembership() : null;
         $found = $membership ? \Includes\Utils\ArrayManager::findValue($memberships, array($this, 'checkMembershipId'), $membership->getMembershipId()) : false;
     }
     return $found ? array() : array(static::ERROR_MEMBERSHIP);
 }
Exemplo n.º 4
0
 /**
  * Returns item by sku
  *
  * @param string $sku Sku
  *
  * @return array
  */
 protected function getItemBySKU($sku)
 {
     $items = $this->getOrder()->getItems();
     return \Includes\Utils\ArrayManager::findValue($items, array($this, 'checkItemSKUEqual'), $sku);
 }