I'm facing problem in retrieving all product images when i try edit product. So the scenario is that I've separate product_images table where I store multiple images of a product.
Now for instance a product already have 3 images and user wants to add 4th image, or in other case, if a user wants to delete 3rd image only. In both of these scenarios I have to sync all images. How can I achieve this on edit page? because i think input type file values can not be set like input type text values.
You would have to unlink image just before storing new.
You can add a button to add another image if needed. Also in edit page, have a delete button by each image in case user wants to delete existing, but remember the field needs an edit as well.
I can also sync images but the problem is that when I submit the form the product_images[] array goes empty. Because none of the file inputs are set with previously stored images!
Only include the images that needs edit. You will need some if statements in update method to determine what is existing versus what is new or different.