Change brands to vendors

This commit is contained in:
Amanmyrat 2023-09-12 16:08:35 +05:00
parent 284e5e6a83
commit ccd146f5f5
3 changed files with 11 additions and 16 deletions

View File

@ -19,7 +19,7 @@ title = "Brands"
{% put scripts %}
<script>
$.ajax({
url: `https://nurgul.com.tm/app/api/attribute-options?locale={{activeLocale}}`,
url: `https://nurgul.com.tm/app/api/vendors?locale={{activeLocale}}`,
type: 'GET',
dataType: 'json',
beforeSend: function () {
@ -37,10 +37,10 @@ title = "Brands"
<div class="col-lg-3 col-sm-6">
<div class="ltn__blog-item">
<div class="ltn__blog-img">
<a href="/brand/`+ brand.label +`/`+ brand.id + `"><img src="` + brand.image + `" alt="` + brand.label + `" style="width: 100%;"></a>
<a href="/brand/`+ brand.shop_title +`/`+ brand.id + `"><img src="` + brand.logo + `" alt="` + brand.shop_title + `" style="width: 100%;"></a>
</div>
<div class="ltn__blog-brief">
<h3 class="ltn__blog-title blog-title-line"><a href="/brand/`+ brand.label +`/`+ brand.id + `">` + brand.label + `</a></h3>
<h3 class="ltn__blog-title blog-title-line"><a href="/brand/`+ brand.shop_title +`/`+ brand.id + `">` + brand.shop_title + `</a></h3>
</div>
</div>
</div>
@ -52,4 +52,4 @@ title = "Brands"
}
});
</script>
{% endput %}
{% endput %}

View File

@ -1,14 +1,12 @@
{% put scripts %}
<script>
//getCat('{{query}}', '{{catId}}');
getBrandProducts('{{query}}', '{{limit}}', '{{brandId}}', '1');
$('#pagination').hide();
// console.log("qqq");
function getBrandProducts(query, limit, brandId, page) {
$(document).ready(function () {
$.ajax({
url: `https://nurgul.com.tm/app/api/products?brands=`+ brandId + `&` + query + `{{activeLocale}}&limit=` + limit + `&page=` + page,
url: `https://nurgul.com.tm/app/api/vendor/products/`+ brandId + `?` + query + `{{activeLocale}}&limit=` + limit + `&page=` + page,
type: 'GET',
dataType: 'json',
beforeSend: function () {
@ -32,7 +30,6 @@
var products = data.data;
for (var product of products) {
// console.log(product.name);
$('#products_{{id}}').append(productCard(product));
$('#products_list_{{id}}').append(productList(product));
}
@ -42,7 +39,7 @@
$('#pagination_numbers').append(
(pagination.current_page != 1 ?
`<li><a href="javascript:;" onClick="getCatProducts(` + `'{{query}}'` + `,` + `'{{limit}}'` + `,` + `'{{catId}}'` + `,` + pagination.links[1].label + `)"><i class="icon-arrow-left"></i></a></li>`
`<li><a href="javascript:;" onClick="getBrandProducts(` + `'{{query}}'` + `,` + `'{{limit}}'` + `,` + `'{{brandId}}'` + `,` + pagination.links[1].label + `)"><i class="icon-arrow-left"></i></a></li>`
:
`<li><a href="javascript:;"><i class="icon-arrow-left"></i></a></li>`
)
@ -51,21 +48,21 @@
for (var i = 0; i < pagination.links.length; i++) {
if (i != 0 && i != pagination.links.length-1) {
$('#pagination_numbers').append(
`<li` + (pagination.links[i].active ? ` class="active" ` : ``) + `><a href="javascript:;" onClick="getCatProducts(` + `'{{query}}'` + `,` + `'{{limit}}'` + `,` + `'{{catId}}'` + `,` + pagination.links[i].label + `)">` + pagination.links[i].label + `</a></li>`
`<li` + (pagination.links[i].active ? ` class="active" ` : ``) + `><a href="javascript:;" onClick="getBrandProducts(` + `'{{query}}'` + `,` + `'{{limit}}'` + `,` + `'{{brandId}}'` + `,` + pagination.links[i].label + `)">` + pagination.links[i].label + `</a></li>`
);
}
}
$('#pagination_numbers').append(
(pagination.current_page != pagination.last_page ?
`<li><a href="javascript:;" onClick="getCatProducts(` + `'{{query}}'` + `,` + `'{{limit}}'` + `,` + `'{{catId}}'` + `,` + (pagination.current_page + 1) + `)"><i class="icon-arrow-right"></i></a></li>`
`<li><a href="javascript:;" onClick="getBrandProducts(` + `'{{query}}'` + `,` + `'{{limit}}'` + `,` + `'{{brandId}}'` + `,` + (pagination.current_page + 1) + `)"><i class="icon-arrow-right"></i></a></li>`
:
`<li><a href="javascript:;"><i class="icon-arrow-right"></i></a></li>`
)
);
// $('#pagination_numbers').append(
// `<li` + (pagination.current_page == (pagination.from - pagination.per_page) ? ` class="active" ` : ``) + `><a href="javascript:;" onClick="getCatProducts(` + `'{{query}}'` + `,` + `'{{limit}}'` + `,` + `'{{catId}}'` + `, '2')">` + (pagination.from - pagination.per_page) + `</a></li>`
// `<li` + (pagination.current_page == (pagination.from - pagination.per_page) ? ` class="active" ` : ``) + `><a href="javascript:;" onClick="getBrandProducts(` + `'{{query}}'` + `,` + `'{{limit}}'` + `,` + `'{{brandId}}'` + `, '2')">` + (pagination.from - pagination.per_page) + `</a></li>`
// // <li><a href="javascript:;" id="pagination_prev"><i class="icon-arrow-right"></i></a></li>
// );
@ -106,4 +103,4 @@
{% endput %}
{%partial 'scripts/setModal' %}
{%partial 'scripts/prodCard' %}
{%partial 'scripts/prodCard' %}

View File

@ -124,9 +124,7 @@
`</div>
<div class="product-brief">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Recusandae asperiores sit odit nesciunt, aliquid, deleniti
non et ut dolorem!</p>
<p>` + product.short_description+ `</p>
</div>
<div class="product-hover-action product-hover-action-2">
<ul>