Hello,
I'm trying to produce price quotes based on a form submission (quantity/product type), using prices defined in user profiles of providers (for each product type).
I have created a basic form with the Webform module and have added the computed_field module alongside it and am now stuck with getting my head around where I do the [product type price*quantity] calculation, and how to then display a range of these on a new page in a list.
My plan so far is this:
1) Get the user to add service prices to their profile (so far so good, this is done)
2) When the form is submitted, call all prices for product type from the database of providers - Content Profile module (not done)
3) Multiply these by the quantity submitted in the Webform form (not done)
4) Return these prices in a table to be compared (using Views? - not done)
- Do I use the Webform module's 'additional processing' feature or the computed_price module?
- What kind of field/view combos would help here?
Comments
Still hacking away...
I have created a field type for Webform with computed_field.
This isn't showing up in Views. If it can possibly be used in Views, could I pull data from the Webform, run a quick calculation (quantity_in_form*price_in_database) with computed field and show the resulting prices in a Views display?
Is what I'm talking about even feasible?
Further update
I've dropped Webform, replaced with CCK. Feels like I'm getting closer, but still can't quite fit it all together:
- A computed field has been added to the form (that should multiply the quantity submitted by the price in the user profile).
- I want to display the computed field results in views, alongside the company information.
- The end user can then compare prices from different companies.
- The Computed Field has been added to the view, but *how do I get the CCK form data to then appear in a Views Display?*
- A views Display has been created, but I can't populate it or see the link between the display and the form.
Thanks for reading.
Advanced yet help is still required; update
Getting the computed field's "Computed Code" section to calculate the field_quantity_value (from the table content_type_type_pcrform) * by a price (set as integers on fid 14-24 in table profile_values) in the profile is proving hard.
Is it possible to use computed field to pull a value from another table in the database?
When the code falls into place (it will, I'm determined) then I figured I could just link to the Views display with a "See Results" link. More elegant ways to do this would be welcome.
Thanks to anyone who can offer any suggestions.
Closer still
Perhaps it's bad etiquette to keep replying to my own thread, but I figured that if I provide as much info as I can, someone might understand what's going on. If I can reformulate my problem to make it easier to understand, please just ask.
Now I've stopped using the profiles to add price data - instead I created a content type and then tried to use Computed Field to access the new fields in the database - but it's still returning 0. I am using float, as the numbers are decimals (0.09, for example) and I don't think I'm rounding anything up or down. A typical calculation should be (0.09*2000) for price*quantity.
Here's what I thought would work, based on a similar case that was a success*:
Still no joy though. Where am I going wrong?
*Similar issue here: http://drupal.org/node/298951#comment-978040
Hi, subscribing, I know what
Hi, subscribing, I know what you are going through..I keep answering my own thread also. May be using eclipse with debugging will help you. See my solo thread from here: http://drupal.org/node/290622#comment-2430096
Good luck, no time to help you, bussy figuring out my own thingies..
Greetings, Martijn
Subscribing, similar case
I'm having a similar issue, still deciding between dropping webform and embracing CCK. I'm working on a site just for authenticated users, maybe using 'create CCK content' as a form sort of thing (plz tell me If I'm crazy). Some brief following:
I need people to fill out some data, make some calculations like the ones your doing and display them in a 'cute' View rearranging the submitted data and displaying the computed fields (CCK winning so far cause of this). Like a printable report..
The fact is that I'm in no position to help you cause I'm just beginning to dig into it.
..just now your not alone xD
Hello, I also have some
Hello,
I also have some requirement like this.
My plan is to make a form with some CCK field (I won't make DB for it as I don't have to save searched data). I will calculate the submitted values with my hardcoded values and compare the CCK fields value of nodes which I have to compare using while. If conditions match then will save the data and after completing this will show all the results with link to the node below the form.
Lets see what happens...
Thanks,
RajeevK
Rajeev Kumar,
@drupler@bihar.social (ActivityPub)