@@ -669,6 +669,7 @@ protected function _findNewOptionsWithTheSameTitles()
669669 *
670670 * @param array $sourceProductData
671671 * @return array
672+ * phpcs:disable Generic.Metrics.NestingLevel
672673 */
673674 protected function _getNewOptionsWithTheSameTitlesErrorRows (array $ sourceProductData )
674675 {
@@ -697,6 +698,7 @@ protected function _getNewOptionsWithTheSameTitlesErrorRows(array $sourceProduct
697698 * Find options with the same titles in DB
698699 *
699700 * @return array
701+ * phpcs:disable Generic.Metrics.NestingLevel
700702 */
701703 protected function _findOldOptionsWithTheSameTitles ()
702704 {
@@ -730,6 +732,7 @@ protected function _findOldOptionsWithTheSameTitles()
730732 * Find source file options, which have analogs in DB with the same name, but with different type
731733 *
732734 * @return array
735+ * phpcs:disable Generic.Metrics.NestingLevel
733736 */
734737 protected function _findNewOldOptionsTypeMismatch ()
735738 {
@@ -1067,7 +1070,7 @@ protected function _isSecondaryOptionRow(array $rowData)
10671070 *
10681071 * @param array &$options
10691072 * @param array &$titles
1070- * @param array $typeValues
1073+ * @param array $typeValues
10711074 * @return bool
10721075 */
10731076 protected function _isReadyForSaving (array &$ options , array &$ titles , array $ typeValues )
@@ -1414,9 +1417,9 @@ protected function _initProductsSku()
14141417 /**
14151418 * Collect custom option main data to import
14161419 *
1417- * @param array $rowData
1418- * @param int &$prevOptionId
1419- * @param int &$nextOptionId
1420+ * @param array $rowData
1421+ * @param int &$prevOptionId
1422+ * @param int &$nextOptionId
14201423 * @param array &$products
14211424 * @param array &$prices
14221425 * @return array|null
@@ -1454,9 +1457,9 @@ protected function _collectOptionMainData(
14541457 /**
14551458 * Collect custom option type data to import
14561459 *
1457- * @param array $rowData
1458- * @param int &$prevOptionId
1459- * @param int &$nextValueId
1460+ * @param array $rowData
1461+ * @param int &$prevOptionId
1462+ * @param int &$nextValueId
14601463 * @param array &$typeValues
14611464 * @param array &$typePrices
14621465 * @param array &$typeTitles
@@ -1504,7 +1507,9 @@ protected function _collectOptionTypeData(
15041507 $ specificTypeData = $ this ->_getSpecificTypeData ($ rowData , 0 , false );
15051508 //For others stores
15061509 if ($ specificTypeData ) {
1507- $ typePrices [$ nextValueId ][$ this ->_rowStoreId ] = $ specificTypeData ['price ' ];
1510+ if (isset ($ specificTypeData ['price ' ])) {
1511+ $ typePrices [$ nextValueId ][$ this ->_rowStoreId ] = $ specificTypeData ['price ' ];
1512+ }
15081513 $ typeTitles [$ nextValueId ++][$ this ->_rowStoreId ] = $ specificTypeData ['title ' ];
15091514 }
15101515 }
@@ -1513,8 +1518,8 @@ protected function _collectOptionTypeData(
15131518 /**
15141519 * Collect custom option title to import
15151520 *
1516- * @param array $rowData
1517- * @param int $prevOptionId
1521+ * @param array $rowData
1522+ * @param int $prevOptionId
15181523 * @param array &$titles
15191524 * @return void
15201525 */
@@ -1789,30 +1794,30 @@ protected function _getPriceData(array $rowData, $optionId, $type)
17891794 */
17901795 protected function _getSpecificTypeData (array $ rowData , $ optionTypeId , $ defaultStore = true )
17911796 {
1792- $ data = false ;
1793- $ priceData = false ;
1797+ $ data = [] ;
1798+ $ priceData = [] ;
17941799 $ customOptionRowPrice = $ rowData [self ::COLUMN_ROW_PRICE ];
17951800 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 ' ;
18031803 }
18041804 if (!empty ($ rowData [self ::COLUMN_ROW_TITLE ]) && $ defaultStore && empty ($ rowData [self ::COLUMN_STORE ])) {
18051805 $ valueData = [
18061806 'option_type_id ' => $ optionTypeId ,
18071807 'sort_order ' => empty ($ rowData [self ::COLUMN_ROW_SORT ]) ? 0 : abs ($ rowData [self ::COLUMN_ROW_SORT ]),
18081808 'sku ' => !empty ($ rowData [self ::COLUMN_ROW_SKU ]) ? $ rowData [self ::COLUMN_ROW_SKU ] : '' ,
18091809 ];
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 ;
18111813 } 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 ];
18131818 }
18141819
1815- return $ data ;
1820+ return $ data ?: false ;
18161821 }
18171822
18181823 /**
0 commit comments