cancel
Showing results for 
Search instead for 
Did you mean: 

While uploading prduct references to product through impex product gets auto saved

0 Kudos

I want restriction on product references for product for that i have created custom constraint to check size of product references if there then should be 5, but in case i am trying uploading product references through impex occasionally saving product and in that time constraint get called and impex is getting failed. so is any way to stop auto save of product until all data import . or there any way to import list of product references at a time.

safin
Advisor
Advisor
0 Kudos

Hi,

i just get a little confused, what do you mean by " in case i am trying uploading product references through impex occasionally saving product and in that time constraint get called and impex is getting failed.", this should be what you need, right? since you've created custom constraint to check the size of product references, if the constraint is violated, the saving certainly cannot be saved successfully! can you give more information about that?

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

safin
Advisor
Advisor
0 Kudos

Hi Sushant,

The relationship between Product and ProductReference is one to many (ProductReference is the many side), if you use impex to only import ProducReference, it should work without triggering your constraint which is used to check product references collection at product side as the product is saved

INSERT_UPDATE ProductReference;source(code,$catalogVersion)[unique=true];target(code,$catalogVersion)[unique=true];referenceType(code);active;preselected

;918735;1992693;ACCESSORIES;true;false

;918735;3514521;ACCESSORIES;true;false

...

On the other hand, please remember one-to-many relationship is itself a leak for the collection related constraint as it can perfectly bypass the check if all your change will happen at many side.

Hopefully, it help you a little.

0 Kudos

Hi Gang Li,

I am using same impex for product reference upload but wxact problem is what while uploading same ,may save product after insertion of first product reference or after other record so i want such solution where i can restrict product save call or save it after insertion of all product references.

safin
Advisor
Advisor
0 Kudos

I just said one-many relationship result in a leak for collection based constraint, that means you can always insert product references in your impex without checking the constraint, but whenever you try to update the product itself, the constraint will be checked!

There is no way for you to restrict product save call when you try to update the product itself, the only way you can do is to make sure the product uddate will happen after all related product references are inserted in your impex.

0 Kudos

Hi

Are there any solution for product update will happen after all product references insertion by impex or anyother way.

safin
Advisor
Advisor
0 Kudos

Hi,

Put it simply, (1) if you update/insert by using impex, make sure first update/insert product references, then product, (2) if you update/insert by using modelService in your code, make sure first create/update product references then product

Does that make sense?