Skip to content

Commit 130b072

Browse files
ENGCOM-3569: fixed issue #19292 for 2.3-develop #19305
- Merge Pull Request #19305 from webkul-ratnesh/magento2:issue-for-2.3-19292 - Merged commits: 1. 23e6250 2. 3ebcc33 3. edc8404 4. 4ddc22b 5. 60a0dd4 6. ce8765b 7. 4fb3c8d 8. 71ee75b 9. b153c06 10. ff416b9 11. 00a2131 12. 8923046 13. 7c5b9a5 14. dc407d9 15. 2b3deab 16. 4bfacbb 17. c41ec76 18. e068042 19. 8b06ed6 20. 5e2bbb6 21. bd89f7b 22. 35c033e 23. 4fbcf8c
2 parents 7755eef + 4fbcf8c commit 130b072

File tree

5 files changed

+93
-2
lines changed

5 files changed

+93
-2
lines changed

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

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock
2929
*/
3030
protected $_helperPool;
3131

32+
/**
33+
* @var \Magento\Wishlist\Model\ResourceModel\Item\Collection
34+
*/
35+
protected $_collection;
36+
3237
/**
3338
* @var \Magento\Customer\Helper\Session\CurrentCustomer
3439
*/
@@ -78,14 +83,63 @@ protected function _prepareCollection($collection)
7883
}
7984

8085
/**
81-
* Preparing global layout
86+
* Paginate Wishlist Product Items collection
8287
*
8388
* @return void
8489
*/
90+
private function paginateCollection()
91+
{
92+
$page = $this->getRequest()->getParam("p", 1);
93+
$limit = $this->getRequest()->getParam("limit", 10);
94+
$this->_collection
95+
->setPageSize($limit)
96+
->setCurPage($page);
97+
}
98+
99+
/**
100+
* Retrieve Wishlist Product Items collection
101+
*
102+
* @return \Magento\Wishlist\Model\ResourceModel\Item\Collection
103+
*/
104+
public function getWishlistItems()
105+
{
106+
if ($this->_collection === null) {
107+
$this->_collection = $this->_createWishlistItemCollection();
108+
$this->_prepareCollection($this->_collection);
109+
$this->paginateCollection();
110+
}
111+
return $this->_collection;
112+
}
113+
114+
/**
115+
* Preparing global layout
116+
*
117+
* @return $this
118+
*/
85119
protected function _prepareLayout()
86120
{
87121
parent::_prepareLayout();
88122
$this->pageConfig->getTitle()->set(__('My Wish List'));
123+
$this->getChildBlock('wishlist_item_pager')
124+
->setUseContainer(
125+
true
126+
)->setShowAmounts(
127+
true
128+
)->setFrameLength(
129+
$this->_scopeConfig->getValue(
130+
'design/pagination/pagination_frame',
131+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
132+
)
133+
)->setJump(
134+
$this->_scopeConfig->getValue(
135+
'design/pagination/pagination_frame_skip',
136+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
137+
)
138+
)->setLimit(
139+
$this->getLimit()
140+
)
141+
->setCollection($this->getWishlistItems());
142+
return $this;
89143
}
90144

91145
/**

app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_index.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
</referenceBlock>
1414
<referenceContainer name="content">
1515
<block class="Magento\Wishlist\Block\Customer\Wishlist" name="customer.wishlist" template="Magento_Wishlist::view.phtml" cacheable="false">
16+
<block class="Magento\Theme\Block\Html\Pager" name="wishlist_item_pager"/>
1617
<block class="Magento\Wishlist\Block\Rss\Link" name="wishlist.rss.link" template="Magento_Wishlist::rss/wishlist.phtml"/>
1718
<block class="Magento\Wishlist\Block\Customer\Wishlist\Items" name="customer.wishlist.items" as="items" template="Magento_Wishlist::item/list.phtml" cacheable="false">
1819
<block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Image" name="customer.wishlist.item.image" template="Magento_Wishlist::item/column/image.phtml" cacheable="false"/>

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

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

1212
<?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?>
13+
<div class="toolbar wishlist-toolbar"><?= $block->getChildHtml('wishlist_item_pager'); ?></div>
1314
<?= ($block->getChildHtml('wishlist.rss.link')) ?>
1415
<form class="form-wishlist-items" id="wishlist-view-form"
1516
data-mage-init='{"wishlist":{
@@ -51,5 +52,6 @@
5152
<input name="entity" value="<%- data.entity %>">
5253
<% } %>
5354
</form>
54-
</script>
55+
</script>
56+
<div class="toolbar wishlist-toolbar"><br><?= $block->getChildHtml('wishlist_item_pager'); ?></div>
5557
<?php endif ?>

app/design/frontend/Magento/blank/Magento_Wishlist/web/css/source/_module.less

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@
88
// _____________________________________________
99

1010
& when (@media-common = true) {
11+
.toolbar {
12+
&.wishlist-toolbar{
13+
.limiter {
14+
float: right;
15+
}
16+
.main .pages {
17+
display: inline-block;
18+
z-index: 0;
19+
position: relative;
20+
}
21+
.toolbar-amount, .limiter {
22+
z-index: 1;
23+
display: inline-block;
24+
}
25+
}
26+
}
27+
1128
.form.wishlist.items {
1229
.actions-toolbar {
1330
&:extend(.abs-reset-left-margin all);

app/design/frontend/Magento/luma/Magento_Wishlist/web/css/source/_module.less

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@
88
// _____________________________________________
99

1010
& when (@media-common = true) {
11+
.toolbar {
12+
&.wishlist-toolbar{
13+
.limiter {
14+
float: right;
15+
}
16+
.main .pages {
17+
display: inline-block;
18+
z-index: 0;
19+
position: relative;
20+
}
21+
.toolbar-amount, .limiter {
22+
z-index: 1;
23+
display: inline-block;
24+
}
25+
}
26+
}
27+
1128
.form.wishlist.items {
1229
.actions-toolbar {
1330
&:extend(.abs-reset-left-margin all);

0 commit comments

Comments
 (0)