@@ -24,11 +24,6 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock
24
24
*/
25
25
protected $ _optionsCfg = [];
26
26
27
- /**
28
- * @var \Magento\Framework\App\Config\ScopeConfigInterface
29
- */
30
- protected $ _scopeConfig ;
31
-
32
27
/**
33
28
* @var \Magento\Catalog\Helper\Product\ConfigurationPool
34
29
*/
@@ -73,7 +68,6 @@ public function __construct(
73
68
$ this ->_helperPool = $ helperPool ;
74
69
$ this ->currentCustomer = $ currentCustomer ;
75
70
$ this ->postDataHelper = $ postDataHelper ;
76
- $ this ->_scopeConfig = $ context ->getScopeConfig ();
77
71
$ this ->getWishlistItems ();
78
72
}
79
73
@@ -89,22 +83,33 @@ protected function _prepareCollection($collection)
89
83
return $ this ;
90
84
}
91
85
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
+
92
100
/**
93
101
* Retrieve Wishlist Product Items collection
94
102
*
95
103
* @return \Magento\Wishlist\Model\ResourceModel\Item\Collection
96
104
*/
97
105
public function getWishlistItems ()
98
106
{
99
- $ page = ($ this ->getRequest ()->getParam ("p " )) ? $ this ->getRequest ()->getParam ("p " ) : 1 ;
100
- $ limit = ($ this ->getRequest ()->getParam ("limit " )) ? $ this ->getRequest ()->getParam ("limit " ) : 10 ;
101
107
if ($ this ->_collection === null ) {
102
108
$ this ->_collection = $ this ->_createWishlistItemCollection ();
103
109
$ this ->_prepareCollection ($ this ->_collection );
110
+ $ this ->paginateCollection ();
104
111
}
105
- $ this ->_collection
106
- ->setPageSize ($ limit )
107
- ->setCurPage ($ page );
112
+
108
113
return $ this ->_collection ;
109
114
}
110
115
@@ -117,8 +122,7 @@ protected function _prepareLayout()
117
122
{
118
123
parent ::_prepareLayout ();
119
124
$ 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 ' )
122
126
->setUseContainer (
123
127
true
124
128
)->setShowAmounts (
0 commit comments