I'm using Magento 2 CE Version 2.1.3
Once I imported data from CSV using above script.
If put as
->setStoreId(0), then it will add two values for same Field In Database Table. One as
0 & Second As
value_id attribute_id store_id entity_id value 100 70 0 10 Test 101 70 1 10 Test <- NOT NEEDED ENTRY
70 is for
name (Product Name) from Table
Due to 2 values for Same Field. Each time have to delete Store Id 1 related value from Database respective Table, then it works fine on Frontend.
At the end data is not displaying properly as needed. Have to do each time Delete Query for Store Id in 5-6 tables.
Go to Admin -> Stores -> Configuration -> General -> General -> Single Store Mode
It always been issue. On Admin side it's taking Store Id 0 value & on frontend displays it's taking Store Id 1 Value.
Enable Single-Store Mode set to "Yes"
On Admin -> All Store Views -> Store Id = 0 -> Admin Using This On Admin -> Default Store Views -> Store Id = 1 -> Frontend Using This
What i'm still missing in Script? Does Enable Single-Store Mode set to "Yes" helps?
Other workaround will be set Admin to Default Store Views. In my case i have only 1 store. So may be works.
While we do Default Magento Import/Export. It only uses Store Id 0 & it works fine.