This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hello friends,
I tried to build a product plugin using Rainlab builder plugin. This product plugin will allow my client to upload product image and product gallery and then I display the image/gallery in product-single page.
I add control - widget - fileupload, in this way I learnt from youtube that I can add below code to my Product.php file:
public $attachOne = [ 'image' => 'System\Models\File' ];
public $attachMany = [ 'gallery' => 'System\Models\File' ];
This works ok.
My problem is that I want to add control - widget - mediafinder (instead of fileupload, since some products will share same images as others, and I don't want clients to upload the same images again and again, they can just find it in the media finder and insert images into the plugin.)
When I try to create a new product, it works fine when insert an image from media, but the image disappear when I fresh the page.
How can I make similar function with attachOne and attachMany to images in media?
And apologize if my questions sounds confusing, only started to learn October CMS recently and very little knowledge in laravel and web development.
Any help would be much appreciated!
Thanks Gwon
Make sure your names are not conflicting. If you change to mediafinder
you must also remove the relationship if it has the same name. Media finder does not require an "attach" relationship to be defined, it just needs a string column in the database
I hope this helps
1-2 of 2