Merge pull request #10328 from joseplluis/patch-3
FIX: only show products with status for sell
This commit is contained in:
commit
f78e6adb2b
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
|
/* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
|
||||||
|
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -114,16 +115,23 @@ function LoadProducts(position){
|
|||||||
if (currentcat=="") return;
|
if (currentcat=="") return;
|
||||||
pageproducts=0;
|
pageproducts=0;
|
||||||
$.getJSON('./ajax.php?action=getProducts&category='+currentcat, function(data) {
|
$.getJSON('./ajax.php?action=getProducts&category='+currentcat, function(data) {
|
||||||
for (i = 0; i < 30; i++) {
|
idata=0; //product data counter
|
||||||
if (typeof (data[i]) == "undefined"){
|
ishow=0; //product to show counter
|
||||||
$("#prodesc"+i).text("");
|
while (idata < 30) {
|
||||||
$("#proimg"+i).attr("src","");
|
if (typeof (data[idata]) == "undefined") {
|
||||||
$("#prodiv"+i).data("rowid","");
|
$("#prodesc"+ishow).text("");
|
||||||
continue;
|
$("#proimg"+ishow).attr("src","");
|
||||||
|
$("#prodiv"+ishow).data("rowid","");
|
||||||
|
ishow++; //Next product to show after print data product
|
||||||
}
|
}
|
||||||
$("#prodesc"+i).text(data[parseInt(i)]['label']);
|
else if ((data[idata]['status']) == "1") {
|
||||||
$("#proimg"+i).attr("src","genimg/?query=pro&w=55&h=50&id="+data[i]['id']);
|
//Only show products with status=1 (for sell)
|
||||||
$("#prodiv"+i).data("rowid",data[i]['id']);
|
$("#prodesc"+ishow).text(data[parseInt(idata)]['label']);
|
||||||
|
$("#proimg"+ishow).attr("src","genimg/?query=pro&w=55&h=50&id="+data[idata]['id']);
|
||||||
|
$("#prodiv"+ishow).data("rowid",data[idata]['id']);
|
||||||
|
ishow++; //Next product to show after print data product
|
||||||
|
}
|
||||||
|
idata++; //Next data everytime
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -145,16 +153,23 @@ function MoreProducts(moreorless){
|
|||||||
pageproducts=pageproducts-1;
|
pageproducts=pageproducts-1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (i = 0; i < 30; i++) {
|
idata=30*pageproducts; //product data counter
|
||||||
if (typeof (data[i+(30*pageproducts)]) == "undefined"){
|
ishow=0; //product to show counter
|
||||||
$("#prodesc"+i).text("");
|
while (idata < 30) {
|
||||||
$("#proimg"+i).attr("src","");
|
if (typeof (data[idata]) == "undefined") {
|
||||||
$("#prodiv"+i).data("rowid","");
|
$("#prodesc"+ishow).text("");
|
||||||
continue;
|
$("#proimg"+ishow).attr("src","");
|
||||||
|
$("#prodiv"+ishow).data("rowid","");
|
||||||
|
ishow++; //Next product to show after print data product
|
||||||
}
|
}
|
||||||
$("#prodesc"+i).text(data[parseInt(i+(30*pageproducts))]['label']);
|
else if ((data[idata]['status']) == "1") {
|
||||||
$("#proimg"+i).attr("src","genimg/?query=pro&w=55&h=50&id="+data[i+(30*pageproducts)]['id']);
|
//Only show products with status=1 (for sell)
|
||||||
$("#prodiv"+i).data("rowid",data[i+(30*pageproducts)]['id']);
|
$("#prodesc"+ishow).text(data[parseInt(idata)]['label']);
|
||||||
|
$("#proimg"+ishow).attr("src","genimg/?query=pro&w=55&h=50&id="+data[idata]['id']);
|
||||||
|
$("#prodiv"+ishow).data("rowid",data[idata]['id']);
|
||||||
|
ishow++; //Next product to show after print data product
|
||||||
|
}
|
||||||
|
idata++; //Next data everytime
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user