Hi again,
I have a strange issue. I have created a small piece of code where I am loading products and prices with the following commerce function
commerce_product_load()
Up to today this was working fine, when the currency was changed as 'commerce_price' was set with the appropriate price and currency code. But now this doesn't seem to change with a change in currency. However the currency does change for the normal product individual node created by commerce.
I'm not sure whether its related but I also get this warning from time to time:
Notice: Use of undefined constant COMMERCE_ROUND_HALF_UP - assumed 'COMMERCE_ROUND_HALF_UP' in commerce_multicurrency_default_rules_configuration() (sites/all/modules/commerce_multicurrency/commerce_multicurrency.rules_defaults.inc).
I have reverted the "Set the currency price" rule, but no change.
I havent altered anything in commerce or your module expect I am overwriting commerce-multicurrency-selector-menu.tpl.php within my theme.
Comments
Comment #1
das-peter commentedHi chazsmi,
I've just pushed a potential fix into the repo and created a dev release. Please give it a try and tell me if it works.
(If no archive is ready for download and you don't want to wait you can checkout straight from the repo)
Looks my earlier assumption, that the commerce module is always load when
hook_default_rules_configuration()is triggered, was wrong. Thus I added adrupal_load('module', 'commerce');tocommerce_multicurrency_default_rules_configuration()to ensure the constants defined by the commerce module are set.Comment #2
chazsmi commentedHi das-peter,
Thanks for that, I'm not authorized to view your dev release, (http://drupal.org/node/1330180)..?
Comment #3
das-peter commentedLooks like access is blocked until the archives are created - as far as I know this is done once per day. But I don't know when :|
Meanwhile I suggest you fetch directly from the git repo or you make the code change yourself to check if it works.
Comment #4
chazsmi commentedI got the update from the git repo. Its doesn't seem to have changed a lot, interestingly I normally get the notice when clearing my cache.
Comment #5
das-peter commentedBelieve me or not, but I know exactly only one line of code was added - I guess that's because I made that change ;)
What I'm really interested in, is if the change fixed the problem for you? If so I could create another proper release...
Comment #6
chazsmi commentedSorry think you miss understand me. It hasn't changed a lot, meaning the problem is still there :)
Comment #7
das-peter commentedNow we've a real problem - because all these rounding constants are declared in
commerce.module.If an explicit include of the module file ( here done with
drupal_load('module', 'commerce');) doesn't help I've no idea what else to do.In fact it looks like your
commerce.modulefile doesn't contain these constant definitions.Could you check that?
Comment #8
Ranko commentedHi guys,
I took a look at my commerce.module as well as a freshly downloaded one, and there is no COMMERCE_ROUND_HALF_UP in commerce.module.
Comment #9
das-peter commented@Ranko: Thank you very much for this hint!
I was always testing with the latest dev of commerce :|
Unfortunately theses constants were introduced later: http://drupalcode.org/project/commerce.git/commit/72c9efa8949c97e35b7afd...
I've just committed a change that introduces a "version-check" for the rules generation: http://drupalcode.org/project/commerce_multicurrency.git/commit/7f1f469
Please give the latest dev a try.
Comment #10
Ranko commentedI applied the patch and droped my cache, no error. Will look around more through the weekend. But so far it looks OK, thanks!
Comment #11
das-peter commentedLooks like this is fixed. Will create another release soon.