Ejemplo n.º 1
0
 public function p($arg)
 {
     list($id, $judul) = $arg;
     $arrkirim = array();
     if ($id < 1 || $id == "") {
         die("NO ID");
     }
     $_SESSION['hist_prod'] = array("id" => $id, "judul" => $judul);
     $_SESSION['hist_url'] = _LANGPATH . "pwa/p/{$id}/" . urlencode($judul);
     $p = new ProdModel();
     $p->getByID($id);
     if ($p->prod_active < 1) {
         header("Location:" . _LANGPATH . "p404");
         exit;
     }
     global $template;
     $template->title = $p->prod_name;
     $src = self::getMainPic($p);
     if ($p->prod_diskon > 0) {
         $hrgbaru = ceil((100 - $p->prod_diskon) / 100 * $p->prod_price);
     } else {
         $hrgbaru = $p->prod_price;
     }
     $cp = new CampaignProdMatrix();
     $arr = $cp->getWhere("cm_prod_id = '{$id}'");
     $cp_id = $arr[0]->cm_camp_id;
     $cp = new CampaignModel();
     $cp->getByID($cp_id);
     $cw = new Cw();
     //		$cw->campaign_header($cp_id, $cp);
     //process image
     $exp = explode(",", $p->prod_pic);
     $sudah = array();
     $arrImg = array();
     if (count($exp) > 1) {
         $if = new InputFileModel();
         foreach ($exp as $num => $img) {
             if (!in_array($img, $sudah)) {
                 $sudah[] = $img;
                 $srcs = _SPPATH . $if->upload_url . "thumbnail/" . $img;
                 $srcs_big = _SPPATH . $if->upload_url . $img;
                 $cl = 'class="nonaktif"';
                 if ($src["thumbs"] == $srcs) {
                     $cl = 'class="aktif"';
                 }
                 //                    $id = base64_encode($srcs);
                 $arrImg[$num] = array($srcs, $srcs_big, $cl);
             }
         }
     }
     //process category
     $cat = new ProdCat();
     $cat->getByID($p->prod_cat_id);
     $arrParent = array();
     $arrpp = ProdCat::getAllParents($cat->cat_parent_id, $arrParent);
     //pr($arrpp);
     $arrpp2 = array_reverse($arrpp);
     foreach ($arrpp2 as $bc) {
         $str[] = $bc->cat_name;
     }
     $str[] = $cat->cat_name;
     //        $str2 = "<a href='" . _LANGPATH . "pwa/category/" . urlencode($cat->cat_name) . "'>".$cat->cat_name . "</a>";
     //bypass roy
     //$str2 = $cat->cat_name;
     $arrCat = $str;
     $arrkirim['p'] = $p;
     $arrkirim['id'] = $id;
     $arrkirim['cp'] = $cp;
     $arrkirim['arrImg'] = $arrImg;
     $arrkirim['arrCat'] = $arrCat;
     $arrkirim['hargaafterdiskon'] = $hrgbaru;
     $arrkirim['src'] = $src;
     $layout_id = "eComm_product";
     $file = Layout::getFile($layout_id);
     //        echo "Pages/".$layout_id."/".$file;
     Mold::theme("Pages/" . $layout_id . "/" . $file, $arrkirim);
 }
 function delMatrix()
 {
     $cmid = isset($_GET['cmid']) ? addslashes($_GET['cmid']) : die("no id");
     $matrix = new CampaignProdMatrix();
     $json['bool'] = $matrix->delete($cmid);
     echo json_encode($json);
 }
Ejemplo n.º 3
0
 function campaign($args)
 {
     list($id, $title, $page) = $args;
     $pc = new CampaignProdMatrix();
     //pagination
     if ($page < 1 || $page == "") {
         $page = 1;
     }
     $limit = 21;
     $begin = ($page - 1) * $limit;
     $link = _SPPATH . "cw/campaign/{$id}/" . urlencode($title) . "/|x|";
     $jml = $pc->getJumlah("cm_camp_id = '{$cp->camp_id}'");
     $_SESSION['hist_url'] = _LANGPATH . "cw/campaign/{$id}/" . urlencode($title) . "/|x|";
     //end pagination
     $cp = new CampaignModel();
     $cp->getByID($id);
     //        $this->campaign_header($id,$cp);
     //pr($cp);
     $arr2 = $pc->getWhereFromMultipleTable("cm_camp_id = '{$id}' AND cm_prod_id = prod_id AND prod_active = 1 ORDER BY cm_latest_added DESC LIMIT {$begin},{$limit}", array("ProdModel"));
     $arr['cp'] = $cp;
     $arr['page'] = $page;
     $arr['jml'] = $jml;
     $arr['prods'] = $arr2;
     $arr['limit'] = $limit;
     $arr['link'] = $link;
     $layout_id = "eComm_campaign";
     $file = Layout::getFile($layout_id);
     //        echo "Pages/".$layout_id."/".$file;
     Mold::theme("Pages/" . $layout_id . "/" . $file, $arr);
 }