I am trying to exclude certain products with a specific tag. I was able to exclude products using {% unless result.tags contains 'wholesale' %} on the search page, but having trouble with the search header. The template I have been modifying is using the raw tag. Anyone got any suggestions?
{% raw %}
{{#if has_results}}
<ul class="header-search__products grid">
{{#each results}}
<li class="grid__cell 1/3--handheld-and-up 1/4--desk">
<div class="product-item product-item--push">
{{#if on_sale}}
<div class="product-item__labels labels"><span class="label label--on-sale">{{#root.on_sale_label}}</span></div>
{{/if}}
<figure class="product-item__image-container">
<a href="{{url}}" class="product-item__link">
<img class="product-item__image " src="{{image}}" alt="{{image_alt}}">
</a>
</figure>
<div class="product-item__info">
<h3 class="product-item__title">
{{title}}
</h3>
{{#if on_sale#}}
<span class="product-item__price product-item__price--new" data-money-convertible>{{price}}</span>
<span class="product-item__price product-item__price--old" data-money-convertible>{{compare_at_price}}</span>
{{else}}
<span class="product-item__price product-item__price--new" data-money-convertible>{{price}}</span>
{{/if}}
</div>
</div>
</li>
{{/each}}
</ul>
{{results_label}}
{{else}}
<p class="header-search__no-results h4">{{results_label}}</p>
{{/if}}
{% endraw %}
Thankfully, it’s pretty easy to hide a product from your shop’s search. It involves adding some custom metadata.
This is the data you want to add:
"namespace" : "seo"
"key" : "hidden"
"value" : 1
"value_type" : "integer"
Related
Can we remove the tracking urls parameters ?utm_source=wordlift&utm_medium=wl_faceted&utm_campaign=recommendations used in the related article section?
Yes, WordLift Faceted Search uses a Handlebars template.
The default template looks like this:
<script id="faceted-search-template" type="text/x-handlebars-template">
<aside class="wl-cloud-widget-wrapper wl-faceted-wrapper wordlift-cloud-widget wordlift-faceted">
<h3>{{title}}</h3>
<nav class="chips">
{{#each entities}}
<span class="chip {{activeClass}}" data-referenced-posts="{{referencedPosts}}"
data-id="{{id}}">{{label}}</span>
{{/each}}
</nav>
<section class="cards">
{{#each posts}}
<article class="card" data-post-id="{{ID}}">
<a href="{{permalink}}?utm_source=wordlift&utm_medium=wl_faceted&utm_campaign=recommendations">
{{#if thumbnail}}
<div class="thumbnail" style="background-image: url('{{thumbnail}}');"></div>
{{/if}}
<div class="card-content">
<header class="title">{{post_title}}</header>
</div>
</a>
</article>
{{/each}}
</section>
<nav class="nav-links">
<span class="nav-link previous">❮</span>
<span class="nav-link next">❯</span>
</nav>
</aside>
</script>
A developer can create a new template and embed it into the page, then set the template_id property of the wl_faceted shortcode to the id of the new template.
i am using grav, and with twig i have an html file like this:
<div class="singlePostContainer">
<span class="postNumber">
01
</span>
<div class="postTextContainer">
<div class="postTitle">
title
</div>
<div class="postDate">
date
</div>
<div class="postAuthor">
author
</div>
</div>
</div>
then I have this API: https://5efc440acf235d0016ad72be.mockapi.io/api/floating-point/floating-point
I want to take the data from that api (date, author etc) and print it inside the corresponding html div
Fetch the data and transform the JSON to an array, then pass it to your view, e.g.
$api_data = json_decode(file_get_contents('https://5efc440acf235d0016ad72be.mockapi.io/api/floating-point/floating-point'), true);
<div class="postTextContainer">
<div class="postTitle">title</div>
<div class="postDate">date</div>
<div class="postAuthor">author</div>
</div>
{% for row in api_data %}
<div class="postTextContainer">
<div class="postTitle">{{ row.title }}</div>
<div class="postDate">{{ row.date }}</div>
<div class="postAuthor">{{ row.author }}</div>
</div>
{% endfor %}
<div class="product-btns">
<div class="qty-input">
<span class="text-uppercase">QTY: </span>
<input name="quantite" class="input" type="number">
</div>
{% if app.user != null %}
<a id="test" href="{{path('commande'{'id_product':listProduct.id ,'id_user':app.user.id,'quantite': })}}" class="primary-btn add-to-cart">
<i class="fa fa-shopping-cart"></i>
Add to Cart
</a>
{% else %}
I want to get value of input name="quantite" and reuse in path of parameter 'quantite'.
Have you tried ?
{{ form.vars.value.quantite }}
I'm building a small app within meteor, using the yogiben favourites package to allow users to favourite select items in a collection.
Currently the below code only shows the ID of the favourite/post, rather than the corresponding title.
How can I show the title?
<template name="favoritesSidebar">
<div class="template-favorites-sidebar">
{{#if myFavorites.count}}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{{_ "favorites"}}</h3>
</div>
<div class="panel-body">
<ul>
{{#each myFavorites collection="Posts"}}
<li>
<a>{{_id}}</a>
</li>
<li>
<a>{{_title}}</a>
</li>
<li>
<a>{{Post._title}}</a>
</li>
{{/each}}
</ul>
</div>
</div>
{{/if}}
</div>
</template>
I am currently creating a small Ratpack, Java, Groovy project. I am using Handlebars Java as my templating system.
https://github.com/jknack/handlebars.java
I am attempting to iterate over a map that has a key and then a map as a value. This is an example of my data.
[manOfTheMatches:[Forlan:20], cleanSheets:[Rooney:30]]
I want to iterate over each item in my map and then iterate over the map within each value to display for example.
"Most man of the matches Forlan with 20"
At the moment I am doing this.
{{#each mostMotm}}
<div class="col-sm-4 col-xl-3">
<div class="panel panel-tile text-center br-a br-grey">
<div class="panel-body">
<h6 class="text-success">Most {{#key}}</h6>
</div>
<div class="panel-footer br-t p12">
<span class="fs11">
<i class="fa fa-arrow-up pr5"></i>
<b>{{this}}</b>
</span>
</div>
</div>
</div>
{{/each}}
#key correctly prints out the key however 'this' just displays Forlan:20. I tried to loop over the inside map but had no luck, has anyone come across this before?
I got around this by looping over the inside map using this below.
{{#each this}}
{{this}}
{{/each}}
my code now looks like :
{{#each mostMotm}}
<div class="col-sm-4 col-xl-3">
<div class="panel panel-tile text-center br-a br-grey">
<div class="panel-body">
{{#each this}}
<h1 class="fs30 mt5 mbn">{{this}}</h1>
{{/each}}
<h6 class="text-success">Most {{#key}}</h6>
</div>
{{/each}}