Wishlist.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Reports\Block\Adminhtml;
  7. /**
  8. * Adminhtml wishlist report page content block
  9. *
  10. * @author Magento Core Team <core@magentocommerce.com>
  11. */
  12. class Wishlist extends \Magento\Backend\Block\Template
  13. {
  14. /**
  15. * Template file
  16. *
  17. * @var string
  18. */
  19. protected $_template = 'Magento_Reports::report/wishlist.phtml';
  20. /**
  21. * Reports wishlist collection factory
  22. *
  23. * @var \Magento\Reports\Model\ResourceModel\Wishlist\CollectionFactory
  24. */
  25. protected $_wishlistFactory;
  26. /**
  27. * Constructor
  28. *
  29. * @param \Magento\Backend\Block\Template\Context $context
  30. * @param \Magento\Reports\Model\ResourceModel\Wishlist\CollectionFactory $wishlistFactory
  31. * @param array $data
  32. */
  33. public function __construct(
  34. \Magento\Backend\Block\Template\Context $context,
  35. \Magento\Reports\Model\ResourceModel\Wishlist\CollectionFactory $wishlistFactory,
  36. array $data = []
  37. ) {
  38. $this->_wishlistFactory = $wishlistFactory;
  39. parent::__construct($context, $data);
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. protected function _beforeToHtml()
  45. {
  46. $this->setChild(
  47. 'grid',
  48. $this->getLayout()->createBlock(\Magento\Reports\Block\Adminhtml\Wishlist\Grid::class, 'report.grid')
  49. );
  50. $collection = $this->_wishlistFactory->create();
  51. list($customerWithWishlist, $wishlistsCount) = $collection->getWishlistCustomerCount();
  52. $this->setCustomerWithWishlist($customerWithWishlist);
  53. $this->setWishlistsCount($wishlistsCount);
  54. $this->setItemsBought(0);
  55. $this->setSharedCount($collection->getSharedCount());
  56. $this->setReferralsCount(0);
  57. $this->setConversionsCount(0);
  58. return $this;
  59. }
  60. }