Guest User

Untitled

a guest
Dec 12th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. public function getInvoicesCus()
  2. {
  3.  
  4. //get values of current page
  5. $page=($this->getRequest()->getParam('p'))? $this->getRequest()->getParam('p') : 1;
  6. //get values of current limit
  7. $pageSize=($this->getRequest()->getParam('limit'))? $this->getRequest()->getParam('limit') : 1;
  8.  
  9. $orderCollection = $this->_orderCollectionFactory->create()->addAttributeToSelect('*');
  10. $orderCollection->addAttributeToFilter('customer_id',$this->getCustomerId());
  11. $orderCollection->setPageSize($pageSize);
  12. $orderCollection->setCurPage($page);
  13. $orderCollection->load();
  14. //echo "<pre>";
  15.  
  16. $invoices_data = array();
  17. foreach($orderCollection as $orderData)
  18. {
  19. $order_id = '';
  20. $order_id = $orderData->getData('increment_id');
  21.  
  22. foreach ($orderData->getInvoiceCollection() as $invoice)
  23. {
  24. $invoices_all_data = $invoice->getData();
  25. $invoices_data[] = $invoices_all_data;
  26. }
  27. }
  28. return $invoices_data;
  29. }
  30.  
  31. protected function _prepareLayout()
  32. {
  33. parent::_prepareLayout();
  34. $this->pageConfig->getTitle()->set(__('Invioices'));
  35. if ($this->getInvoicesCus()) {
  36. $pager = $this->getLayout()->createBlock(
  37. 'MagentoThemeBlockHtmlPager',
  38. 'magecomp.category.pager'
  39. )->setAvailableLimit(array(5=>5,10=>10,15=>15))->setShowPerPage(true)->setCollection(
  40. $this->getInvoicesCus()
  41. );
  42. $this->setChild('pager', $pager);
  43. $this->getInvoicesCus()->load();
  44. }
  45. return $this;
  46. }
  47.  
  48. public function getPagerHtml()
  49. {
  50. return $this->getChildHtml('pager');
  51. }
  52.  
  53. <?php if ($block->getPagerHtml()): ?>
  54. <div class="order-products-toolbar toolbar bottom"><?= $block->getPagerHtml() ?></div>
  55. <?php endif ?>
  56. <?php else: ?>
  57. <div class="message info empty"><span><?= /* @escapeNotVerified */ __('You have placed no orders.') ?></span></div>
  58. <?php endif ?>
Add Comment
Please, Sign In to add comment