Hi,
I have been trying your module, it works quite nice, I even managed to get working the discounts, but the attributes don't work. Any advice how to get them to work?
Also I'm not sure how to do it if I have 2 language site to have for each languege default currency. I did put into english sites

uc_cck_currency_set_user_currency('field_uc_usd',null,false);

, it works but after refreshing. I think I should put it into language switcher, but I don't know how.
Any advice would be appreciated
Thanks

Comments

ykyuen’s picture

i try to set the currency in hook_node_api. here is the code

function custommod_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {

	/* Determine the current language, change the price handle if necessary */
	global $language;

	if ($language->language == 'en') {
		// reset to default currency
		uc_cck_currency_set_user_currency('', null, false);
	} else if ($language->language == 'zh-hant') {
		// change currency
		uc_cck_currency_set_user_currency('field_hk_price', null, false);
	}
}

but i got the following error when i go to the node in browser

* warning: array_merge() [function.array-merge]: Argument #2 is not an array in /var/vhosts/dpshk_dev/sites/all/modules/token/token.module on line 346.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /var/vhosts/dpshk_dev/sites/all/modules/token/token.module on line 349.
* warning: array_values() [function.array-values]: The argument should be an array in /var/vhosts/dpshk_dev/sites/all/modules/token/token.module on line 350.
* warning: Invalid argument supplied for foreach() in /var/vhosts/dpshk_dev/sites/all/modules/token/token.module on line 413.
* warning: Invalid argument supplied for foreach() in /var/vhosts/dpshk_dev/sites/all/modules/pathauto/pathauto.inc on line 566.

The above errors will not appear if i am logout. and i find that the code only works only if i clear the drupal cache.

What is the proper way to change the currency in code level? it would be great if i can add this logic when user change the language at the language switcher block just like kaata suggested.

kenorb’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Drupal 6 is no longer officially supported. If you think this issue is still relevant for 8.x, feel free to re-open.