Skip to content

Commit 23e6250

Browse files
fixed issue #19292 for 2.3-develop
1 parent 1a805d0 commit 23e6250

File tree

3 files changed

+78
-5
lines changed

3 files changed

+78
-5
lines changed

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

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,21 @@ 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+
2732
/**
2833
* @var \Magento\Catalog\Helper\Product\ConfigurationPool
2934
*/
3035
protected $_helperPool;
3136

37+
/**
38+
* @var \Magento\Wishlist\Model\ResourceModel\Item\Collection
39+
*/
40+
protected $_collection;
41+
3242
/**
3343
* @var \Magento\Customer\Helper\Session\CurrentCustomer
3444
*/
@@ -63,6 +73,8 @@ public function __construct(
6373
$this->_helperPool = $helperPool;
6474
$this->currentCustomer = $currentCustomer;
6575
$this->postDataHelper = $postDataHelper;
76+
$this->_scopeConfig = $context->getScopeConfig();
77+
$this->getWishlistItems();
6678
}
6779

6880
/**
@@ -77,15 +89,67 @@ protected function _prepareCollection($collection)
7789
return $this;
7890
}
7991

92+
/**
93+
* Retrieve Wishlist Product Items collection
94+
*
95+
* @return \Magento\Wishlist\Model\ResourceModel\Item\Collection
96+
*/
97+
public function getWishlistItems()
98+
{
99+
$page = ($this->getRequest()->getParam("p")) ? $this->getRequest()->getParam("p") : 1;
100+
$limit = ($this->getRequest()->getParam("limit")) ? $this->getRequest()->getParam("limit") : 10;
101+
if ($this->_collection === null) {
102+
$this->_collection = $this->_createWishlistItemCollection();
103+
$this->_prepareCollection($this->_collection);
104+
}
105+
$this->_collection
106+
->setPageSize($limit)
107+
->setCurPage($page);
108+
return $this->_collection;
109+
}
110+
80111
/**
81112
* Preparing global layout
82113
*
83-
* @return void
114+
* @return $this
84115
*/
85116
protected function _prepareLayout()
86117
{
87118
parent::_prepareLayout();
88119
$this->pageConfig->getTitle()->set(__('My Wish List'));
120+
$pager = $this->getLayout()
121+
->createBlock('Magento\Theme\Block\Html\Pager', 'wishlist_item_pager')
122+
->setUseContainer(
123+
true
124+
)->setShowAmounts(
125+
true
126+
)->setFrameLength(
127+
$this->_scopeConfig->getValue(
128+
'design/pagination/pagination_frame',
129+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
130+
)
131+
)->setJump(
132+
$this->_scopeConfig->getValue(
133+
'design/pagination/pagination_frame_skip',
134+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
135+
)
136+
)->setLimit(
137+
$this->getLimit()
138+
)
139+
->setCollection($this->_collection);
140+
$this->setChild("pager", $pager);
141+
$this->_collection->load();
142+
return $this;
143+
}
144+
145+
/**
146+
* Render pagination HTML
147+
*
148+
* @return string
149+
*/
150+
public function getPagerHtml()
151+
{
152+
return $this->getChildHtml('pager');
89153
}
90154

91155
/**

app/code/Magento/Wishlist/view/frontend/templates/view.phtml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
?>
1111

1212
<?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?>
13+
<?php if ($block->getPagerHtml()): ?>
14+
<div class="toolbar"><?php echo $block->getPagerHtml(); ?></div>
15+
<?php endif ?>
1316
<?= ($block->getChildHtml('wishlist.rss.link')) ?>
1417
<form class="form-wishlist-items" id="wishlist-view-form"
1518
data-mage-init='{"wishlist":{
@@ -51,5 +54,8 @@
5154
<input name="entity" value="<%- data.entity %>">
5255
<% } %>
5356
</form>
54-
</script>
57+
</script>
58+
<?php if ($block->getPagerHtml()): ?>
59+
<div class="toolbar"><br><?php echo $block->getPagerHtml(); ?></div>
60+
<?php endif ?>
5561
<?php endif ?>

app/design/frontend/Magento/luma/web/css/source/_extends.less

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,18 +1503,21 @@
15031503

15041504
.toolbar-amount,
15051505
.limiter {
1506-
position: relative;
15071506
z-index: 1;
1507+
display: inline-block;
15081508
}
15091509

15101510
.toolbar-amount {
15111511
.lib-css(line-height, @pager__line-height);
15121512
padding: 0;
15131513
}
15141514

1515+
.limiter {
1516+
float: right;
1517+
}
1518+
15151519
.pages {
1516-
position: absolute;
1517-
width: 100%;
1520+
display: inline-block;
15181521
z-index: 0;
15191522
}
15201523
}

0 commit comments

Comments
 (0)