If a user selects "no reward" and enters any amount, the last two zeros are considered decimal and are parsed the same way the goal amount is parsed. For example 1580 will be 15.80

I was also wondering why the goal is designed to be entered that way.

Comments

shadysamir’s picture

Same for when you select a reward and set the value greater than that of the reward, in that case it uses the field value and is parsed the same way.

AMP23’s picture

I know we shouldn't be hacking modules, but if anyone needs a quick fix for this issue, I simply edited the file PledgeSelection.php found in lib/Drupal/crowdfunding/FormControllers at line 99 from:

$pledge_amount = str_replace(array(',', '.'), '', $form_state['values']['pledge']);
$Reward = \Drupal\crowdfunding\Model\Reward::create($form_state['values']['reward']);

to:

$pledge_amount = str_replace(array(',', '.'), '', $form_state['values']['pledge']);
$pledge_amount = $pledge_amount*100;
$Reward = \Drupal\crowdfunding\Model\Reward::create($form_state['values']['reward']);
joaogarin’s picture

You could try to provide a patch with this fix. I haven't reached this point but will try to test this and provide a patch

You can see how to make patches here : https://www.drupal.org/node/707484

Yuri’s picture

I think that this module should be used: https://www.drupal.org/project/commerce_currency taking into account that crowdfunding is generally not limited to one currency or country.

tabestan’s picture

Here's the patch for #2.

pedrorocha’s picture

Priority: Normal » Major
pedrorocha’s picture

Status: Active » Closed (fixed)

Fixed and commited.