mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
feat: Show brand line in search results
This commit is contained in:
committed by
marination
parent
9ee13ba86b
commit
34f3a6629f
@@ -2,4 +2,8 @@
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.brand-line {
|
||||
color: gray;
|
||||
}
|
||||
@@ -26,7 +26,6 @@
|
||||
</div>
|
||||
|
||||
{% set show_categories = frappe.db.get_single_value('E Commerce Settings', 'show_categories_in_search_autocomplete') %}
|
||||
|
||||
{% if show_categories %}
|
||||
<div id="categories" class="col-sm">
|
||||
<h2>Categories</h2>
|
||||
@@ -34,6 +33,11 @@
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% set show_brand_line = frappe.db.get_single_value('E Commerce Settings', 'show_brand_line') %}
|
||||
{% if show_brand_line %}
|
||||
<span id="show-brand-line"></span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
@@ -3,13 +3,14 @@ let loading = false;
|
||||
const searchBox = document.getElementById("search-box");
|
||||
const results = document.getElementById("results");
|
||||
const categoryList = document.getElementById("category-suggestions");
|
||||
const showBrandLine = document.getElementById("show-brand-line");
|
||||
|
||||
function populateResults(data) {
|
||||
html = ""
|
||||
for (let res of data.message) {
|
||||
html += `<li class="list-group-item list-group-item-action">
|
||||
<img class="item-thumb" src="${res.thumbnail || 'img/placeholder.png'}" />
|
||||
<a href="/${res.route}">${res.web_item_name}</a>
|
||||
<a href="/${res.route}">${res.web_item_name} <span class="brand-line">${showBrandLine && res.brand ? "by " + res.brand : ""}</span></a>
|
||||
</li>`
|
||||
}
|
||||
results.innerHTML = html;
|
||||
|
||||
Reference in New Issue
Block a user