Skip to content

Commit fd52253

Browse files
committed
PB-107: Display total number of products matched into ProductsList
- populate total number of products
1 parent 5164285 commit fd52253

File tree

2 files changed

+49
-73
lines changed

2 files changed

+49
-73
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/form/element/product-totals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ define([
7373
);
7474
}.bind(this)
7575
).fail(function () {
76-
this.value($t("An unknown error occurred. Please try again."));
76+
this.value($t('An unknown error occurred. Please try again.'));
7777
}.bind(this));
7878
}, 10),
7979
});

dev/tests/integration/testsuite/Magento/PageBuilder/Controller/Adminhtml/Form/Element/ProductTotalsTest.php

Lines changed: 48 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -52,119 +52,95 @@ public function testProductTotals($condition, $expectedTotal, $expectedDisabled)
5252
public function productDataProvider()
5353
{
5454
return [
55-
// category with no products
56-
[
57-
[
58-
'1' => [
59-
'aggregator' => 'all',
60-
'new_child' => '',
61-
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Combine::class,
62-
'value' => '1',
55+
[ // category with no products
56+
['1' => [
57+
'aggregator' => 'all',
58+
'new_child' => '',
59+
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Combine::class,
60+
'value' => '1',
6361
],
6462
'1--1' => [
6563
'operator' => '==',
6664
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Product::class,
6765
'attribute' => 'category_ids',
6866
'value' => '4'
69-
],
70-
],
71-
0,
72-
0
67+
]
68+
], 0, 0
7369
],
74-
// category with 4 products, 1 disabled
75-
[
76-
[
77-
'1' => [
78-
'aggregator' => 'all',
79-
'new_child' => '',
80-
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Combine::class,
81-
'value' => '1',
70+
[ // category with 4 products, 1 disabled
71+
['1' => [
72+
'aggregator' => 'all',
73+
'new_child' => '',
74+
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Combine::class,
75+
'value' => '1',
8276
],
8377
'1--1' => [
8478
'operator' => '==',
8579
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Product::class,
8680
'attribute' => 'category_ids',
8781
'value' => '3'
88-
],
89-
],
90-
4,
91-
1
82+
]
83+
], 4, 1
9284
],
93-
// sku with no matches
94-
[
95-
[
96-
'1' => [
97-
'aggregator' => 'all',
98-
'new_child' => '',
99-
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Combine::class,
100-
'value' => '1',
85+
[ // sku with no matches
86+
['1' => [
87+
'aggregator' => 'all',
88+
'new_child' => '',
89+
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Combine::class,
90+
'value' => '1',
10191
],
10292
'1--1' => [
10393
'operator' => '()',
10494
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Product::class,
10595
'attribute' => 'sku',
10696
'value' => 'shoes'
107-
],
108-
],
109-
0,
110-
0
97+
]
98+
], 0, 0
11199
],
112-
// sku with 2 matches, 1 disabled
113-
[
114-
[
115-
'1' => [
116-
'aggregator' => 'all',
117-
'new_child' => '',
118-
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Combine::class,
119-
'value' => '1',
100+
[ // sku with 2 matches, 1 disabled
101+
['1' => [
102+
'aggregator' => 'all',
103+
'new_child' => '',
104+
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Combine::class,
105+
'value' => '1',
120106
],
121107
'1--1' => [
122108
'operator' => '()',
123109
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Product::class,
124110
'attribute' => 'sku',
125111
'value' => 'simple-3, simple-4'
126-
],
127-
],
128-
2,
129-
1
112+
]
113+
], 2, 1
130114
],
131-
// condition with no matches
132-
[
133-
[
134-
'1' => [
135-
'aggregator' => 'all',
136-
'new_child' => '',
137-
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Combine::class,
138-
'value' => '1',
115+
[ // condition with no matches
116+
['1' => [
117+
'aggregator' => 'all',
118+
'new_child' => '',
119+
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Combine::class,
120+
'value' => '1',
139121
],
140122
'1--1' => [
141123
'operator' => '>=',
142124
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Product::class,
143125
'attribute' => 'price',
144126
'value' => '10000'
145-
],
146-
],
147-
0,
148-
0
127+
]
128+
], 0, 0
149129
],
150-
// condition with 3 matches, 1 disabled
151-
[
152-
[
153-
'1' => [
154-
'aggregator' => 'all',
155-
'new_child' => '',
156-
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Combine::class,
157-
'value' => '1',
130+
[ // condition with 3 matches, 1 disabled
131+
['1' => [
132+
'aggregator' => 'all',
133+
'new_child' => '',
134+
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Combine::class,
135+
'value' => '1',
158136
],
159137
'1--1' => [
160138
'operator' => '<',
161139
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Product::class,
162140
'attribute' => 'price',
163141
'value' => '20'
164-
],
165-
],
166-
3,
167-
1
142+
]
143+
], 3, 1
168144
],
169145
];
170146
}

0 commit comments

Comments
 (0)