How to get query string on search page in shopify - shopify

I have a shopify store. I am passing new parameters on search page using query string anyone tell me how can i get this new query string on search page

You can't get new parameters outside the default ones using liquid. Liquid is now aware of additional query parameters.
If you really really have to take them in liquid then you will have a hacky option to capture the content_for_header argument and you can extract the arguments from there ( since there is a URL with the query params there ) with a few splits. You will need to look for the pageurl string there. But like I said this is a hacky way which should be used as a last resort.

Related

batchGet endpoint behavior with multiple photos

I am testing the photos.batchGet endpoint.
Per the API docs, it takes two URL parameters "view" and "photoIds". When I try the photoIds parameter, the request only works with one photoId. Using multiple photoIds fails.
I tried using a delimeter between the photoIds in the string (by using a comma, pipe, and space). I also tried not using a delimeter at all. Not using a delimeter returns a response for the last photoId in the string, but not for any of the other photoIds. In short, none of my requests appear to be working. Am I doing something wrong?
Also, depending on server configuration, I think it's recommended for the URL length to be under 2,000 characters. Anything above 30 photoIds would create URLs longer than this.
That being said, maybe it would be better to make this a POST request that accepts a JSON request body? Just a thought, but think this would be better suited. A lot of our tours are above 30 scenes, and we even had a tour with 700 scenes!
The description of the batchGet function was updated. Per the documentation you should pass photoIds as a string and the URL query parameter should be photoIds=<id1>&photoIds=<id2>.

Normalize string from HtmlAgilityPack document

I'm trying to get a web page using vb.net and HtmlAgilityPack with this code:
Dim mWPage As New HtmlAgilityPack.HtmlDocument
Dim wC As New WebClient()
mWPage.Load(wC.OpenRead(mUrl))
My problem is to get text from a table but, when I extract InnerText, i get something like this:
Modificat<!--span-->i dati
instead of (Note that I wrote the same string and below it's displayed correctly):
Modificati dati
I've tryed to use the answer here but it doesn't work in this case (or I wasn't able to make it works)
I noticed that contents changes when I change "User-Agent", so I tryed various "User-Agent" but I never got a perfect text.
So my questions are:
can I use the code that is indicated in the answer to solve the problem?
if not, can I get a perfect text using the right "User-Agent"?
If so, how can I find the right "User-Agent"?
If not, how can I fix the receivedstring?
The response from the server based on a new User-Agent is fully dependent on the server so we will not be able to predict which one will yield the response you're looking for.
But... You will be able to use the HttpUtility.HtmlDecode method to get rid of the encoded HTML and turn it into teh string you're looking for.
To filter out the HTML comment you may need to change the XPath you're using. If you append //text(), you should get only the text elements that match the rest of your expression.

Date range search using Google Custom Search API

I am using the Google Custom Search API to search for images. My implementation is using Java, and this is how I build my search string:
URL url = new URL("https://ajax.googleapis.com/ajax/services/search/images?"
+ "v=1.0&q=barack%20obama&userip=INSERT-USER-IP");
How would I modify the URL to limit search results, for example, to: 2014-08-15 and 2014-09-31?
You can specify a date range using the sort parameter. For your example, you would add this to your query string: sort=date:r:20140815:20140931.
This is documented at https://developers.google.com/custom-search/docs/structured_data#page_dates
Also if you use Google's Java API you can use the Query class and its setSort() method rather than building the URL by hand.
I think the better way is to put this into query itself. Query parameter contains 'after' flag which can be used like:
https://customsearch.googleapis.com/customsearch/v1?
key=<api_key>&
cx=<search_engine_id>&
q="<your_search_word> after:<YYYY-MM-DD>"

Constrain Wikipedia Search API to generate only NS:0 pages

I am calling the Wikipedia API from Java using the following search query to generate redirected pages:
https://en.wikipedia.org//w/api.php?format=json&action=query&generator=allpages&gapfilterredir=redirects&prop=links&continue=&gapfrom=D
where the final 'D' is just an example for the continue-from.
I am interested in only iterating over items in namespace:0. In fact, if I don't, the continue return value includes category pages, which break the next query iteration.
Thank you in advance.
The parameter you need from the Allpages api is
…&gapnamespace=0&…
but notice that when you omit it, then 0 is the default anyway.

MVC multiple parameter routing

I've been trying to pull the parameters passed into a page so I can post it back in Context.
So far,
ViewBag.Message = string.Format("{0}::{1}::{2}",
RouteData.Values["controller"],
RouteData.Values["actions"],
RouteData.Values["id"]);
works with anything simple like "66" or "tt" but anything more complex like "?name=blargh?viewId=66" and it fails.
I've tried a bunch of different ways to see if I could strike gold but nothing seems to work so does anybody have any idea what I'm missing/doing wrong/should be doing instead?
" but anything more complex like "?name=blargh?viewId=66" and it fails.
This doesn't seem to be routing information but query string which you should retrieve from the Request.QueryString bag.
If the {id} parameter is part of your route (as the default routes {controller}/{action}/{id}) I hope you realize that this id cannot be anything you like just because there are rules for an url. For example it cannot contain ? because this symbol has an entirely different meaning in an url - it represents the query string separator.