techdivision / import-product

This library provides the basic function for the Magento 2 product import. This includes the import of simple products, their assignment to web pages and categories as well as the updating of the stock (not MSI) and the dynamic processing of the EAV attributes assigned to the product.
https://pacemaker.techdivision.com
MIT License
6 stars 12 forks source link

Skipping attributes #150

Open adhocore opened 4 years ago

adhocore commented 4 years ago

for example there can be many skus in a csv and some skus have values for some attribute while other skus have values for other attributes

and it maybe desirable to skip setting values for attributes for one sku but set for another.

very minimal and probably not realistic example (only to explain):

sku,color,weight
red_sku,red,
no_color_sku,,0.1

now how can we skip checking and setting weight for red_sku ad color for no_color_sku? instead of trying to set empty or 0 or some default for example aka skipping entirely?

is it possible something like this?

sku,color,weight
red_sku,red,__SKIP__
no_color_sku,__SKIP__,0.1
wagnert commented 4 years ago

@adhocore In general, if you do NOT specify a value and do NOT add the column to clean-up-empty-columns array as described in the documentation the attribute value should NOT be changed. So the __SKIP__ value should not be necessary at all. The only case where I would imagine it'll make sense is, to give you the power to do that on row level also, means that in general values will be/not be cleared but in a edge case it clean-up should be skipped when the value __SKIP__ has been set, right?

adhocore commented 4 years ago

right, both being able to control on row level and also really skipping everything - including validation callback and any other listeners or observers