Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/checkout/js/ drwxr-xr-x | |
| Viewing file: Select action/file-type: var total=0;
var temp_total=0;
var sub_total=0;
var auth={
"Authorization": "Basic " + btoa("Mongo_API"+":"+"jiFFMongo@2023!@!@!@")
};
// remove product from cart
$("#tdata").on("click","#remove_cart",function(e){
// event.preventDefault();
var parent=$( this ).parent().parent();
// console.log(JSON.parse(cart_data)._id);
var cart_id= $(this).parent().parent().find("#cart_id").text();
$.ajax({
type: 'post',
url: 'https://checkout.jiff.live/api/mongo/delete_wishList/'+cart_id,
headers:auth,
success: function (data, status, xhr) {
console.log(data);
parent.hide( 400 );
}
});
});
// move product to wish list
$("#tdata").on("click","#add_wishList", function() {
var cart_id= $(this).parent().find("#cart_id").text();
console.log(cart_id);
var cart_quan=cart_items.filter(function(item){
return item._id == cart_id;
});
var wishData={
_id: Date.now(),
quantity:1,
page_id:cart_quan[0].page_id,
psid:cart_quan[0].psid,
variant_id:cart_quan[0].variant_id
}
console.log(wishData);
// event.preventDefault();
// // console.log($(this).parent());
// $(this).prop('disabled', true);
$.ajax({
type: 'post',
url: 'https://checkout.jiff.live/api/mongo/wish_to_cart',
headers:auth,
data: wishData,
success: function (data, status, xhr) {
swal("","Product added to your cart successfully", "success");
$("#tr_"+cart_id +" #add_wishList").hide();
$("#tr_"+cart_id +" #remove_cart").css("margin-bottom", "20px");
}
});
})
var variants=Array();
var cart_items= {};
var cart_products=[];
$(document).ready(function(){
var url=window.location;
var url_string = new URL(url).searchParams.get("id");
var page_psid=url_string.split('_');
var page_id=page_psid[0];
var psid=page_psid[1];
$.ajax({
type: 'get',
url: 'https://checkout.jiff.live/api/mongo/shop_settings?page_id='+page_id,
dataType: 'json',
headers:auth,
// beforeSend: function(xhr) {
// xhr.setRequestHeader('Authorization', 'Basic ' + btoa(username+':'+password));
// },
success: function (data, status, xhr) {
if (data.length<1) {
swal("","This pages is currently unavilable to sell product", "info");
$(".container").hide();
}else{
shop_data=data[0];
store =data[0].store[0];
$("#shop_name").text(shop_data.shop_name);
}
}
});
// document.getElementById("checkout_a").href = "https://web.businesscloud.xyz/checkout/cart.php?id=101115269135931_4486210768174705";
$.ajax({
type: 'GET',
url: 'https://checkout.jiff.live/api/mongo/wishLists?page_id='+page_id+'&psid='+psid,
headers:auth,
success: function (data, status, xhr) {
cart_items=data;
if (data.length>0) {
for (let i = 0; i < data.length; i++) {
variants.push(data[i].variant_id);
}
product_info(variants);
}else{
swal("","Your WishList is empty. Please add item and visit the page again", "info");
$("p").css("background-color", "yellow");
}
}
});
});
// get cart products info
function product_info(variants) {
$.ajax({
type: 'GET',
url: 'https://checkout.jiff.live/api/mongo/cart_products?variants='+variants,
headers:auth,
success: function (data, status, xhr) {
for (let i = 0; i < data.length; i++) {
for (let j = 0; j < cart_items.length; j++) {
if (data[i]._id==cart_items[j].variant_id) {
var image;
if (data[i].images === undefined || data[i].images == 0) {
image="empty";
}else{
image=data[i].images[0];
}
var item={
cart_id:cart_items[j]._id,
product_code:data[i].product[0].product_code,
description:data[i].tags.replace(/['"{}]/g, ' '),
product_id:data[i].product[0].id,
product_name:data[i].product[0].title,
price: data[i].price,
variant_id:data[i].id,
variant_name: data[i].name,
images:image,
image_folder:data[i].product[0].folder,
inventory:data[i].inventory,
inventory_check:data[i].inventory_check
}
cart_products.push(item);
}
}
}
setView(cart_products);
}
});
}
// set html view
function setView(data) {
for (let i = 0; i < data.length; i++) {
if (data[i].images=="empty") {
var image="https://media.istockphoto.com/id/1055079680/vector/black-linear-photo-camera-like-no-image-available.webp?s=612x612&w=is&k=20&c=OB0AoxouENQqDd14Te9WpfNy2aPOXoJF8AAi3zcd7Pk=";
}else{
var image="https://jiffc.s3.ap-southeast-1.amazonaws.com/"+data[i].image_folder+"/"+data[i].images;
// var image="https://jiff.sgp1.digitaloceanspaces.com/"+data[i].images[0]+".webp";
// var image="https://static-01.daraz.com.bd/p/7da77214581407a906196a2f879328af.jpg";
}
$("#tdata").append('<tr id="tr_'+data[i].cart_id+'">\
<td id="product_info">\
<div class="product-item">\
<a class="product-thumb"><img src="'+image+'" alt="No Image"><div class="centered">Not Available</div></a>\
<div class="product-info">\
<h4 class="product-title"><a ><b>'+data[i].product_name+" "+data[i].variant_name+'</b></a></h4><span>'+data[i].description+'</span><br><span class="taka_sign">৳</span><span id="unit_price" class="unit_price">'+data[i].price+'</span>\
</div>\
</div>\
</td>\
<td class="text-center" id="action">\
<span id="cart_id" style="display: none;">'+data[i].cart_id+'</span>\
<a class="remove-from-cart" id="add_wishList" href="#" data-toggle="tooltip" title="Move to wish list" data-original-title="Move to wish list"><span>AddCart</span></i></a><br>\
<a class="remove-from-cart remove_cart" id="remove_cart" href="#" data-toggle="tooltip" title="Remove from cart" data-original-title="Remopve from cart"><span>Remove </span></a></td>\
</tr>');
}
checkStock(data);
}
// check default stock
function checkStock(data) {
var id;
for (let i = 0; i < data.length; i++) {
id="tr_"+data[i].cart_id;
if (data[i].inventory_check==1) {
if (data[i].inventory==0 ) {
$("#"+id +" #add_wishList").hide();
$("#"+id +" #remove_cart").css("margin-bottom", "20px");
// $("#"+id +" #remove_cart").show();
}else{
console.log("no");
}
}else{
}
}
} |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0053 ]-- |