Why Sheets IMPORTXML doesn't honor the currency of the URL - google-sheets-formula

I'm trying to create a report for work by using ImportXML but I noticed that the result shows only the USD value and not the EUR value is on the website, Is there a reason behind that?
Here is the formula in Google Sheets
=IMPORTXML("https://www.suissegold.eu/en/category/buy-gold-coins/2021-gold-coins?&change-currency=EUR","//div[#class='info']")
I expect to get a result like:
2021 Australian Kangaroo 1 Ounce Gold Coin 1558.36 EUR
But I get it as
2021 Australian Kangaroo 1 Ounce Gold Coin 1850.24 USD
I can't figure out why it doesn't honor the URL for the EUR or any other currency and keep showing the USD.
I tried to inspect the EUR element to see the website JS function that is converting USD to EUR to know which exchange rate or from which website the exchange rate is but I failed.
Thank you in advance

try to run it via proxy:
=IMPORTXML("https://de.4everproxy.com/direct/aHR0cHM6Ly93d3cuc3Vpc3NlZ29sZC5ldS9lbi9jYXRlZ29yeS9idXktZ29sZC1jb2lucy8yMDIxLWdvbGQtY29pbnM-",
"//div[#class='info']")

Related

Xpath between 2 texts for IMPORTXML formula

I have worked out xpath which gives very close to what I need but needs some small refining.
https://www.punters.com.au/form-guide/
I want all URLs from the website racing Today and only in Australia
These are the xpaths I have now.
This one provides all the races on the page. Including all countries racing today. - //*[#class='component-wrapper form-guide-index']/table1/tbody/tr//td/a/#href
This one provides all races in Australia. But includes races today, tomorrow or any other day on the webpage - //tr[#class="upcoming-race__row"][preceding::tr[#class='upcoming-race__row upcoming-race__row--country']1[*/.="Australia"]]/td[position()>=2]/a/#href
OK. So this is the related topic :
xpath to obtain texts between 2 tags in IMPORTXML formula
To get the links of all races in Australia today (replace " with ' in GoogleSheets) :
//tr[#class="upcoming-race__row"][preceding::td[#class="upcoming-race__country-title"][1][.="Australia"]][preceding::h2[1][.="Today"]]/td[position()>=2]/a/#href
Alternative XPaths :
//h2[.="Today"]/following::table[1]//tr[#class="upcoming-race__row"][preceding::td[#class='upcoming-race__country-title'][1][.="Australia"]]/td[position()>=2]/a/#href
//div[#class="component-wrapper form-guide-index"]/table[1]//tr[#class="upcoming-race__row"][preceding::td[#class='upcoming-race__country-title'][1][.="Australia"]]/td[position()>=2]/a/#href

Currency format standard for Square?

What is the currency standard for Square's developer API and where can I find the reference for it?
{
"amount": 50,
"currency_code": "USD"
}
In example this page references the amount and currency though it does not clarify how to format currency formats, e.g. USD is the United States Dollar, what about the Canadian Dollar?
From your reference link: "Square represents the exchange as a Money object with a specific currency in ISO 4217 format and a positive or negative amount, where the amount is given in the smallest denomination of the given currency.". It means, you should use ISO 4217 for currency code. For Canadian Dollar it will be CAD.

How to Remove Trailing Zeros in XPath?

I have some not very clean 3rd party data that included numbers like:
PRICE
118.0000
99.0000
etc etc
normally would just use:
{price[1]}
but I just get price like $18,000,000.00 where it should be $118
I tried this (just guessing) ...
number{('price[1]')}
but nothing showed up for the price.
I also tried
format-number{(., 'price[1]')}
but that did not work.
Then I read I can use
translate(#Price, ',.', '.')
I tried that as
translate(#price, ',.', '.')
but no price showed
I then tried several variations using the [1] part , I'm only guessing as I'm not really a coder:
{translate(#price[1], ',.', '.')}
{translate(#price[1],',.','.')} ( I clean the spaces out)
then this one
translate(#price[1], ',.', '.')
and it finally showed a price but only as $1.00 where it should have been $1055 or another one should have been $1145 but they all showed $1.00
What can I do, it must be all on one line as it goes in my web based form to be submitted to import the data?
UPDATED:
Here is what I tried to write in the comments:
I tried these below and this is the results.I used your exact examples including the price as in the first 2 examples, then I tried with the "price" code but that is producing a $1 price again.
substring-before(118.00, '.') $11,800.00
substring-before('118.00','.')$11,800.00
substring-before('price[1]','.')$1.00
substring-before(price[1], '.')$1.00
I also tried using the brackets as I would normaly but that produces no price...
{substring-before(price[1], '.')}
{substring-before('price[1]','.')}
{substring-before('118.00','.')}
{substring-before(118.00, '.')}
I have tried to upload a much smaller copy of some of the input document and just changed some private details with "privatedomain" but I have no permission to include the links so they were deleted.
PROGRAMNAME PROGRAMURL CATALOGNAME LASTUPDATED NAME KEYWORDS DESCRIPTION SKU MANUFACTURER MANUFACTURERID UPC ISBN CURRENCY SALEPRICE PRICE RETAILPRICE FROMPRICE BUYURL IMPRESSIONURL IMAGEURL ADVERTISERCATEGORY THIRDPARTYID THIRDPARTYCATEGORY AUTHOR ARTIST TITLE PUBLISHER LABEL FORMAT SPECIAL GIFT PROMOTIONALTEXT STARTDATE ENDDATE OFFLINE ONLINE INSTOCK CONDITION WARRANTY STANDARDSHIPPINGCOST
PrivateName (deleted link) PrivateName - Product Catalog 2015-03-21 23:06:21.558 Ainsley Cuff, Gold $100-$299, cuff, gold, Open Cuff Captivatingly colorful, Kendra Scott’s collection will spruce up a basic sweater and can simultaneously fancy up a dressier cocktail frock. Her pieces have a southern influence, which brings fun, festivity, and charm to the collection’s aesthetic. 14k Gold Plated 2 Inches Wide Malleable kens-00005B Kendra Scott USD 120.0000 (deleted link) (deleted link)/jpeg_1.jpg Bracelets All Jewelry ,Designers,Shop All,All Jewelry,A-Z Designers,Shop by Occasion,Best of PrivateName,Kendra Scott,Office,Everyday,Vacation,Classic,Casual,Byzantine,Black and White,Gold,Cuff,Destination: Morocco,Back in Stock,Kendra Scott,Bracelets yes
PrivateName (deleted link) PrivateName - Product Catalog 2015-03-21 23:06:21.559 Crystal Deco Brooch $100-$299, crystal "Part of the Ben-Amun Evening Collection. Antique silver-plated over brass Clear Swarovski crystals Length 2.5"" NOTES: This product is made-to-order. Please allow up to 2-3 weeks for delivery. Expedited shipping is not available." BAMU-00037P Ben-Amun Bridal USD 195.0000 (deleted link) (deleted link)/jpg_2.jpg Brooches Collections,Shop By,Designers,Brooches,All Jewelry,Bridal,A-Z Designers,Jewelry Trends,Evening,Bridal,Deco,Crystal,Estate,Ben-Amun Bridal,Shop All yes
PrivateName (deleted link) PrivateName - Product Catalog 2015-03-21 23:06:21.559 Gold Teardrop Cutout Earrings $0-$100, gold "Wendy Mink’s jewelry mixes aspects of traditional Eastern jewelry with classic European design principles. Her pieces are carefully handmade with simple yet unexpected combinations of colors, materials, and shapes. Her collection draws inspiration from textiles created by women in India, Nepal, and Tibet—three regions she spent a great deal of time in while holding a position at the World Bank prior to reinventing herself as a jewelry designer. Gold-plated, 18kt Length 2.5"" Width 1.75"" French wire hook NOTES: This item is made to order and may take up to 3 weeks for delivery." wndm-00107E Wendy Mink USD 73.0000
Please let me know if you need anything else:
If you are using XPATH 1.0 you might be able to use substring-before(xpath, expression)
substring-before(118.00, '.')
should give 118 if I'm not mistaking.

Sagepay - The Basket format is invalid

I am trying to submit a payment to sagepay (form version 2.2) but keep getting the following error. Can anyone point me in the right direction?
Status Detail: 3021 : The Basket format is invalid.
The basket string is:
Nike Dri Fit Jersey Turtle Neck 2:3:£96.00:£0.00:£96.00:£288.00
regards
v2.22 below.
You need to include the 'Number of lines of detail in the basket field:'
Note - the 'Number of lines of detail in the basket field' is not the total number of items ordered but the total number of rows of basket information.
The shopping basket contect can be passed in a single, colon-delimited field and results in looking like your example * however you need to include the 'Number of lines of detail in the basket field' so should look like **
Your example *
Nike Dri Fit Jersey Turtle Neck 2:3:£96.00:£0.00:£96.00:£288.00
Corrected example **
1:Nike Dri Fit Jersey Turtle Neck 2:3:£96.00:£0.00:£96.00:£288.00
You should send example below -
Number of lines of detail in the basket field: 1
Item 1 Description: Nike Dri Fit Jersey Turtle Neck 2
Quantity of item 1: 3
Unit cost item 1 without tax: £96.00
Tax applied to item 1: £0.00
Cost of Item 1 including tax: £96.00
Total cost of item 1 (Quantity x cost including tax): £288.00
Multiple lines can be sent as the below and notice the 4 at the start of the example shows there would be 4 lines within the basket.
4:Pioneer NSDV99 DVD-Surround Sound System:1:£424.68:£74.32:£499.00: £499.00:Donnie Darko Director’s Cut:3:£11.91:£2.08:£13.99:£41.97: Finding Nemo:2:£11.05:£1.94:£12.99:£25.98: Delivery:---:---:---:
---:£4.99
Sage Pay now run on v3.00 where the £ symbol is not confirmed in the Basket field.
1:Nike Dri Fit Jersey Turtle Neck 2:3:96.00:0.00:96.00:288.00
If you wish to migrate/upgrade to v3.00, how to instructions is available on Sage Pay website.

What is the difference between Subtotal and BaseSubtotal?

Magento has a rich Sales module with a ton of options, and it's well-documented for high-level things, but I'm stuck when it comes to subtle distinctions. I'm trying to put together some order analytics software, but I haven't been able to figure out exactly how a Magento order's subtotal and baseSubtotal differ, nor have I been able to find API documentation to that level of detail.
The only thing I have been able to find is in the source code at app/code/core/Mage/Sales/Model, but it would seem to indicate that the values are always the same.
Order/Creditmemo/Total/Subtotal.php: $creditmemo->setSubtotal($subtotal);
Order/Creditmemo/Total/Subtotal.php: $creditmemo->setBaseSubtotal($baseSubtotal);
Order/Invoice/Total/Subtotal.php: $invoice->setSubtotal($subtotal);
Order/Invoice/Total/Subtotal.php: $invoice->setBaseSubtotal($baseSubtotal);
Quote.php: $this->setSubtotal(0);
Quote.php: $this->setBaseSubtotal(0);
Quote.php: $address->setSubtotal(0);
Quote.php: $address->setBaseSubtotal(0);
Quote.php: $this->setSubtotal((float) $this->getSubtotal() + $address->getSubtotal());
Quote.php: $this->setBaseSubtotal((float) $this->getBaseSubtotal() + $address->getBaseSubtotal());
Recurring/Profile.php: ->setBaseSubtotal($billingAmount)
Recurring/Profile.php: ->setSubtotal($billingAmount)
Do they ever differ, and if so, how?
the difference is that Subtotal is the subtotal in the customer's currency and BaseSubtotal is the subtotal in your shop's base currency.
So if you have euros and dollars installed in your shop, dollar being the base currency, when one of your european customer place an order for, let's say 100€, Subtotal will be 100.0000 and BaseSubtotal will be 150.0000 (for this example 1€ == $1.5)
HTH

Resources