public function setupCats() { $tmp = new ProdCat(); $this->cats = $tmp->findAll('1', '1'); usort($this->cats, "cmpItems"); $this->cats = array_values(array_filter($this->cats, "checkActive")); $this->setupProds(); }
public static function getAllParents($id, $arrParent) { if ($id < 1) { return $arrParent; } $cat = new ProdCat(); $cat->getByID($id); if ($cat->cat_id) { $arrParent[] = $cat; return self::getAllParents($cat->cat_parent_id, $arrParent); } else { return $arrParent; } }
public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); $p = new BrandModel(); $arrPage = $p->getAll(); $arrNe = array(); foreach ($arrPage as $pp) { $arrNe[$pp->brand_id] = $pp->brand_id . " - " . $pp->brand_name; } $return['prod_diskon'] = new Leap\View\InputText("number", "prod_diskon", "prod_diskon", $this->prod_diskon); $return['prod_price'] = new Leap\View\InputText("number", "prod_price", "prod_price", $this->prod_price); $return['prod_stock'] = new Leap\View\InputText("hidden", "prod_stock", "prod_stock", $this->prod_stock); $return['prod_date'] = new Leap\View\InputText("hidden", "prod_date", "prod_date", leap_mysqldate()); $return['prod_pic'] = new Leap\View\InputGallery("prod_pic", "prod_pic", $this->prod_pic); $return['prod_active'] = new Leap\View\InputSelect($this->arrayYesNO, "prod_active", "prod_active", $this->prod_active); // $return['news_text'] = new Leap\View\InputTextArea("news_text", "news_text", $this->news_text); $return['prod_des'] = new Leap\View\InputTextRTE("prod_des", "prod_des", $this->prod_des); $return['prod_brand_id'] = new Leap\View\InputSelect($arrNe, "prod_brand_id", "prod_brand_id", $this->prod_brand_id); $return['prod_status'] = new Leap\View\InputText("hidden", "prod_status", "prod_status", $this->prod_status); $return['prod_story'] = new Leap\View\InputText("hidden", "prod_story", "prod_story", $this->prod_story); $p = new ProdCat(); $arrPage = $p->getAll(); $arrNe = array(); foreach ($arrPage as $pp) { $arrNe[$pp->cat_id] = $pp->cat_id . " - " . $pp->cat_name; } $return['prod_cat_id'] = new Leap\View\InputSelect($arrNe, "prod_cat_id", "prod_cat_id", $this->prod_cat_id); $return['prod_material'] = new Leap\View\InputText("hidden", "prod_material", "prod_material", $this->prod_material); $return['prod_size'] = new Leap\View\InputText("hidden", "prod_size", "prod_size", $this->prod_size); $return['prod_color'] = new Leap\View\InputText("hidden", "prod_color", "prod_color", $this->prod_color); $return['prod_collection_name'] = new Leap\View\InputText("hidden", "prod_collection_name", "prod_collection_name", $this->prod_collection_name); // return $return; // $return = parent::overwriteForm($return, $returnfull); $return['product_fb_og_image'] = new \Leap\View\InputFoto("product_fb_og_image", "product_fb_og_image", $this->product_fb_og_image); $return['spdivider']['prod_name'] = "Product Details"; $return['spdivider']['product_metatitle'] = "SEO"; $return['spdivider']['product_fb_og_title'] = "FB OpenGraph"; // $return['spdivider']['post_attachments'] = "Attachments"; // $return['post_attachments'] = new Leap\View\InputPageAttachment("post_attachments","post_attachments",$this->post_attachments); return $return; }
public function category($args) { list($name, $page) = $args; // $name; $name = urldecode($name); $cat = new ProdCat(); $arr = $cat->getWhere("cat_name LIKE '{$name}'"); // echo $name; ?> <style> .judulcategory { padding-top : 20px; padding-left : 15px; color : #AAA; font-size : 14px; } .judulcategory a { font-size : 14px; color : #AAA; font-family : 'Open Sans', sans-serif; font-weight : normal; } .judulcategory a:hover { text-decoration : underline; } .h1category { padding-top : 20px; padding-bottom : 0px; padding-left : 15px; margin : 0; padding-bottom : 30px; color : #000; font-style : italic; font-family : 'Libre Baskerville', serif; font-size : 28px; } </style> <?php if (count($arr) > 0) { // pr($arr); $arrParent = array(); $arrpp = ProdCat::getAllParents($arr[0]->cat_parent_id, $arrParent); //pr($arrpp); $arrpp2 = array_reverse($arrpp); foreach ($arrpp2 as $bc) { $str[] = "<a href='" . _SPPATH . "pwa/category/" . urlencode($bc->cat_name) . "'>" . $bc->cat_name . "</a>"; } /* * print breadcrumbs if(count($arrpp2)>0) echo "<div class='judulcategory'>".implode(" > ",$str)." > </div>"; */ ?> <h1 class="h1category"><?php echo ucwords($name); ?> </h1> <?php $pc = new ProdModel(); //pagination if ($page < 1 || $page == "") { $page = 1; } $limit = 21; $begin = ($page - 1) * $limit; $link = _SPPATH . "pwa/category/" . urlencode($name) . "/|x|"; $jml = $pc->getJumlah("prod_cat_id = '{$arr[0]->cat_id}'"); //end pagination $arrp = $pc->getWhere("prod_cat_id = '{$arr[0]->cat_id}' LIMIT {$begin},{$limit}"); //pr($arrp); foreach ($arrp as $num => $prod) { $cw = new Cw(); $cw->productPrinter($prod); if ($num % 3 == 2) { ?> <div class="clearfix"></div> <?php } } ?> <div class="clearfix"></div> <div class="gantihal" style="text-align: center;"> <?php //begin pagination BootstrapUX::pagination($page, $jml, $limit, $link); ?> </div> <?php } }
public function getAjaxProdList() { $tmp = new ProdCat(); $cat = $tmp->find('id', $this->req[1]); $prods = $cat->products(); usort($prods, "cmpItems"); $this->smarty->assign('uriHead', $this->getURIHead()); $this->smarty->assign('controller', $this->controller); $this->smarty->assign('cat', $cat); $this->smarty->assign('prods', $prods); $this->ajaxOut = $this->smarty->fetch("ajaxProdList.tpl"); }