Esempio n. 1
0
 private static function products()
 {
     self::$rsnum[] = $rsnum = CRUD::dataFetch('products', array('langtag' => CORE::$langtag, 'status' => '1', 'custom' => "(subject like '%" . self::$kw . "%' or info like '%" . self::$kw . "%' or content like '%" . self::$kw . "%')"));
     if (!empty($rsnum)) {
         $dataRow = CRUD::$data;
         foreach ($dataRow as $key => $row) {
             $content = empty($row["content"]) ? $row["info"] : $row["content"];
             VIEW::newBlock("TAG_SEARCH_LIST");
             VIEW::assign(array("VALUE_SUBJECT" => $row["subject"], "VALUE_CONTENT" => mb_substr(strip_tags($content), 0, 50, 'UTF-8'), "VALUE_LINK" => PRODUCTS::dataLink($row["parent"], $row)));
         }
     }
 }
Esempio n. 2
0
 public static function related($related = false)
 {
     if (empty($related)) {
         return false;
     }
     $relatedArray = json_decode($related, true);
     $rsnum = CRUD::dataFetch('products', array('id' => $relatedArray, 'status' => '1', 'langtag' => CORE::$langtag));
     if (!empty($rsnum)) {
         VIEW::newBlock("TAG_RELATED_BLOCK");
         $dataRow = CRUD::$data;
         foreach ($dataRow as $key => $row) {
             VIEW::newBlock("TAG_RELATED_LIST");
             IMAGES::load('products', $row["id"]);
             list($image) = IMAGES::$data;
             VIEW::assign(array("VALUE_ID" => $row['id'], "VALUE_SUBJECT" => $row['subject'], "VALUE_IMAGE" => $image['path'], "VALUE_ALT" => $image['alt'], "VALUE_TITLE" => $image['title'], "VALUE_LINK" => PRODUCTS::dataLink($row['parent'], $row), "VALUE_PRICE" => $row['price']));
         }
     }
 }
Esempio n. 3
0
 private static function seek($id = false)
 {
     if (empty($_POST['call'])) {
         echo 'NONE';
     }
     $seekStr = $_POST['call'];
     if (!empty($id)) {
         $rsnum = CRUD::dataFetch('products', array('id' => $id), array('related'));
         if (!empty($rsnum)) {
             list($nowRow) = CRUD::$data;
             if (!empty($nowRow['related'])) {
                 $relatedArray = json_decode($nowRow['related'], true);
                 $seekFilter = "id NOT IN('" . implode("','", $relatedArray) . "','" . $id . "')";
                 $sk = array('status' => '1', 'langtag' => CORE::$langtag, 'subject' => '%' . $seekStr . '%', 'custom' => $seekFilter);
             } else {
                 $sk = array('status' => '1', 'langtag' => CORE::$langtag, 'subject' => '%' . $seekStr . '%', 'id' => "!{$id}");
             }
         }
     }
     if (empty($sk) || !is_array($sk)) {
         $sk = array('status' => '1', 'langtag' => CORE::$langtag, 'subject' => '%' . $seekStr . '%');
     }
     $rsnum = CRUD::dataFetch('products', $sk);
     if (!empty($rsnum)) {
         $dataRow = CRUD::$data;
         foreach ($dataRow as $key => $row) {
             foreach ($row as $field => $var) {
                 $output[$key][$field] = rawurlencode($var);
             }
             IMAGES::load('products', $row["id"]);
             list($image) = IMAGES::$data;
             $output[$key]['image'] = '<img src="' . $image['path'] . '" style="width: 100px;">';
             $output[$key]['link'] = PRODUCTS::dataLink($row['parent'], $row);
         }
         if (is_array($output)) {
             echo json_encode($output);
         }
     } else {
         echo 'NONE';
     }
 }
Esempio n. 4
0
 private static function productsCateFetch(array $row)
 {
     if (!empty($row["parent"])) {
         $rsnum = CRUD::dataFetch('products_cate', array('id' => $row["parent"]));
         if (!empty($rsnum)) {
             list($parentRow) = CRUD::$data;
             self::productsCateFetch($parentRow);
         }
     }
     self::make($row["subject"], PRODUCTS::dataLink($row["id"]));
 }