@@ -669,6 +669,7 @@ protected function _findNewOptionsWithTheSameTitles()
669
669
*
670
670
* @param array $sourceProductData
671
671
* @return array
672
+ * phpcs:disable Generic.Metrics.NestingLevel
672
673
*/
673
674
protected function _getNewOptionsWithTheSameTitlesErrorRows (array $ sourceProductData )
674
675
{
@@ -697,6 +698,7 @@ protected function _getNewOptionsWithTheSameTitlesErrorRows(array $sourceProduct
697
698
* Find options with the same titles in DB
698
699
*
699
700
* @return array
701
+ * phpcs:disable Generic.Metrics.NestingLevel
700
702
*/
701
703
protected function _findOldOptionsWithTheSameTitles ()
702
704
{
@@ -730,6 +732,7 @@ protected function _findOldOptionsWithTheSameTitles()
730
732
* Find source file options, which have analogs in DB with the same name, but with different type
731
733
*
732
734
* @return array
735
+ * phpcs:disable Generic.Metrics.NestingLevel
733
736
*/
734
737
protected function _findNewOldOptionsTypeMismatch ()
735
738
{
@@ -1067,7 +1070,7 @@ protected function _isSecondaryOptionRow(array $rowData)
1067
1070
*
1068
1071
* @param array &$options
1069
1072
* @param array &$titles
1070
- * @param array $typeValues
1073
+ * @param array $typeValues
1071
1074
* @return bool
1072
1075
*/
1073
1076
protected function _isReadyForSaving (array &$ options , array &$ titles , array $ typeValues )
@@ -1414,9 +1417,9 @@ protected function _initProductsSku()
1414
1417
/**
1415
1418
* Collect custom option main data to import
1416
1419
*
1417
- * @param array $rowData
1418
- * @param int &$prevOptionId
1419
- * @param int &$nextOptionId
1420
+ * @param array $rowData
1421
+ * @param int &$prevOptionId
1422
+ * @param int &$nextOptionId
1420
1423
* @param array &$products
1421
1424
* @param array &$prices
1422
1425
* @return array|null
@@ -1454,9 +1457,9 @@ protected function _collectOptionMainData(
1454
1457
/**
1455
1458
* Collect custom option type data to import
1456
1459
*
1457
- * @param array $rowData
1458
- * @param int &$prevOptionId
1459
- * @param int &$nextValueId
1460
+ * @param array $rowData
1461
+ * @param int &$prevOptionId
1462
+ * @param int &$nextValueId
1460
1463
* @param array &$typeValues
1461
1464
* @param array &$typePrices
1462
1465
* @param array &$typeTitles
@@ -1504,7 +1507,9 @@ protected function _collectOptionTypeData(
1504
1507
$ specificTypeData = $ this ->_getSpecificTypeData ($ rowData , 0 , false );
1505
1508
//For others stores
1506
1509
if ($ specificTypeData ) {
1507
- $ typePrices [$ nextValueId ][$ this ->_rowStoreId ] = $ specificTypeData ['price ' ];
1510
+ if (isset ($ specificTypeData ['price ' ])) {
1511
+ $ typePrices [$ nextValueId ][$ this ->_rowStoreId ] = $ specificTypeData ['price ' ];
1512
+ }
1508
1513
$ typeTitles [$ nextValueId ++][$ this ->_rowStoreId ] = $ specificTypeData ['title ' ];
1509
1514
}
1510
1515
}
@@ -1513,8 +1518,8 @@ protected function _collectOptionTypeData(
1513
1518
/**
1514
1519
* Collect custom option title to import
1515
1520
*
1516
- * @param array $rowData
1517
- * @param int $prevOptionId
1521
+ * @param array $rowData
1522
+ * @param int $prevOptionId
1518
1523
* @param array &$titles
1519
1524
* @return void
1520
1525
*/
@@ -1789,30 +1794,30 @@ protected function _getPriceData(array $rowData, $optionId, $type)
1789
1794
*/
1790
1795
protected function _getSpecificTypeData (array $ rowData , $ optionTypeId , $ defaultStore = true )
1791
1796
{
1792
- $ data = false ;
1793
- $ priceData = false ;
1797
+ $ data = [] ;
1798
+ $ priceData = [] ;
1794
1799
$ customOptionRowPrice = $ rowData [self ::COLUMN_ROW_PRICE ];
1795
1800
if (!empty ($ customOptionRowPrice ) || $ customOptionRowPrice === '0 ' ) {
1796
- $ priceData = [
1797
- 'price ' => (double )rtrim ($ rowData [self ::COLUMN_ROW_PRICE ], '% ' ),
1798
- 'price_type ' => 'fixed ' ,
1799
- ];
1800
- if ('% ' == substr ($ rowData [self ::COLUMN_ROW_PRICE ], -1 )) {
1801
- $ priceData ['price_type ' ] = 'percent ' ;
1802
- }
1801
+ $ priceData ['price ' ] = (double )rtrim ($ rowData [self ::COLUMN_ROW_PRICE ], '% ' );
1802
+ $ priceData ['price_type ' ] = ('% ' == substr ($ rowData [self ::COLUMN_ROW_PRICE ], -1 )) ? 'percent ' : 'fixed ' ;
1803
1803
}
1804
1804
if (!empty ($ rowData [self ::COLUMN_ROW_TITLE ]) && $ defaultStore && empty ($ rowData [self ::COLUMN_STORE ])) {
1805
1805
$ valueData = [
1806
1806
'option_type_id ' => $ optionTypeId ,
1807
1807
'sort_order ' => empty ($ rowData [self ::COLUMN_ROW_SORT ]) ? 0 : abs ($ rowData [self ::COLUMN_ROW_SORT ]),
1808
1808
'sku ' => !empty ($ rowData [self ::COLUMN_ROW_SKU ]) ? $ rowData [self ::COLUMN_ROW_SKU ] : '' ,
1809
1809
];
1810
- $ data = ['value ' => $ valueData , 'title ' => $ rowData [self ::COLUMN_ROW_TITLE ], 'price ' => $ priceData ];
1810
+ $ data ['value ' ] = $ valueData ;
1811
+ $ data ['title ' ] = $ rowData [self ::COLUMN_ROW_TITLE ];
1812
+ $ data ['price ' ] = $ priceData ;
1811
1813
} elseif (!empty ($ rowData [self ::COLUMN_ROW_TITLE ]) && !$ defaultStore && !empty ($ rowData [self ::COLUMN_STORE ])) {
1812
- $ data = ['title ' => $ rowData [self ::COLUMN_ROW_TITLE ], 'price ' => $ priceData ];
1814
+ if ($ priceData ) {
1815
+ $ data ['price ' ] = $ priceData ;
1816
+ }
1817
+ $ data ['title ' ] = $ rowData [self ::COLUMN_ROW_TITLE ];
1813
1818
}
1814
1819
1815
- return $ data ;
1820
+ return $ data ?: false ;
1816
1821
}
1817
1822
1818
1823
/**
0 commit comments