Closed (fixed)
Project:
Commerce Donate
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 Jul 2012 at 07:53 UTC
Updated:
26 Mar 2015 at 23:24 UTC
Jump to comment: Most recent
Comments
Comment #1
stella commentedThat's a nice feature. How are you doing the suggestion to round it up? a custom checkout pane? I'll change it to a float over the weekend.
Comment #2
sagraham commentedAt the moment I've not actually got anything up and running, but I was trying to think of a way to hook into the Select (or other) options and add the 'round up' value as a radio box. Not sure of effort vs reward, but it would make sense for the customer.
Comment #3
stella commentedI'll see if I can build that as an option into the module too then.
Comment #4
sagraham commentedMany thanks for creating the module. Timing was excellent as I was going to have to make an attempt at a similar module myself.
Very grateful that you've done the hard work for me!
Comment #5
aaronbaumanI think you'll probably want a decimal, actually.
Might run into rounding errors with a float, and we don't actually need to worry about floating precision.
Comment #6
aaronbaumanbumped version
Comment #7
stella commentedThis feature is available in the latest dev version.
Comment #9
tmsimont commentedwhat about sites that have data before this update? With the commit to change the field, shouldn't there have been an update function added?
I have an amount field that has data -- I'm now unable to change the field type in the Drupal UI. Do you know how I could update this integer field to decimal?
Comment #10
tmsimont commentedBasically what needs to be done is an alteration of the database in an update function. I did this all manually in phpMyAdmin:
`field_data_commerce_donate_amount.commerce_donate_amount_value`type to bedecimal(10,2)`field_revision_commerce_donate_amount.commerce_donate_amount_value`type to bedecimal(10,2)`field_config.type` = "number_decimal" WHERE `field_name` = 'commerce_donate_amount'`field_config.data`BLOB value to include this in the serialized array:That last part is a little tricky if you're doing this manually.. I had to download the BLOB file from phpMyAdmin and edit the serialized array by hand in a text editor... Basically you need to find this:
s:8:"settings";a:0:{}and replace with this:
s:8:"settings";a:3:{s:9:"precision";s:2:"10";s:5:"scale";s:1:"2";s:17:"decimal_separator";s:1:".";}I wouldn't do that unless you really know what you're doing...
Comment #11
yaworsk commentedI tried your updates but screwed something up along the way - likely the blob changes. Can you be more specific on how you did them? I downloaded the bin file, changed it in eclipse but got errors. When I redownloaded the file again (via phpmyadmin) i noticed a bunch of lines were duplicated (it went from something like a 10 line file to 18 line file - under 1kb to appoximately 10kb).
On another note, uninstalling/reinstalling the module to get this working doesn't work because tables / content are not properly removed from the database in the event anyone else is trying that. I've posted the issue here: https://drupal.org/node/1681234#comment-7935989
Comment #12
lsolesen commentedComment #13
theamoeba commented@yaworsk, for the BLOB changes I put this into a small tweaks module.
That should help. Using the above with db_change_field would work fairly well in an update function. I am happy to write a patch if necessary.
Comment #14
lsolesen commentedA patch for the update would be very nice.
Comment #15
lswhitehead commented+1
Comment #16
richH commentedHi,
there are so many patches outstanding for this module. Can you update it please? I have the problem with the latest DEV version, that if the user enters the value 100.00 into the "other amount" field, that the page won't move forward to the checkout. I've already patched the module twice and really don't want to start hacking around again.
Thanks
Rich
Comment #17
stella commentedUnfortunately Drupal's field CRUD API doesn't support the changing of field types (in this instance number_integer to number_decimal), so using field_update_field() isn't an option. The only option is to manually force it by updating the individual database tables as referred to above.
I've added an update hook which makes the required db changes now.