/** * Prepare grid collection object * * @return $this */ protected function _prepareCollection() { $collection = $this->_paymentCollection->create(); $this->setCollection($collection); if (!$this->getParam($this->getVarNameSort())) { $collection->setOrder('payment_id', 'desc'); } return parent::_prepareCollection(); }
/** * Prepare recurring payments from the session * * @return void */ protected function _prepareLastRecurringPayments() { $paymentIds = $this->_checkoutSession->getLastRecurringPaymentIds(); if ($paymentIds && is_array($paymentIds)) { $collection = $this->_recurringPaymentCollectionFactory->create()->addFieldToFilter('payment_id', array('in' => $paymentIds)); $payments = array(); foreach ($collection as $payment) { $payments[] = $payment; } if ($payments) { $this->setRecurringPayments($payments); if ($this->_customerSession->isLoggedIn()) { $this->setCanViewPayments(true); } } } }