Skip to content

Commit 068c62f

Browse files
committed
Merge remote-tracking branch 'tango/MC-19060' into pr_vk_2019_08_16
2 parents ac50db3 + e53844a commit 068c62f

File tree

2 files changed

+26
-5
lines changed
  • app/code/Magento
    • Backend/view/adminhtml/templates/widget
    • Wishlist/Model/ResourceModel/Item/Collection

2 files changed

+26
-5
lines changed

app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $numColumns = $block->getColumns() !== null ? count($block->getColumns()) : 0;
2323
<?php if ($block->canDisplayContainer()) : ?>
2424
<div id="<?= $block->escapeHtml($block->getId()) ?>" data-grid-id="<?= $block->escapeHtml($block->getId()) ?>">
2525
<?php else : ?>
26-
<?= $block->getLayout()->getMessagesBlock()->getGroupedHtml() ?>
26+
<?= $block->getLayout()->getMessagesBlock()->getGroupedHtml() ?>
2727
<?php endif; ?>
2828

2929
<div class="admin__data-grid-header admin__data-grid-toolbar">

app/code/Magento/Wishlist/Model/ResourceModel/Item/Collection/Grid.php

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/**
8-
* Wishlist item collection grouped by customer id
9-
*/
107
namespace Magento\Wishlist\Model\ResourceModel\Item\Collection;
118

129
use Magento\Customer\Controller\RegistryConstants as RegistryConstants;
1310

1411
/**
12+
* Wishlist item collection grouped by customer id
13+
*
1514
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1615
*/
1716
class Grid extends \Magento\Wishlist\Model\ResourceModel\Item\Collection
@@ -98,7 +97,12 @@ protected function _initSelect()
9897
parent::_initSelect();
9998
$this->addCustomerIdFilter(
10099
$this->_registryManager->registry(RegistryConstants::CURRENT_CUSTOMER_ID)
101-
)->resetSortOrder()->addDaysInWishlist()->addStoreData();
100+
)
101+
->resetSortOrder()
102+
->addDaysInWishlist()
103+
->addStoreData()
104+
->setVisibilityFilter()
105+
->setInStockFilter();
102106
return $this;
103107
}
104108

@@ -122,6 +126,18 @@ public function setOrder($field, $direction = self::SORT_ORDER_DESC)
122126
}
123127
}
124128

129+
/**
130+
* Add quantity to filter
131+
*
132+
* @param string $field
133+
* @param array $condition
134+
* @return \Magento\Wishlist\Model\ResourceModel\Item\Collection
135+
*/
136+
private function addQtyFilter(string $field, array $condition)
137+
{
138+
return parent::addFieldToFilter('main_table.' . $field, $condition);
139+
}
140+
125141
/**
126142
* Add field filter to collection
127143
*
@@ -146,6 +162,11 @@ public function addFieldToFilter($field, $condition = null)
146162
if (!isset($condition['datetime'])) {
147163
return $this->addDaysFilter($condition);
148164
}
165+
break;
166+
case 'qty':
167+
if (isset($condition['from']) || isset($condition['to'])) {
168+
return $this->addQtyFilter($field, $condition);
169+
}
149170
}
150171
return parent::addFieldToFilter($field, $condition);
151172
}

0 commit comments

Comments
 (0)