Simple search gives 404 page for results - search

EE2.9.2. Simple search form:
{exp:search:simple_form channel="home|about|network|community|pages|people|news" search_in="entries" result_page="search/results" form_id="search_form"}
<input type="text" name="keywords" id="search" placeholder="Search" />
{/exp:search:simple_form}
Results page:
<h2>Search results for “{exp:search:keywords}”</h2>
<p>Your search returned {exp:search:total_results} results.</p>
{exp:search:search_results}
{if count == 1}
{/if}
<h3>{title} - {channel_id}</h3>
<!-- page_url is {page_url} entry_id is {entry_id} -->
<p>{excerpt}<br><strong>Read more→</strong></p>
{/exp:search:search_results}
The number 2 is the channel ID - it's not giving me results across channels either.

Nevermind, y'all. It was an error in my code. Don't wrap a channel entries tag around search results, it doesn't like that!

Related

Prestashop 1.7 attribute groups - check stock and apply css to unavailable combination

Prestashop option to hide unavailable attributes on product page doesn't work when attribute groups are used, for example color and size (for clothing shops).
I need to keep showing all possible combinations, but grey out (or strikethrough) the combinations with no stock.
Like this:
I tried several things.
In Prestashop 1.6 the following piece of code worked to apply css class (.out-of-stock-float-left) to unavailable combinations:
{elseif $group.group_type == 'radio'}
<ul id="group_{$id_attribute_group}">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
{if {$group.attributes_quantity[{$id_attribute|intval}]} > 1} <!-- product in stock -->
<li class="input-container float-left">
<input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}"
name="group[{$id_attribute_group}]"
value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span class="radio-label">{$group_attribute.name}</span>
</li>
{else} <!-- product out of stock -->
<li class="input-container out-of-stock-float-left">
<input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}"
name="group[{$id_attribute_group}]"
value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span class="radio-label">{$group_attribute.name}</span>
</li>
{/if}
{/foreach}
</ul>
{/if}
When changing combinations there is an ajax request. I don't know how to grey out combinations with no stock and make them not clickable.
Thanks

How to use aria-attribute (aria-labelledby) for combo box (input+autocomplete list) correctly?

How can I use the aria-attribute aria-labelledby for combo box (input+autocomplete list) correctly?
According to the W3C, the aria-labelledby property provides the user with a recognizable name of the object.
I've found the following example on W3C:
<div class="combobox-wrapper">
<div>
<input type="text"
aria-labelledby="ex1-label">
</div>
<ul aria-labelledby="ex1-label"></ul>
</div>
But I've noticed that aria-labelledby isn't descriptive. Values in aria-labelledby for different element are used the same.
Maybe I can use aria-labelledby like this:
<div class="combobox-wrapper">
<div>
<input type="text"
aria-labelledby="textBox">
</div>
<ul aria-labelledby="autocomplete-list"></ul>
</div>
The WAI ARIA attribute aria-labelledby is used when you can't use the normal <input> + <label> combination to label a form element, e.g. because you are using a custom form element. In other words, it is used in situations where you can't use the <label>'s for attribute to define a label for the input (e.g.
<input id="communitymode" name="communitymode" type="checkbox"> <label for="communitymode">communiti wiki</label>; note that the for attribute's value refers to the input's id attribute.)
With aria-labelledby, your reference works in the opposite direction as the for attibute: you tell the browser or the screen reader where to find the "label" for the form control it has just encountered.
<div class="combobox-wrapper">
<div>
<span id="combolabel">Select your country:</span>
<input type="text"
aria-labelledby="combolabel">
</div>
<ul aria-labelledby="combolabel"></ul>
</div>
In the above code sample, both the <input> element and the <ul> element are labelled by the <span> element with id "combolabel".
Remember the first rule of ARIA is don't use ARIA when native HTML elements exist. If you are trying to create an accessible autocomplete box try this:
http://wet-boew.github.io/v4.0-ci/demos/datalist/datalist-en.html
It does not use ARIA and follows all applicable W3C rules and guidelines.

Is it possible to send an advanced query to Shopify /search url

I am customizing a Shopify template has a form like this.
<form action="/search" method="get" class="search-bar" role="search">
<input type="hidden" name="type" value="product">
<input type="search" name="q" class="text" placeholder="{{ 'general.search.placeholder' | t }}" value="{{ search.terms }}">
<input type="hidden" class="btn" value="Search">
</form>
Which returns an array of objects search.results it is not possible to remove elements from that array in Liquid (ex. remove products which has a price of 0)
I want to remove elements from that array because even though i can filter those elements and choose them to show in the page or not, i cant effect {% paginate %} function because it is paginating the unfiltered version of search.results for example {% paginate search.results by 12 %}.
So my question is can i send an advanced query from the very start and only get the result for ex. products which have not a price of 0 ?
Thanks in advance.
I googled about this a lot but couldn't find a solution.
`
Nope you can't. Price is not a valid field in Shopify's search fields - https://help.shopify.com/manual/sell-online/online-store/storefront-search
Alternatively you can tag the products with 0 price and add "-tag" as a field to exclude those items. Refer to the link for detailed description on search on Shopify.

ExpressionEngine & Taxonomy 3 - How to split nodes into blocks of 5?

I am using ExpressionEngine 2.10.3 and also Taxonomy 3 plugin. I have the following code which, when run, returns the 15 nodes I have set up:
<div class="col-md-4">
{exp:taxonomy:nav tree_id="1" display_root="no" root_node_id="2"}
<li>
{node_title}
</li>
{/exp:taxonomy:nav}
</div>
What I would like to do is after every 5 entries, end the current <div> and start a new col-md-4. Usually, I would use {switch} and I have tried it like this:
<div class="col-md-4">
{exp:taxonomy:nav tree_id="1" display_root="no" root_node_id="2"}
<li>
{node_title}
</li>
{switch='||||</div><div class="col-md-4">'}
{/exp:taxonomy:nav}
</div>
But it doesn't work at all, instead it just prints out {switch='||||'}
Is there any way of doing what I'm trying to do?
If you're on 2.7.1 or greater and your taxonomy:nav has the nav_count variable, use the modulo operator. Instead of your {switch...} thing, put
{if nav_count % 5 == 1}
</div><div class="col-md-4">
{/if}
If you end on an modulo-5 count, though, you're going to have an empty div....

How to write XPath to capture text that is not tagged

I'm trying to scrap customer reviews from a site and ran into an interesting set-up.
<div class="Review">
<img class="stars" etc>
<b>ReviewerName</b>
- yyyy-mm-dd
<br/>
<p>Review</p>
<a>was this helpful links</a>
<hr/>
<br/>
<!-- Repeat above for additional reviews. -->
</div>
For the life of me I can't come up with an XPath that will capture the date (- yyyy-mm-dd), as there is no HTML formatting around it. Anyone have a solution?
Jon
Assuming a structure like this:
<div class="Review">
<img class="stars"/><b>ReviewerName</b> - yyyy-mm-dd<br/>
</div>
The following xpath selects the date yyyy-mm-dd
substring-after(/div/b/following-sibling::text()[1],' - ')

Resources