Esempio n. 1
0
 function loadVariantsProducts()
 {
     global $toC_Json;
     //get the filters
     $manufacturer = !empty($_POST['cManufacturer']) ? $_POST['cManufacturer'] : null;
     $products_sku = !empty($_POST['products_sku']) ? $_POST['products_sku'] : null;
     $products_name = !empty($_POST['products_name']) ? $_POST['products_name'] : null;
     //Get the current category - Fix the bug#78
     $osC_CategoryTree = new osC_CategoryTree_Admin();
     $cPath = isset($_POST['categories_id']) && !empty($_POST['categories_id']) ? $_POST['categories_id'] : 0;
     $cPath_array = array_unique(array_filter(explode('_', $cPath), 'is_numeric'));
     $current_category_id = end($cPath_array);
     //get the categories
     $in_categories = array();
     if ($current_category_id > 0) {
         $osC_CategoryTree->setBreadcrumbUsage(false);
         $in_categories = array($current_category_id);
         foreach ($osC_CategoryTree->getTree($current_category_id) as $category) {
             $in_categories[] = $category['id'];
         }
     }
     //load the variants products
     $result = osC_Specials_Admin::loadVariantsProducts($in_categories, $manufacturer, $products_sku, $products_name);
     $response = array(EXT_JSON_READER_TOTAL => count($result), EXT_JSON_READER_ROOT => $result);
     echo $toC_Json->encode($response);
 }