Skip to content

Commit 3ebcc33

Browse files
Update Wishlist.php
fixed block file
1 parent 23e6250 commit 3ebcc33

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

app/code/Magento/Wishlist/Block/Customer/Wishlist.php

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock
2424
*/
2525
protected $_optionsCfg = [];
2626

27-
/**
28-
* @var \Magento\Framework\App\Config\ScopeConfigInterface
29-
*/
30-
protected $_scopeConfig;
31-
3227
/**
3328
* @var \Magento\Catalog\Helper\Product\ConfigurationPool
3429
*/
@@ -73,7 +68,6 @@ public function __construct(
7368
$this->_helperPool = $helperPool;
7469
$this->currentCustomer = $currentCustomer;
7570
$this->postDataHelper = $postDataHelper;
76-
$this->_scopeConfig = $context->getScopeConfig();
7771
$this->getWishlistItems();
7872
}
7973

@@ -89,22 +83,33 @@ protected function _prepareCollection($collection)
8983
return $this;
9084
}
9185

86+
/**
87+
* Paginate Wishlist Product Items collection
88+
*
89+
* @return void
90+
*/
91+
public function paginateCollection()
92+
{
93+
$page = $this->getRequest()->getParam("p", 1);
94+
$limit = $this->getRequest()->getParam("limit", 10);
95+
$this->_collection
96+
->setPageSize($limit)
97+
->setCurPage($page);
98+
}
99+
92100
/**
93101
* Retrieve Wishlist Product Items collection
94102
*
95103
* @return \Magento\Wishlist\Model\ResourceModel\Item\Collection
96104
*/
97105
public function getWishlistItems()
98106
{
99-
$page = ($this->getRequest()->getParam("p")) ? $this->getRequest()->getParam("p") : 1;
100-
$limit = ($this->getRequest()->getParam("limit")) ? $this->getRequest()->getParam("limit") : 10;
101107
if ($this->_collection === null) {
102108
$this->_collection = $this->_createWishlistItemCollection();
103109
$this->_prepareCollection($this->_collection);
110+
$this->paginateCollection();
104111
}
105-
$this->_collection
106-
->setPageSize($limit)
107-
->setCurPage($page);
112+
108113
return $this->_collection;
109114
}
110115

@@ -117,8 +122,7 @@ protected function _prepareLayout()
117122
{
118123
parent::_prepareLayout();
119124
$this->pageConfig->getTitle()->set(__('My Wish List'));
120-
$pager = $this->getLayout()
121-
->createBlock('Magento\Theme\Block\Html\Pager', 'wishlist_item_pager')
125+
$pager = $this->getChildBlock('wishlist_item_pager')
122126
->setUseContainer(
123127
true
124128
)->setShowAmounts(

0 commit comments

Comments
 (0)