api
This commit is contained in:
parent
e0ccbdcc93
commit
355f79f8de
|
|
@ -22,10 +22,25 @@ class Products extends ComponentBase
|
|||
|
||||
public function onFetchProduct()
|
||||
{
|
||||
$response = Http::get('https://nurgul.com.tm/app/api/products?locale=tm&limit=4');
|
||||
// $response = Http::get('https://nurgul.com.tm/app/api/products?locale=tm&limit=4');
|
||||
// $response = getenv('APP_URL');
|
||||
// dd($response);
|
||||
return $response;
|
||||
|
||||
// $result = Http::get('https://orient.tm/ru/api/posts', function ($http) {
|
||||
// // $http->header('Content-Type', 'application/json');
|
||||
// $http->header('Accept', 'application/json');
|
||||
|
||||
// // $data = [];
|
||||
|
||||
// $http->setOption('CURLOPT_SSL_VERIFYHOST', false);
|
||||
// });
|
||||
|
||||
// $response = Http::accept('application/json')->get('https://nurgul.com.tm/app/api/products?locale=tm&limit=4');
|
||||
$result = Http::accept('application/json')->get('http://nurgul.com.tm/app/api/products?locale=tm&limit=1');
|
||||
|
||||
// $data = json_decode($response);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 211 KiB |
|
|
@ -69,8 +69,8 @@ code = "top-menu"
|
|||
|
||||
{% framework %}
|
||||
|
||||
{% scripts %} %}
|
||||
{% scripts %}
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ title = "Home"
|
|||
{% partial 'home/banner' %}
|
||||
|
||||
{% partial 'home/banner2' %}
|
||||
<button data-request="onFetchProduct">TESTQ</button>
|
||||
{% partial 'home/new-products' header='New Products' %}
|
||||
<!-- <button data-request="onFetchProduct">TESTQ</button> -->
|
||||
{% partial 'home/new-products' header='home.new.products'|_ %}
|
||||
|
||||
{% partial 'home/banner-mix' %}
|
||||
|
||||
{% partial 'product/slider-item' header='Top Products' %}
|
||||
{% partial 'product/slider-item' header='home.featured.products'|_ %}
|
||||
|
||||
|
||||
<!-- BANNER AREA START -->
|
||||
|
|
@ -34,4 +34,6 @@ title = "Home"
|
|||
<!-- BANNER AREA END -->
|
||||
|
||||
|
||||
{% partial 'home/brand' %}
|
||||
{% partial 'home/brand' %}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,18 +8,18 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
|
||||
{% partial 'product/card' %}
|
||||
{% partial 'product/card' %}
|
||||
{% partial 'product/card' %}
|
||||
{% partial 'product/card' %}
|
||||
{% partial 'product/card' %}
|
||||
{% partial 'product/card' %}
|
||||
{% partial 'product/card' %}
|
||||
{% partial 'product/card' %}
|
||||
<div class="row justify-content-center" id="loader_new">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-12" style="text-align: center;">
|
||||
<img src="{{'assets/loader.gif'|theme}}" style="width: 25%;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center" id="products_new">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- PRODUCT SLIDER AREA END -->
|
||||
|
||||
{% partial 'scripts/newProd' add='add.cart'|_ query='locale=tm' limit='8' id='new' %}
|
||||
|
|
|
|||
|
|
@ -14,22 +14,22 @@
|
|||
<div class="modal-product-item">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-12">
|
||||
<div class="modal-product-img">
|
||||
<img src="{{'assets/img/product/4.png'|theme}}" alt="#">
|
||||
<div class="modal-product-img" id="modal_img">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-12">
|
||||
<div class="modal-product-info shop-details-info pl-0">
|
||||
<h3>Pink Flower Tree Red</h3>
|
||||
<h3 id="modal_name"></h3>
|
||||
<div class="product-price-ratting mb-20">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="product-price">
|
||||
<span>$49.00</span>
|
||||
<del>$65.00</del>
|
||||
<span id="modal_price">0</span>
|
||||
<del id="modal_discount">0</del>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<!-- <li>
|
||||
<div class="product-ratting">
|
||||
<ul>
|
||||
<li><a href="index.html#"><i class="icon-star"></i></a></li>
|
||||
|
|
@ -41,43 +41,13 @@
|
|||
95 Reviews )</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</li> -->
|
||||
</ul>
|
||||
</div>
|
||||
<div class="modal-product-brief">
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
||||
Dignissimos repellendus repudiandae incidunt quidem pariatur
|
||||
expedita, quo quis modi tempore non.</p>
|
||||
</div>
|
||||
<div class="modal-product-meta ltn__product-details-menu-1 mb-20">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="ltn__color-widget clearfix">
|
||||
<strong class="d-meta-title">Color</strong>
|
||||
<ul>
|
||||
<li class="theme"><a href="index.html#"></a></li>
|
||||
<li class="green-2"><a href="index.html#"></a></li>
|
||||
<li class="blue-2"><a href="index.html#"></a></li>
|
||||
<li class="white"><a href="index.html#"></a></li>
|
||||
<li class="red"><a href="index.html#"></a></li>
|
||||
<li class="yellow"><a href="index.html#"></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ltn__size-widget clearfix mt-25">
|
||||
<strong class="d-meta-title">Size</strong>
|
||||
<ul>
|
||||
<li><a href="index.html#">S</a></li>
|
||||
<li><a href="index.html#">M</a></li>
|
||||
<li><a href="index.html#">L</a></li>
|
||||
<li><a href="index.html#">XL</a></li>
|
||||
<li><a href="index.html#">XXL</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<p id="modal_desc"></p>
|
||||
</div>
|
||||
|
||||
<div class="ltn__product-details-menu-2 product-cart-wishlist-btn mb-30">
|
||||
<ul>
|
||||
<li>
|
||||
|
|
@ -87,11 +57,11 @@
|
|||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<a href="index.html#"
|
||||
<a href="#"
|
||||
class="theme-btn-1 btn btn-effect-1 d-add-to-cart"
|
||||
title="Add to Cart" data-bs-toggle="modal"
|
||||
data-bs-target="#add_to_cart_modal">
|
||||
<span>ADD TO CART</span>
|
||||
<span id="modal_add">ADD TO CART</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
|
|
@ -103,7 +73,7 @@
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ltn__social-media mb-30">
|
||||
<!-- <div class="ltn__social-media mb-30">
|
||||
<ul>
|
||||
<li class="d-meta-title">Share:</li>
|
||||
<li><a href="index.html#" title="Facebook"><i
|
||||
|
|
@ -116,30 +86,8 @@
|
|||
class="icon-social-instagram"></i></a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="modal-product-meta ltn__product-details-menu-1 mb-30 d-none">
|
||||
<ul>
|
||||
<li><strong>SKU:</strong> <span>12345</span></li>
|
||||
<li>
|
||||
<strong>Categories:</strong>
|
||||
<span>
|
||||
<a href="index.html#">Flower</a>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Tags:</strong>
|
||||
<span>
|
||||
<a href="index.html#">Love</a>
|
||||
<a href="index.html#">Flower</a>
|
||||
<a href="index.html#">Heart</a>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ltn__safe-checkout d-none">
|
||||
<h5>Guaranteed Safe Checkout</h5>
|
||||
<img src="{{'assets/img/icons/payment-2.png'|theme}}" alt="Payment Image">
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -172,7 +120,7 @@
|
|||
<img src="{{'assets/img/product/1.png'|theme}}" alt="#">
|
||||
</div>
|
||||
<div class="modal-product-info">
|
||||
<h5><a href="product-details.html">Heart's Desire</a></h5>
|
||||
<h5><a href="product-details.html">qHeart's Desire</a></h5>
|
||||
<p class="added-cart"><i class="fa fa-check-circle"></i>
|
||||
Successfully added to your Cart</p>
|
||||
<div class="btn-wrapper">
|
||||
|
|
|
|||
|
|
@ -1,25 +1,25 @@
|
|||
<!-- PRODUCT SLIDER AREA START -->
|
||||
<div class="ltn__product-slider-area ltn__product-gutter pt-60 pb-40">
|
||||
<!-- PRODUCT AREA START -->
|
||||
<div class="ltn__product-area ltn__product-gutter pt-65 pb-40">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="section-title-area text-center">
|
||||
<h1 class="section-title section-title-border">{{header}}</h1>
|
||||
<h1 class="section-title section-title-border">{{ header }}</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row ltn__product-slider-item-four-active slick-arrow-1">
|
||||
|
||||
{% partial 'product/slider-prod-item' %}
|
||||
{% partial 'product/slider-prod-item' %}
|
||||
{% partial 'product/slider-prod-item' %}
|
||||
{% partial 'product/slider-prod-item' %}
|
||||
{% partial 'product/slider-prod-item' %}
|
||||
{% partial 'product/slider-prod-item' %}
|
||||
{% partial 'product/slider-prod-item' %}
|
||||
<div class="row justify-content-center" id="loader_top">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-12" style="text-align: center;">
|
||||
<img src="{{'assets/loader.gif'|theme}}" style="width: 25%;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center" id="products_top">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- PRODUCT SLIDER AREA END -->
|
||||
|
||||
{% partial 'scripts/newProd' add='add.cart'|_ query='locale=tm&fetured=1' limit='4' id='top' %}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="product-info">
|
||||
<h2 class="product-title"><a href="product-details.html">Pink Flower Tree</a></h2>
|
||||
<h2 class="product-title"><a href="product-details.html">{{test}} Pink Flower Tree</a></h2>
|
||||
<div class="product-price">
|
||||
<span>$18.00</span>
|
||||
<del>$21.00</del>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
{% put scripts %}
|
||||
|
||||
<script>
|
||||
getNewProducts('{{query}}', '{{limit}}');
|
||||
// console.log("qqq");
|
||||
function getNewProducts(query, limit) {
|
||||
console.log(query);
|
||||
$(document).ready(function () {
|
||||
$.ajax({
|
||||
url: `https://nurgul.com.tm/app/api/products?`+query+`&limit=`+limit,
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
beforeSend: function () {
|
||||
$('#products_{{id}}').hide();
|
||||
$('#loader_{{id}}').show();
|
||||
},
|
||||
success: function (data, textStatus, xhr) {
|
||||
$('#loader_{{id}}').hide(500);
|
||||
$('#products_{{id}}').show(500);
|
||||
|
||||
|
||||
// console.log(data.data);
|
||||
|
||||
var products = data.data;
|
||||
for (var product of products) {
|
||||
// console.log(product.hasOwnProperty('special_price'));
|
||||
$('#products_{{id}}').append(productCard(product));
|
||||
}
|
||||
},
|
||||
error: function (xhr, textStatus, errorThrown) {
|
||||
console.log('Error in Operation');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endput %}
|
||||
|
||||
{%partial 'scripts/setModal' %}
|
||||
{%partial 'scripts/prodCard' %}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
{% put scripts %}
|
||||
|
||||
<script>
|
||||
function productCard(product){
|
||||
|
||||
var product_str = JSON.stringify(product);
|
||||
|
||||
var card = `<div class="col-lg-3 col-md-4 col-sm-6 col-6">
|
||||
<div class="ltn__product-item text-center">
|
||||
<div class="product-img">
|
||||
<a href="/">
|
||||
<img src="`+product.images[0].original_image_url+`" alt="Nurgul `+product.name+`" style="width: 400px;height: 280px;object-fit: fill;">
|
||||
</a>
|
||||
`
|
||||
+
|
||||
|
||||
(product.hasOwnProperty('special_price') ?
|
||||
`<div class="product-badge">
|
||||
<ul>
|
||||
<li class="badge-2">{{'product.badge.discount'|_}}</li>
|
||||
</ul>
|
||||
</div>`
|
||||
:
|
||||
``
|
||||
)
|
||||
|
||||
+
|
||||
`<div class="product-hover-action product-hover-action-2">
|
||||
<ul>
|
||||
<li>`+
|
||||
"<a href='#' onClick='setModal("+ product_str +")' title='Quick View' data-bs-toggle='modal' data-bs-target='#quick_view_modal'>"
|
||||
+ `<i class="icon-magnifier"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li class="add-to-cart">
|
||||
<a href="#" title="Add to Cart" data-bs-toggle="modal"
|
||||
data-bs-target="#add_to_cart_modal">
|
||||
<span class="cart-text d-none d-xl-block">{{add}}</span>
|
||||
<span class="d-block d-xl-none"><i class="icon-handbag"></i></span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" title="Quick View" data-bs-toggle="modal"
|
||||
data-bs-target="#quick_view_modal">
|
||||
<i class="icon-shuffle"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="product-info">
|
||||
<h2 class="product-title"><a href="product-details.html">`+ product.name +`</a></h2>
|
||||
<div class="product-price">
|
||||
<span>`+ product.formatted_price +`</span>`
|
||||
+
|
||||
(product.hasOwnProperty('special_price') ? `<del>`+ product.formatted_regular_price + `</del>` : ``) +
|
||||
`</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
return card;
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endput %}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
{% put scripts %}
|
||||
|
||||
<script>
|
||||
function setModal(product){
|
||||
$('#modal_img').html(`<img src="`+product.images[0].original_image_url+`" alt="Nurgul `+ product.name +`">`);
|
||||
$('#modal_name').html(product.name);
|
||||
$('#modal_price').html(product.formatted_price);
|
||||
$('#modal_price').html(product.formatted_price);
|
||||
$('#modal_desc').html(product.description);
|
||||
$('#modal_add').html('{{add}}');
|
||||
if(product.hasOwnProperty('special_price')){
|
||||
$('#modal_discount').show();
|
||||
$('#modal_discount').html(product.formatted_regular_price);
|
||||
}else{
|
||||
$('#modal_discount').hide();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endput %}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
{% put scripts %}
|
||||
|
||||
<script>
|
||||
getTopProducts('{{query}}');
|
||||
// console.log("qqq");
|
||||
var topProd = document.getElementById("products_top");
|
||||
|
||||
function getTopProducts(query) {
|
||||
var html_data = ``;
|
||||
console.log(query);
|
||||
$(document).ready(function () {
|
||||
$.ajax({
|
||||
url: 'https://nurgul.com.tm/app/api/products?' + query,
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
beforeSend: function () {
|
||||
$('#products_top').hide();
|
||||
$('#loader_top').show();
|
||||
},
|
||||
success: function (data, textStatus, xhr) {
|
||||
$('#loader_top').hide(500);
|
||||
$('#products_top').show(500);
|
||||
|
||||
var products = data.data;
|
||||
for (var product of products) {
|
||||
// $('.slick-track').append(sliderProductCard(product));
|
||||
html_data += sliderProductCard(product);
|
||||
}
|
||||
|
||||
// topProd.innerHTML = html_data;
|
||||
$('.slick-track').html(html_data);
|
||||
},
|
||||
error: function (xhr, textStatus, errorThrown) {
|
||||
console.log('Error in Operation');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function sliderProductCard(product) {
|
||||
|
||||
var product_str = JSON.stringify(product);
|
||||
|
||||
var card = `<div class="col-12">
|
||||
<div class="ltn__product-item text-center">
|
||||
<div class="product-img">
|
||||
<a href="/">
|
||||
<img src="`+ product.images[0].original_image_url + `" alt="Nurgul ` + product.name + `" style="width: 400px;height: 280px;object-fit: fill;">
|
||||
</a>
|
||||
`
|
||||
+
|
||||
|
||||
(product.hasOwnProperty('special_price') ?
|
||||
`<div class="product-badge">
|
||||
<ul>
|
||||
<li class="badge-2">{{'product.badge.discount'|_}}</li>
|
||||
</ul>
|
||||
</div>`
|
||||
:
|
||||
``
|
||||
)
|
||||
|
||||
+
|
||||
`<div class="product-hover-action product-hover-action-2">
|
||||
<ul>
|
||||
<li>`+
|
||||
"<a href='#' onClick='setModal(" + product_str + ")' title='Quick View' data-bs-toggle='modal' data-bs-target='#quick_view_modal'>"
|
||||
+ `<i class="icon-magnifier"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li class="add-to-cart">
|
||||
<a href="#" title="Add to Cart" data-bs-toggle="modal"
|
||||
data-bs-target="#add_to_cart_modal">
|
||||
<span class="cart-text d-none d-xl-block">{{add}}</span>
|
||||
<span class="d-block d-xl-none"><i class="icon-handbag"></i></span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" title="Quick View" data-bs-toggle="modal"
|
||||
data-bs-target="#quick_view_modal">
|
||||
<i class="icon-shuffle"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="product-info">
|
||||
<h2 class="product-title"><a href="product-details.html">`+ product.name + `</a></h2>
|
||||
<div class="product-price">
|
||||
<span>`+ product.formatted_price + `</span>`
|
||||
+
|
||||
(product.hasOwnProperty('special_price') ? `<del>` + product.formatted_regular_price + `</del>` : ``) +
|
||||
`</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{% endput %}
|
||||
|
||||
{% partial 'scripts/setModal' %}
|
||||
Loading…
Reference in New Issue