• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Order With Multiple Images Uploaded

startpoint

Active Member
I want to make application for user orders. Each order will have several fields. Each order must have uploaded images from the user. After sending the user should be able to reorder the uploaded images. Possible to adjust certain amounts already filled fields. Once everything is OK to finalize your order. Then you can not edit, but can only delete it or create a new order.
I created these two lists:

1) list 'tp_order'
id, date_time, username, status ... some fields

2) list 'tp_images'
id, date_time, order_id, ordering, image_upload

Element 'order_id' from list 'tp_images' now database joined with the element 'id' from list 'tp_order'.
IN list 'tp_order' in tab Data-> Releated Data I set to 'yes' link to list 'Images'. Thus created the column 'Images For Order'. Through it can be added a new image to the order . After selecting a image and then 'save' the user is redirected to the list of orders. Furthermore, there is a link to a list of all images from this order, where user can delete a image or all images and to change their order with handle.
The idea that I want to accomplish is the following:
- User can create a new order by filling in the required fields - done;
- See only their orders - done;
- User can add a number of images to a order (eg 5). After reaching the maximum can not add another;
- Images must be saved in a folder with value from element 'order_id';
- To list 'tp_order' I added php plugin, which created a button to each row of the list with name 'Send Order'. He must be inactive. After reaching the maximum number of images, button should become active. It would have to be displayed in read-only data form with order and her images, must have explanatory text and a button through which to finalize the order by sending a e-mail to user and site administrator and set element 'Status' to 'closed' and order row must to be read-only.

Share how you can implement the project. If there is an easier way I tried it.
All your help is important for me.

?ccess data for my site is filled in the section "My sites".
Logins for details and test:
user: test
pwd: test
 
Rather than using related data, did you try creating a list join on orders, from order.id to images.order_id, and setting it to repeat?

That way you will have a repeat group on your main order form, with the images in it, and you can set a max number of repeats in the Group settings for it.

-- hugh
 
I'll see if I can duplicate the file upload issues locally.

For limiting the number of images doing it this way (with related data), we have a form plugin that does that, called 'limit'. I haven't used it for a while, but I think it still works. Give it a go. Should let you limit the number of rows (forms) any given user can submit on a list. You just tell it which element is the user element.

-- hugh
 
About the plugin 'limit' - i tried it, but as I understand it restricts users not to be able to add a new row to the whole list. I need to not be able to add new row list who related to a particular order, but another to be able to add new row until it reaches the limit of order.
I could not figure out how to apply the plugin through the second option. Maybe it happens, what I want. If so, ask for a little more clarification.
Sorry for my bad english.
 
Hmmm, yes, you are correct.

I think the only way to do this would be with some custom code, or by adding an option to the limit plugin, so you can specify an element to group the count by. In your case, it would be grouping by the FK which relates that row to the parent order.

I'll look at adding that option now.

Apologies for the delay.

-- hugh
 
OK, I've added a new option to the limit plugin, "Grouping Element", which lets you specify an element you want to use in addition to the userid in the limit count, which the plugin can find in the query string data.

So in your case, you would select the order_id element for this new setting. When you use the "Add" button from the related data link on the order table, Fabrik automatically adds &images___order_id=234 (or whatever the FK element and value is) to the new form URL for the image form. So the limit plugin will use that 'X' value in the limit query, so it becomes "WHERE images.userid = 123 AND images.order_id = 234".

I think this should solve your problem. New code is in github as of this commit:

https://github.com/Fabrik/fabrik/commit/755725d782e16b3383ef6ab4d9177293a8f3f697

... and you'll need to doa github update to grab the new code.

-- hugh
 
Hi,
Thank you for your support.

I did a update from GitHub of the necessary files, but again limit the number of images to upload depends on the user id.
My settings on form limit plugin in list 'Images':
User element: 'user' (this is a userid)
Limit Lenght: 2
Grouping element: 'order_id'
Lest something wrong in the settings?

Regards
 
Can you point me at the list from which you are using the related data "Add" link to go to the form where you add the image?

The changes I made worked for me, so the limit is applied per-user, "grouped" by the parent ID I'm using for my test.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top