Finding sold out product pages from URL in bulk using importXML - spreadsheet

I have to find out from tens of thousands of URLs which products are sold out. My idea was to put the URLs in a spreadsheet and get a value with importXML when it says 'sold out'. Example URL: https://www.conrad.com/p/logitech-usb-headset-h330-909899
'sold out' shown on example page
My attempt:
=IMPORTXML(A1;"//*[#id='ccpjr']/body/main/section[1]/div/div[1]/div[2]/div[1]/div/div[1]/div/div/span")
('A1' contains a URL like 'https://www.conrad.com/p/logitech-usb-headset-h330-909899')
I was hoping it would show: 'Sold out' in the cell, instead it says: Error: Imported content is empty"
I appreciate any help, but I must warn that my knowledge in this area is unfortunately limited. So I would appreciate it even more if there is a solution that is easily applicable for me.

The "Sold Out" is determined after loading. After loading, the site determines the stock quantity by calling this API url: https://www.conrad.com/restservices/COM/products/pricesAndAvailabilities?net=false&id=909899
The data returned is JSON, so you cannot use ImportXML. Instead, add this script to your sheet (Tools > Script Editor).
Then use this formula to get the stock number. (It just shows the number for stock quantity, not "Sold Out")
=ImportJSON("https://www.conrad.com/restservices/COM/products/pricesAndAvailabilities?net=false&id=909899","/body/availability/stockQuantity","noHeaders")
Note that the same item id is at the end of the original URL and also the API url, so you can use that to make the URLs you need.

Related

ebay finding api finditemsbykeywords pagination problem

I tried the following calls:
https://svcs.ebay.com/services/search/FindingService/v1?X-EBAY-SOA-OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.13.0&keywords=waschbecken&RESPONSE-DATA-FORMAT=JSON&GLOBAL-ID=EBAY-DE&outputSelector(0)=ItemSpecifics&paginationInput.entriesPerPage=100&paginationInput.pageNumber=2
then on the ebay API explorer for the post request body,
<findItemsByKeywordsRequest xmlns="http://www.ebay.com/marketplace/search/v1/services">
<keywords>waschbecken</keywords>
<paginationInput>
<entriesPerPage>100</entriesPerPage>
<pageNumber>2</pageNumber>
</paginationInput>
</findItemsByKeywordsRequest>
but I do not get 100 searchResult count per page, in Postman I get 32 searchResult and in API explorer 56; furthermore 2nd page forward I do not get any searchResult count, I am trying to understand is there something wrong that I am writing in the call or there is some another problem or any parameter I am missing.
Thanks for the help.
I am also running into this problem. I am guessing that the pagination results are for the entire store, but not for the search by keywords....Seems like they dropped the ball on this.
Sorry, I did not update on the question, I forgot about it.
The problem was not with the pagination, the problem is the variants.
Simply explained, the output of the query doesn't count for the variants listed on the Ebay search by the same seller. If you have from a same seller the same product with the different variant, the query does not show the variants from those product from the same seller just different variant, as it would if you do an ebay search.
The mechanism of the query is different as that of the product search on Ebay.

Struggling to import analyst share price to GoogleSheets

I am trying to create a column that imports the analyst price target from TipRanks website.
I uploaded two images:
Image 1: you can see the cell that I want to import.
Image 2: you can see my function that doesn't work.
What should I change in order to get this live info?
Thanks.
The site you are checking is actually "javascript" generated thus import functions won't properly work on them.
To check, just try to import the whole site data. If it returns a javascript function, then it is javascript generated.
Sample (tipranks.com)
What you can do is actually try to find other sites that provide the same data.
I did find one with the same data you are looking for, 50.38 for csiq. Link is "https://www.marketwatch.com/investing/stock/csiq/analystestimates". And since data is shown as table, it would be easier to import using importhtml.
Cell formula is:
=INDEX(IMPORTHTML("https://www.marketwatch.com/investing/stock/csiq/analystestimates", "table", 5), 2, 2)
Sample output:
The table is the fifth one in the DOM, and INDEX(table, 2, 2) means getting the 2nd row 2nd column of the table.
If the site is no good for you, you can try finding other sites that would suit your needs. And then use either importhtml or importxml depending on the site structure.
When you inspect the network when the website is loading you will see that the prices come when calling the forecast endpoint https://www.tipranks.com/stocks/tsla/forecast. This in turn returns an html response which is probably generated with Javascript on the client because they use React on the frontend, but you can still see the preview in the Network tab of the browser dev tools.
You can then copy the preview in VSCode and prettify it, to try and pin point the span holding the price. Of course it won't be exact science, because the html tags are generated with some media queries, but you will get close enough to some extent.
After you get the xml path but you get an empty error, you can delete some tags until you get some text. Use search in google sheets to search for highest price label, and than continue adding tags until you get the desired value.
Here is what I managed to get:
Lowest price target:
=importxml("https://www.tipranks.com/stocks/snow/forecast", "/html/body/div[1]/div[1]/div[4]/div[1]/div[2]/div[1]/div[4]/div[2]/div[2]/div[4]/div[1]/div[1]/div[5]/span[2]")
Average price target:
=importxml("https://www.tipranks.com/stocks/snow/forecast", "/html/body/div[1]/div[1]/div[4]/div[1]/div[2]/div[1]/div[4]/div[2]/div[2]/div[4]/div[1]/div[1]/div[3]/span[2]")
Highest price target:
=importxml("https://www.tipranks.com/stocks/snow/forecast", "/html/body/div[1]/div[1]/div[4]/div[1]/div[2]/div[1]/div[4]/div[2]/div[2]/div[4]/div[1]/div[1]/div[1]/span[2]")
In time these methods might change depending on their development process, but you could use the above steps to update the script.
P.S. I wasn't satisfied with the marketwatch analyst price targets. I think the wisdom of the crowd is better on tipranks.
Try this one. Works perfectly fine on my personal Stock Portfolio on Google Sheets:
Lowest Price Target:
=importxml(CONCATENATE("https://www.tipranks.com/stocks/", A1,"/forecast"), "//*[#class='colorpurple-dark ml3 mobile_fontSize7 laptop_ml0']")
Average Price Target:
=importxml(CONCATENATE("https://www.tipranks.com/stocks/", A4,"/forecast"), "//*[#class='colorgray-1 ml3 mobile_fontSize7 laptop_ml0']")
Highest Price Target:
=importxml(CONCATENATE("https://www.tipranks.com/stocks/", A4,"/forecast"), "//*[#class='colorpale ml3 mobile_fontSize7 laptop_ml0']")

eBay SDK AddItem new ProductDetails EAN Requirements CANNOT List Or Revise

I've asked this question on an eBay forum already, but you have been very helpful, so probably worth posting here too.
Over the past few days I have realised that for many categories in which I sell, EANs are becoming required. I have been trying to update my eBay integration to take this into account, but have run into problems.
The additions to my code provide a workflow, and have problems as follows:
I sell musical instruments and accessories, so let's take a typical example a product "Boss CS-3 Compression Pedal", here's a link to a seller listing it: http://www.ebay.co.uk/itm/231547986565
The EAN is 4957054012854
I want to list this in "Musical Instruments > Guitars & Basses > Accessories > Effects Pedals" Category ID for this is: 41410
So, as I understand it, the first thing I need to know is whether EAN is a requirement for this Category. So, using the eBay .NET SDK I run a post to GetCategoryFeatures requesting the following feature IDs:
BrandMPNIdentifierEnabled,
EANEnabled,
UPCEnabled,
ISBNIdentifierEnabled
The response gives me, amongst other things:
EANEnabled: Required,
ISBNEnabled: Disabled,
UPCEnabled: Disabled,
BrandMPNIdentifierEnabled: False
This indicates to me that the EAN is a required ProductDetails value to include in the AddItem post.
So now I need to know if the EAN for this item exists in the eBay Catalogue, so I do a post to findItemsByProduct in the FindingService. I post to this URL:
http://svcs.ebay.com/services/search/FindingService/v1?SECURITY-APPNAME=[MY-APP-ID]&OPERATION-NAME=findItemsByProduct&GLOBAL-ID=EBAY-GB&SERVICE-VERSION=1.0.0&RESPONSE-DATA-FORMAT=JSON&REST-PAYLOAD&productId.#type=EAN&productId=4957054012854&paginationInput.entriesPerPage=1
The responses ack field is "Failure", which, from what I have gleaned from various internet posts tells me that the item is not found in the eBay Catalogue. Why? I don't know, as the listing example I give above shows the EAN in the Item Specifics fields... but anyway...
So, armed with this information, I can find only the advice that I should replaced the EAN value with a value returned from a post to GeteBayDetails, the value being found as ProductIdentifierUnavailableText which, in my instance (for eBay UK) reads "Does not apply".
Now, I build my item as usual and add the ProductDetails value as follows (in VB.net):
Dim ProductDetails As New ProductListingDetailsType With {
.EAN = "Does not apply"
}
I also note the requirement for an MPN and add that (it returned an error if not provided)
When I list it, I get a Failure response with the following error:
No product found for ProductListingDetails.<EAN> <Does not apply>.
If I take away the ProductDetails I get:
Required field, EAN, is missing. Please add EAN to the listing and retry, so clearly, I do need to provide this information.
I get exactly the same problem trying to revise a listing.
I have tried adding the EAN in the ItemSpecifics object instead of ProductDetails, but that returns the "EAN Missing" error, and have tried alternating between including one, or the other, or both.
So my questions are:
1: Can someone please explain to me what I am doing wrong and how I go about rectifying it, because at the moment I cannot list, or revise items on eBay at all!
2: Since most of my suppliers provide a UPC, not an EAN, am I to take it literally that the idetifier to be provided MUST be an EAN? Or can I provide the UPC field instead?
Hope this saves someone some time on the addItem and reviseItem call (it took me a while to work out)
I managed to make it work using
<ProductListingDetails>
<EAN>Does not apply</EAN>
</ProductListingDetails>
You can add following into your XML
<VariationProductListingDetails>
<EAN>$EAN</EAN>
</VariationProductListingDetails>

Magento API Rest filters

So I have this piece of code below which will sucessfully pull a product and give the XML data for my magento store...
http://mywebsite.com/api/rest/products?type=rest&filter[1][attribute]=name&filter[1][in]=test%20product%20name
However, it will ONLY pull up the product info if I make the product name perfect. If I try to just put in
http://mywebsite.com/api/rest/products?type=rest&filter[1][attribute]=name&filter[1][in]=test
It will not bring ANY products. It was my understanding that if I used the "[in]" filter that it should bring up all products containing the "test" word but it doesnt...
in - "equals any of" - returns items that are equal to the item(s) with the specified attribute(s)
Try to use 'like' ...
http://mywebsite.com/api/rest/products?type=rest&filter[1][attribute]=name&filter[1][like]=%test%

Magento API creates simple product correct -> but afterwards tells "101 Product not exists"

I try to add some pictures to a simple product, which was created (without error) by the API. The product is shown in frontend its functional with all wanted attributes. But if I check afterwards
$client->call($sessionId, 'product.info', '123456');
I get Soap Error: "101: Product doesn't exists". But its definitivly reachable over back- and frontend. (Cache cleared, Index refreshed)
Same issue, when I try to add media informations. On Confugurable Products the error don't show up and the pictures are added whithout any problems.
Maybe I messed something up with the attributes or the attribut sets... I don't know, where to watch first.
I'm at my php’s end!
Using Magento 1.6.0.0
Thank your for clarify me.
Best regards.
Since the ame API function ("product.info" in this case) receive as a parameter both SKU and ID, there is a problem if your are looking for SKU's which is numeric values.
To avoid this problem, we always adding space to the end of SKU before sending it to the API. For example, if your SKU is "123456" you should send "123456 " to the API.
Have you tried this call with your product id instead of the sku? I had some problems in the past with product calls and the sku.
I've installed 2 magentos and we always use numeric SKUs and I've always had this problem.
I've solved it by modifying the file:
app/code/core/Mage/Catalog/Model/Api/Resource.php
About line 122 that reads:
$product = Mage::helper('catalog/product')->getProduct($productId, $this->_getStoreId($store), $identifierType);
I've changed it to:
$product = Mage::helper('catalog/product')->getProduct($productId, $this->_getStoreId($store), 'sku');
This way the function always expects an SKU.