@@ -1504,6 +1504,7 @@ protected function _collectOptionTypeData(
1504
1504
$ specificTypeData = $ this ->_getSpecificTypeData ($ rowData , 0 , false );
1505
1505
//For others stores
1506
1506
if ($ specificTypeData ) {
1507
+ $ typePrices [$ nextValueId ][$ this ->_rowStoreId ] = $ specificTypeData ['price ' ];
1507
1508
$ typeTitles [$ nextValueId ++][$ this ->_rowStoreId ] = $ specificTypeData ['title ' ];
1508
1509
}
1509
1510
}
@@ -1788,29 +1789,30 @@ protected function _getPriceData(array $rowData, $optionId, $type)
1788
1789
*/
1789
1790
protected function _getSpecificTypeData (array $ rowData , $ optionTypeId , $ defaultStore = true )
1790
1791
{
1792
+ $ data = false ;
1793
+ $ priceData = false ;
1794
+ $ customOptionRowPrice = $ rowData [self ::COLUMN_ROW_PRICE ];
1795
+ 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
+ }
1803
+ }
1791
1804
if (!empty ($ rowData [self ::COLUMN_ROW_TITLE ]) && $ defaultStore && empty ($ rowData [self ::COLUMN_STORE ])) {
1792
1805
$ valueData = [
1793
1806
'option_type_id ' => $ optionTypeId ,
1794
1807
'sort_order ' => empty ($ rowData [self ::COLUMN_ROW_SORT ]) ? 0 : abs ($ rowData [self ::COLUMN_ROW_SORT ]),
1795
1808
'sku ' => !empty ($ rowData [self ::COLUMN_ROW_SKU ]) ? $ rowData [self ::COLUMN_ROW_SKU ] : '' ,
1796
1809
];
1797
-
1798
- $ priceData = false ;
1799
- $ customOptionRowPrice = $ rowData [self ::COLUMN_ROW_PRICE ];
1800
- if (!empty ($ customOptionRowPrice ) || $ customOptionRowPrice === '0 ' ) {
1801
- $ priceData = [
1802
- 'price ' => (double )rtrim ($ rowData [self ::COLUMN_ROW_PRICE ], '% ' ),
1803
- 'price_type ' => 'fixed ' ,
1804
- ];
1805
- if ('% ' == substr ($ rowData [self ::COLUMN_ROW_PRICE ], -1 )) {
1806
- $ priceData ['price_type ' ] = 'percent ' ;
1807
- }
1808
- }
1809
- return ['value ' => $ valueData , 'title ' => $ rowData [self ::COLUMN_ROW_TITLE ], 'price ' => $ priceData ];
1810
+ $ data = ['value ' => $ valueData , 'title ' => $ rowData [self ::COLUMN_ROW_TITLE ], 'price ' => $ priceData ];
1810
1811
} elseif (!empty ($ rowData [self ::COLUMN_ROW_TITLE ]) && !$ defaultStore && !empty ($ rowData [self ::COLUMN_STORE ])) {
1811
- return ['title ' => $ rowData [self ::COLUMN_ROW_TITLE ]];
1812
+ $ data = ['title ' => $ rowData [self ::COLUMN_ROW_TITLE ], ' price ' => $ priceData ];
1812
1813
}
1813
- return false ;
1814
+
1815
+ return $ data ;
1814
1816
}
1815
1817
1816
1818
/**
@@ -1868,7 +1870,9 @@ protected function _saveTitles(array $titles)
1868
1870
{
1869
1871
$ titleRows = [];
1870
1872
foreach ($ titles as $ optionId => $ storeInfo ) {
1871
- foreach ($ storeInfo as $ storeId => $ title ) {
1873
+ //for use default
1874
+ $ uniqStoreInfo = array_unique ($ storeInfo );
1875
+ foreach ($ uniqStoreInfo as $ storeId => $ title ) {
1872
1876
$ titleRows [] = ['option_id ' => $ optionId , 'store_id ' => $ storeId , 'title ' => $ title ];
1873
1877
}
1874
1878
}
@@ -1963,7 +1967,9 @@ protected function _saveSpecificTypeTitles(array $typeTitles)
1963
1967
{
1964
1968
$ optionTypeTitleRows = [];
1965
1969
foreach ($ typeTitles as $ optionTypeId => $ storesData ) {
1966
- foreach ($ storesData as $ storeId => $ title ) {
1970
+ //for use default
1971
+ $ uniqStoresData = array_unique ($ storesData );
1972
+ foreach ($ uniqStoresData as $ storeId => $ title ) {
1967
1973
$ optionTypeTitleRows [] = [
1968
1974
'option_type_id ' => $ optionTypeId ,
1969
1975
'store_id ' => $ storeId ,
0 commit comments