Comma in currency exchange API? - url-parameters

I am using https://wahrungsrechner.org/api/ to get the target currency amount for a source currency amount.
This works: Link
This does not work due to the , at the quantity, it always uses 1 as quantity: Link
I tried with . instead of , without success. Anyone any ideas what else I might try?
Thanks

Related

User facing date field granularity control

I'm trying to give my users the option to select the date field granularity of their choice, such as day, week, month or year. This is normally controlled on each graph in the menu show below but this isn't available in a published dashboard:
My first idea was to create a calculated field that truncates my desired date based on a parameter that I expose through a control. This would like something like this, truncDate(${intervalParameter}, {dateColumn}). The problem with this is that the first argument of the truncDate function must one of valid string literals and will throw an error before saving if it isn't.
Does anyone know of any other ways of achieving this? Or maybe some sneaky way of getting around the error?
I figured out a work around using ifElse.
ifElse(
${intervalParameter} = 'Day', truncDate("DD", {dateColumn}),
${intervalParameter} = 'Week', truncDate("WK", {dateColumn}),
${intervalParameter} = 'Month', truncDate("MM", {dateColumn}),
truncDate("DD", {dateColumn})
)
There might be better solutions out there but this is what I've come up with.

Change Magento decimal field format

I need to change Magento's default decimal format. I mean, when I save '1' to a decimal field, it becomes '10000.0000' with this '.0000' in the end.
I need to change it to another format, which uses ',' instead of '.' to separate decimal (and currency) numbers.
This is the Brazilian standard and it's not being used even after changing the store language. This change should be reflected mainly in the admin side.
Thanks a lot!
==Edited==
I haven't solved the problem yet. I'm using PT-BR (Brazilian Portuguese) as default language and it still using the wrong decimal character.
It seems Magento have some not-localized price formatting (I mean, hard-coded) in a few points of code. For example: magento\js\prototype\validation.js at line 426 have:
|| (!isNaN(parseNumber(v)) && /^\s*-?\d*(\,\d*)?\s*$/.test(v));
but instead it needs to be
|| (!isNaN(parseNumber(v)) && /^\s*-?\d*(\,\d*)?\s*$/.test(v));
to fit into PT-BR format (or other locales to).
Am I right? Does anybody could fix this issue?
if you want to check in admin area for this change
you go to in admin left bottom drop down
and select
Português (Portugal) / português (Portugal)
it will show you currency as you want. Also if you doesn't install you package go to
http://www.magentocommerce.com/translations/list/19
download your package and add it to your
locale folder and select from configuration for front end also
hope this will sure help you.
I've applied the following change to the file magento\js\prototype\validation.js (line 426):
|| (!isNaN(parseNumber(v)) && /^\s*-?\d*(\,\d*)?\s*$/.test(v));
and also, changed the file lib/Varien/Data/Form/Element/Abstract.php by adding the first if statement:
public function getEscapedValue($index=null)
{
$value = $this->getValue($index);
if(is_numeric($value)){
$value= number_format($value, 3, ",", ".");
}
...
this changes have solved the problem so far. Do you see any side-effect?
Comments are welcome! Thanks!
Newer versions of Magento are based on Zend Framework currency locale format so the best way to do this is to change the language.xml from the Zend directory, more information is on this great article.

Magento charity coupon code + then ask for which charity (2 step discount for Round Table)

We have a special couponcode 10% off, 3 monhts valid.
Now the 10% goes to charity. And we use the couponcode to identify that it is in fact for charity BUT alas someone has thought up that everybody can decide for themselves which chairt it is. So ....
We need a couponcode that works (check!)
But when entered somewhere there should be an extra box asking for the "charity name"
Options I can think off is directly at coupon input, or add addressfiled (but only when coupon)
Anyone know how to do this easily? or with sme code?
Just create a coupon code for each charity and replace the coupon entrance input with a select box that lists your codes or make a additional select-box that pre-fills the coupon field with right code ?

How to display 2 prices in different currencies for an item inVirtuemar

I need to show 2 prices in different currencies on a flypage, but I haven't found a recipe for it so far. Could anyone help me?
You could probably do this by adding a new input field.
To do this, needs a little coding...
1 - Edit the file default_showprices.php in template folder (/templates/YOUR_TEMPLATE/html/com_virtuemart/productdetails/default_showprices.php)
2 - Get the currency_id ( from virtuemart admin ). For example, I use the US$ currency ID: 144.
3 - Place this code bellow in any line of the file:
echo '<b>US$: '.$this->currency->roundForDisplay($this->product->prices['salesPrice'],144,1,false).'</b>';
This code will print the price converted to US$.

How can I make a variable out of an ID that is made after the item using the ID is created?

The problem I am having is in my testing I create an order which obtains an ID. This ID is different every-time.
Here is a picture of some sample code:
Thanks in advance to any help.
--Curtis
I can't tell exactly by the code provided, but wouldn't something this simple work
testID = #browser.div(:class, /screenlet-title-bar/).text
followed by some string manipulation to trim any unnecessary space or characters:
testID.gsub(" Purchase Order #", "") #Removes leading text
Have you tried XPath? Here is a tutorial on it.
testID = #b.link(:xpath, "//a[contains(#href, '/ordermgr/control/orderview?orderID')]/").text
The output should be the ID you need. If you have multiple ID's with the same xpath, it could be a problem, didn't try that.
Good Luck,
Dave

Resources