Closed (fixed)
Project:
Ubercart
Version:
7.x-3.5
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Jul 2013 at 15:33 UTC
Updated:
23 Sep 2013 at 08:01 UTC
Jump to comment: Most recent file
Hi there,
why this module doesn't work in a order file field?
I'm using Ubercart 3 and Drupal 7
Thank you in advance
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 2040889-entity-hooks.patch | 3.59 KB | longwave |
Comments
Comment #1
decipheredBecause for some odd reason the creation of an Ubercart order doesn't trigger hook_entity_*(), which implies that it's not really a valid entity or it's doing something weird that doesn't let other contrib play nicely with it.
In either case, it's Ubercarts problem (until proven otherwise) and there's not much I can do to help.
Cheers,
Deciphered.
Comment #2
tr commentedIf you're talking about Ubercart file downloads, Ubercart doesn't use File fields for that because those wouldn't allow us to control access and download limits like we need to for a paid file download.
Comment #3
decipheredNo, he's talking about attaching a File based field to the Order entity, or atleast that's what I did based of his issue. I can't say why one would do that, just that it should work.
Basically, add a File field to the Order entity with some File (Field) Path settings, then manually create an order, if hook_entity_insert or hook_entity_update where being triggered the file would get renamed as per the configuration, but in my local testing neither hook was being called on the creation of the order, which is very odd, because all Entities trigger these hooks.
Comment #4
longwave@mavdiablo: Please give more details on your problem, including steps to reproduce - you presumably added a file field to an order, where did you then try to use this field? Include URLs and any configuration changes you made.
Comment #5
mavdiablo commentedI'm sorry.
I posted my question in the wrong place.
I had to post it on the module file (field) paths.
When a user complete an order, the administrator should be able to upload a file in order entity by the administration side and the user is able to view it in his order history.
Unfortunately, when the administrator loads the file, the rules set by file field paths module are not applied.
Comment #6
longwaveComment #7
decipheredYou should keep in mind that File (Field) Paths not working is just a symptom of a greater issue. Any module that relies on hook_entity_update/insert/etc will also fail in this scenario, not just File (Field) Paths.
Comment #8
longwaveThe attached patch adds the entity presave, insert, update and delete hooks, including a test borrowed from entity module. I haven't actually tested this with Filefield Paths, if someone can do this and confirm it works it can be committed.
Comment #9
longwaveBriefly tested this with Filefield Paths, files attached to orders are correctly moved and renamed now where they were not before. Committed.