Move ajax file
This commit is contained in:
parent
5d0d3b3908
commit
64a7bbe0fd
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/takepos/ajax.php
|
* \file htdocs/takepos/ajax/ajax.php
|
||||||
* \brief Ajax search component for TakePos. It search products of a category.
|
* \brief Ajax search component for TakePos. It search products of a category.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
|||||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||||
|
|
||||||
require '../main.inc.php'; // Load $user and permissions
|
require '../../main.inc.php'; // Load $user and permissions
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
|
||||||
$category = GETPOST('category', 'alpha');
|
$category = GETPOST('category', 'alpha');
|
||||||
@ -226,7 +226,8 @@ function MoreCategories(moreorless) {
|
|||||||
ClearSearch();
|
ClearSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
function LoadProducts(position, issubcat=false) {
|
// LoadProducts
|
||||||
|
function LoadProducts(position, issubcat) {
|
||||||
console.log("LoadProducts");
|
console.log("LoadProducts");
|
||||||
var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
|
var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
|
||||||
|
|
||||||
@ -251,7 +252,7 @@ function LoadProducts(position, issubcat=false) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
idata=0; //product data counter
|
idata=0; //product data counter
|
||||||
$.getJSON('./ajax.php?action=getProducts&category='+currentcat, function(data) {
|
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&category='+currentcat, function(data) {
|
||||||
console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat);
|
console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat);
|
||||||
|
|
||||||
while (ishow < maxproduct) {
|
while (ishow < maxproduct) {
|
||||||
@ -297,7 +298,7 @@ function MoreProducts(moreorless) {
|
|||||||
if (pageproducts==0) return; //Return if no less pages
|
if (pageproducts==0) return; //Return if no less pages
|
||||||
pageproducts=pageproducts-1;
|
pageproducts=pageproducts-1;
|
||||||
}
|
}
|
||||||
$.getJSON('./ajax.php?action=getProducts&category='+currentcat, function(data) {
|
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&category='+currentcat, function(data) {
|
||||||
console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
|
console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
|
||||||
|
|
||||||
if (typeof (data[(maxproduct * pageproducts)]) == "undefined" && moreorless=="more"){ // Return if no more pages
|
if (typeof (data[(maxproduct * pageproducts)]) == "undefined" && moreorless=="more"){ // Return if no more pages
|
||||||
@ -413,10 +414,11 @@ function New() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Search2() {
|
function Search2() {
|
||||||
console.log("Search2");
|
console.log("Search2 Call ajax search to replace products");
|
||||||
pageproducts=0;
|
pageproducts=0;
|
||||||
$.getJSON('./ajax.php?action=search&term='+$('#search').val(), function(data) {
|
jQuery(".catwatermark").hide();
|
||||||
for (i = 0; i < 30; i++) {
|
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&term='+$('#search').val(), function(data) {
|
||||||
|
for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
|
||||||
if (typeof (data[i]) == "undefined"){
|
if (typeof (data[i]) == "undefined"){
|
||||||
$("#prodesc"+i).text("");
|
$("#prodesc"+i).text("");
|
||||||
$("#proimg"+i).attr("src","genimg/empty.png");
|
$("#proimg"+i).attr("src","genimg/empty.png");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user