예제 #1
0
 function getProductHome()
 {
     $productHome = new producthome();
     $productHome->where_related_product('active', 1);
     $productHome->where('productcat_id', $this->id);
     $productHome->order_by('position', 'asc');
     $productHome->get_iterated($this->numProductHomepage);
     return $productHome;
 }
예제 #2
0
 function save($object = '', $related_field = '')
 {
     if (!$this->exists()) {
         $o = new producthome();
         $o->where("productcat_id", $this->productcat_id);
         $o->select_max('position');
         $o->get();
         if (count($o->all) != 0) {
             $max = $o->position + 1;
             $this->position = $max;
         } else {
             $this->postion = 1;
         }
         $o->clear();
         $o = new producthome();
         $o->where('productcat_id', $this->productcat_id);
         $o->where('product_id', $this->product_id);
         $o->get();
         if ($o->exists()) {
             return true;
         }
     }
     return parent::save($object, $related_field);
 }
예제 #3
0
 function deleteProductHome($id)
 {
     $productHome = new producthome($id);
     $productHome->delete();
 }