It much more normal to trigger the change of currency directly from the select box.

I know this is not strictly your role to help me with this but I'm guessing its just a few bits of code poked into the right places that you will have already done.

Thanks for your time,

Neil

Comments

das-peter’s picture

Status: Active » Needs work
Issue tags: +Novice

Hi Neil,

You're right that would be nice - and it wouldn't be that much work.
Sounds you know how that could be done - would be great if you would write a patch for this :)

Do you know how to create patches? If not, check this: http://drupal.org/patch

I guess the necessary change would take place in this function commerce_multicurrency_selector_form - here a hint what you could change:
FAPI - #attached
And of course there's needed some Javascript.

And even if it's a small change I should mention the Coding Standards:

Would be awesome to see a patch from you - if you need help don't hesitate and ask!

Cheers
Peter

das-peter’s picture

Category: support » feature

Marking as feature request. I'm sure a lot of others will be happy to see this too.

Aham’s picture

Hi das-peter,

Just to clarify, are we talking about the 'Currency Selector' block or the selector in the currency settings? Also, is there a best practice way to accomplish this feature request without using Drupal's '#ahah' property? AHAH seems to be a big can of worms that I would like to deal with at another time, but I would like create a patch for this module.

Can I just use the #attached property with a separate JS file in the module folder and do some jQuery magic? If the only best practice way to do this is with AHAH, then I still might do it, but I will wait to here from you.

Cheers,

Jonathan

das-peter’s picture

Hi Aham,

I'd say 1freethinker was talking about the selector where the customer set's it currency, the block provided by this module.
And #attached and an jQuery event handler / trigger are the best solution I can think of yet.

Aham’s picture

Status: Needs work » Needs review
StatusFileSize
new1.52 KB

Hi

Here are the changes suggested by das-peter. Patch need review. Enjoy!

tot ziens,

Jonathan

P.S. Any reason the git repo for this module has no branch info. Says * (no branch).

das-peter’s picture

Hey Aham thank you very much for the patch.
I just gave it a short visual review - the biggest hurdle was to download it. :)
Please don't use # in filenames ;) Otherwise to download it the people have to replace the # by %23.

In the patch itself I see only two things that should be changed before I commit it:

+//      $('select').change(function() {
+//        alert('Handler for .change() called.');
+//      });

The debug stuff shouldn't go into the official repo.

-    '#type' => 'submit',
+    '#type' => 'hidden',

I'd suggest to hide the button by JS. That way users without JS will see the normal button.

P.S. Any reason the git repo for this module has no branch info. Says * (no branch)

I'm not sure that I really got what you mean, but I'd say you didn't checkout a branch but maybe a tag? I never experienced anything special while working with the repo.

Aham’s picture

This should do it! Let me know if this is ready.

Jonathan

das-peter’s picture

Status: Needs review » Fixed

Nice :)
I've adjusted the comment of the js a bit but here it is, your first commit: http://drupalcode.org/project/commerce_multicurrency.git/commit/483eb8b

Thank you very much!

PedroMiguel’s picture

Status: Fixed » Active

das-peter, sorry to reopen but you forget to add commerce_multicurrency.js to the git.

das-peter’s picture

Status: Active » Fixed

Ouch, thanks for the hint Pedro!
File is committed now: http://drupalcode.org/project/commerce_multicurrency.git/commit/3cb4f6e
New release created: http://drupal.org/node/1446654

Automatically closed -- issue fixed for 2 weeks with no activity.