Exemplo 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)));
         }
     }
 }
Exemplo n.º 2
0
 function __construct()
 {
     list($func) = CORE::$args;
     self::$temp = CORE::$temp_main;
     $m_id = SESS::get('m_id');
     switch ($func) {
         case "thankyou":
             new RESPONSE('contact', CORE::$lang['contactThanks']);
             break;
         case "add":
             self::$temp["MAIN"] = CORE::$temp_option["MSG"];
             self::add($m_id);
             break;
         default:
             self::$temp["MAIN"] = 'ogs-contact-tpl.html';
             self::form($m_id);
             break;
     }
     PRODUCTS::nav();
     new VIEW(CORE::$temp_option["HULL"], self::$temp, false, false);
 }
Exemplo n.º 3
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']));
         }
     }
 }
Exemplo n.º 4
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';
     }
 }
Exemplo n.º 5
0
 private static function detail()
 {
     $rsnum = CRUD::dataFetch('products', array('id' => self::$id));
     if (!empty($rsnum)) {
         list($row) = CRUD::$data;
         foreach ($row as $field => $var) {
             VIEW::assignGlobal("VALUE_" . strtoupper($field), $var);
         }
         SCHEMA::make('products_detail', $row);
         VIEW::assignGlobal("VALUE_BACK_LINK", self::dataLink(self::$cate));
         IMAGES::load('products', $row["id"]);
         foreach (IMAGES::$data as $key => $images) {
             switch ($key) {
                 case 0:
                     break;
                 case 1:
                     foreach ($images as $field => $var) {
                         VIEW::assignGlobal("IMAGE_" . strtoupper($field), $var);
                     }
                 default:
                     VIEW::newBlock("TAG_IMAGES");
                     foreach ($images as $field => $var) {
                         VIEW::assign("IMAGES_" . strtoupper($field), $var);
                     }
                     break;
             }
         }
         if (empty($row["discount"])) {
             VIEW::assignGlobal("DISCOUNT_NONE", 'style="display: none;"');
         }
         SEO::load($row["seo_id"]);
         if (empty(SEO::$data["h1"])) {
             SEO::$data["h1"] = $row["subject"];
         }
         SEO::output();
         CRUMBS::fetch('products', $row);
         while (++$i <= 99) {
             VIEW::newBlock("TAG_AMOUNT_LIST");
             VIEW::assign("VALUE_AMOUNT", $i);
         }
         PRODUCTS::related($row['related']);
     }
 }
Exemplo n.º 6
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"]));
 }