コード例 #1
0
ファイル: OrdersUpdater.php プロジェクト: aiesh/magento2
 /**
  * Add billing agreement filter
  *
  * @param mixed $argument
  * @return mixed
  * @throws \DomainException
  */
 public function update($argument)
 {
     $billingAgreement = $this->_registryManager->registry('current_billing_agreement');
     if (!$billingAgreement) {
         throw new \DomainException('Undefined billing agreement object');
     }
     $this->_agreementResource->addOrdersFilter($argument, $billingAgreement->getId());
     return $argument;
 }
コード例 #2
0
ファイル: View.php プロジェクト: nja78/magento2
 /**
  * Retrieve related orders collection
  *
  * @return \Magento\Sales\Model\Resource\Order\Collection
  */
 public function getRelatedOrders()
 {
     if ($this->_relatedOrders === null) {
         $billingAgreement = $this->_getBillingAgreementInstance();
         $billingAgreementId = $billingAgreement ? $billingAgreement->getAgreementId() : 0;
         $this->_relatedOrders = $this->_orderCollectionFactory->create()->addFieldToSelect('*')->addFieldToFilter('customer_id', (int) $this->_customerSession->getCustomerId())->addFieldToFilter('status', ['in' => $this->_orderConfig->getVisibleOnFrontStatuses()])->setOrder('created_at', 'desc');
         $this->_agreementResource->addOrdersFilter($this->_relatedOrders, $billingAgreementId);
     }
     return $this->_relatedOrders;
 }