getMatchedProductCount($parameters); $products = $productsModel->getMatchedProduct($parameters); $totalProductsCount = $productsModel->getTotalWoocommerceProductsCount($parameters); } else if($_POST["type"] == "woocommerceunmatched") { $notes = "Note: We have found following products with unmatched SKU in Giddh. You can either map the woocommerce products with Giddh product or create new. Click below button to save products in application."; $buttonId = "createwoocommerceunmatchedtogiddh"; $productsCount = $productsModel->getUnmatchedWoocommerceProductCount($parameters); $products = $productsModel->getUnmatchedWoocommerceProduct($parameters); $totalProductsCount = $productsModel->getTotalWoocommerceProductsCount($parameters); $totalProductsCountWithoutSku = $productsModel->getUnmatchedWoocommerceProductCountWithoutSku(); } else if($_POST["type"] == "giddhunmatched") { $notes = "Note: We have found following products with unmatched SKU in Woocommerce. You can either map the Giddh products with Woocommerce product or create new. Click below button to save products in application."; $buttonId = "creategiddhunmatchedtowoocommerce"; $productsCount = $productsModel->getUnmatchedGiddhProductCount($parameters); $products = $productsModel->getUnmatchedGiddhProduct($parameters); $totalProductsCount = $productsModel->getTotalGiddhProductsCount($parameters); $totalProductsCountWithoutSku = $productsModel->getUnmatchedGiddhProductCountWithoutSku(); } if($products && count($products) > 0) { ?>
getPageLinks($productsCount["total"]); if($paginationResult) { ?>No products available.
getAllCategoriesCount($parameters); $categories = $categoriesModel->getAllCategories($parameters); if($categories && count($categories) > 0) { ?> getPageLinks($categoriesCount["total"]); if($paginationResult) { ?>
No categories are available in Woocommerce.
Please wait while we fetch all categories from your woocommerce store!
getSalesAccounts(get_option('giddh_company_unique_name'), get_option('giddh_company_auth_key'), urlencode($_REQUEST["term"])); if($giddhSalesAccounts && $giddhSalesAccounts['status'] == "success" && $giddhSalesAccounts['body'] && count($giddhSalesAccounts['body']) > 0) { $results = array(); $accounts = array(); foreach($giddhSalesAccounts['body'] as $groups) { if($groups['groups'] && count($groups['groups']) > 0) { foreach($groups['groups'] as $group) { if($group['uniqueName'] === "sales" && (($group['accounts'] && count($group['accounts']) > 0) || ($group['groups'] && count($group['groups']) > 0)) && count($results) < 10) { $results = giddhCheckNestedGroups($group, $results, $accounts); } } } } echo json_encode($results); wp_die(); } else { echo json_encode(array()); wp_die(); } } else { echo json_encode(array()); wp_die(); } } function giddhGetStockGroups() { if(get_option('giddh_company_unique_name') && get_option('giddh_company_auth_key') && $_REQUEST["term"]) { $giddhApi = new GiddhApi(); $giddhStockGroups = $giddhApi->getStockGroups(get_option('giddh_company_unique_name'), get_option('giddh_company_auth_key'), urlencode($_REQUEST["term"])); $createOption = array(array("uniqueName" => "create", "value" => "Create New Stock Group", "label" => "Create New Stock Group")); if($giddhStockGroups && $giddhStockGroups['status'] == "success" && $giddhStockGroups['body']['results'] && count($giddhStockGroups['body']['results']) > 0) { $results = array(); foreach($giddhStockGroups['body']['results'] as $result) { $results[] = array("label" => $result["name"], "value" => $result["name"], "uniqueName" => $result["uniqueName"]); } echo json_encode(array_merge($createOption, $results)); wp_die(); } else { echo json_encode($createOption); wp_die(); } } else { echo json_encode($createOption); wp_die(); } } function giddhGetStocks() { if(get_option('giddh_company_unique_name') && get_option('giddh_company_auth_key') && $_REQUEST["term"]) { $productsModel = new GiddhProductsModel(); $parameters = array(); $parameters['q'] = sanitize_text_field($_REQUEST["term"]); $products = $productsModel->searchGiddhProducts($parameters); $createOption = array(array("uniqueName" => "create", "value" => "Create New Stock", "label" => "Create New Stock")); if($products && count($products) > 0) { echo json_encode(array_merge($createOption, $products)); wp_die(); } else { echo json_encode($createOption); wp_die(); } } else { echo json_encode($createOption); wp_die(); } } function giddhGetWoocommerceStocks() { if(get_option('giddh_company_unique_name') && get_option('giddh_company_auth_key') && $_REQUEST["term"]) { $productsModel = new GiddhProductsModel(); $parameters = array(); $parameters['q'] = sanitize_text_field($_REQUEST["term"]); $products = $productsModel->searchWoocommerceProducts($parameters); $createOption = array(array("uniqueName" => "create", "value" => "Create New Stock", "label" => "Create New Stock")); if($products && count($products) > 0) { echo json_encode(array_merge($createOption, $products)); wp_die(); } else { echo json_encode($createOption); wp_die(); } } else { echo json_encode($createOption); wp_die(); } } ?>