@@ -24,12 +24,14 @@ define([
24
24
insertDataFromWizard : [ ] ,
25
25
map : null ,
26
26
isEmpty : true ,
27
+ isShowAddProductButton : false ,
27
28
cacheGridData : [ ] ,
28
29
unionInsertData : [ ] ,
29
30
deleteProperty : false ,
30
31
dataLength : 0 ,
31
32
identificationProperty : 'id' ,
32
33
'attribute_set_id' : '' ,
34
+ attributesTmp : [ ] ,
33
35
listens : {
34
36
'insertDataFromGrid' : 'processingInsertDataFromGrid' ,
35
37
'insertDataFromWizard' : 'processingInsertDataFromWizard' ,
@@ -118,7 +120,9 @@ define([
118
120
tmpArray . splice ( index , 1 ) ;
119
121
120
122
if ( ! tmpArray . length ) {
123
+ this . attributesTmp = this . source . get ( 'data.attributes' ) ;
121
124
this . source . set ( 'data.attributes' , [ ] ) ;
125
+ this . cacheGridData = [ ] ;
122
126
}
123
127
124
128
if ( parseInt ( this . currentPage ( ) , 10 ) === this . pages ( ) ) {
@@ -166,7 +170,7 @@ define([
166
170
initObservable : function ( ) {
167
171
this . _super ( )
168
172
. observe ( [
169
- 'insertDataFromGrid' , 'unionInsertData' , 'isEmpty' , 'actionsListOpened'
173
+ 'insertDataFromGrid' , 'unionInsertData' , 'isEmpty' , 'isShowAddProductButton' , ' actionsListOpened'
170
174
] ) ;
171
175
172
176
return this ;
@@ -197,9 +201,13 @@ define([
197
201
var dataCount ,
198
202
elemsCount ,
199
203
tmpData ,
200
- path ;
204
+ path ,
205
+ attributeCodes = this . source . get ( 'data.attribute_codes' ) ;
201
206
202
207
this . isEmpty ( data . length === 0 ) ;
208
+ this . isShowAddProductButton (
209
+ ( ! attributeCodes || data . length > 0 ? data . length : attributeCodes . length ) > 0
210
+ ) ;
203
211
204
212
tmpData = data . slice ( this . pageSize * ( this . currentPage ( ) - 1 ) ,
205
213
this . pageSize * ( this . currentPage ( ) - 1 ) + this . pageSize ) ;
@@ -260,6 +268,10 @@ define([
260
268
tmpArray . push ( mappedData ) ;
261
269
} , this ) ;
262
270
271
+ // Attributes cannot be changed before regeneration thought wizard
272
+ if ( ! this . source . get ( 'data.attributes' ) . length ) {
273
+ this . source . set ( 'data.attributes' , this . attributesTmp ) ;
274
+ }
263
275
this . unionInsertData ( tmpArray ) ;
264
276
} ,
265
277
0 commit comments