public function __toString()
 {
     /**
      * poa = product options atributes
      */
     $update_fields = array();
     $db = Database::Instance();
     $uri = Uri::Instance();
     $string = null;
     $tienda_id = (int) $uri->segment("edit");
     if (request::method() == 'post' and is_array(@$_POST['igallery_h'])) {
         $db->query("DELETE FROM product_images where product_id_product = {$tienda_id}");
         $ic = 0;
         if (@$_FILES['igallery'] != "") {
             $arrf = $this->reArrayFiles($_FILES['igallery']);
         }
         foreach ($_POST['igallery_h'] as $value) {
             //         echo Kohana::debug($value);
             //         echo Kohana::debug($arrf[$ic]);
             if (@$arrf[$ic]['name'] != "") {
                 $value = $this->upimg($arrf[$ic]);
             }
             //         echo Kohana::debug($value);
             //         echo "INSERT INTO product_images (product_id_product ,pi_image) VALUES ('$tienda_id','$value')";
             if ($value != "") {
                 try {
                     $db->query("INSERT INTO product_images (product_id_product ,pi_image) VALUES ('{$tienda_id}','{$value}')");
                 } catch (Exception $e) {
                     echo Kohana::debug('Error: ' . "\n" . $e->getMessage() . "\n");
                 }
             }
             $ic++;
         }
     }
     try {
         $r = $db->query("SELECT * FROM product_images WHERE product_id_product = {$tienda_id}");
         $string = View::factory("extras/galleryimage")->set("imgs", $r)->render();
     } catch (Exception $e) {
         echo Kohana::debug('Error: ' . "\n" . $e->getMessage() . "\n");
     }
     return $string;
 }
예제 #2
0
 public static function GalleryImage()
 {
     $uri = Uri::Instance();
     $id = (int) $uri->segment('id');
     $db = Database::Instance();
     $r = $db->query("SELECT * FROM product_images WHERE product_id_product = {$id}");
     $str = null;
     $ct = 0;
     foreach ($r as $row) {
         $str .= '
     <a rel="prettyPhoto[grp]" id="imggal_' . $ct . '" href="' . basics::upload() . $row->pi_image . '" class="gallery" >a
     </a>';
         $ct++;
     }
     return $str;
 }
예제 #3
0
 public static function GetSchemaCategory_SelDisplay()
 {
     $initlevel = 1;
     $html = null;
     $new_array = array();
     $table = new fpp_category_Model();
     $orm = $table->db2cls();
     $orm->limit = null;
     $checksub = true;
     $uri = Uri::Instance();
     $itemid = (int) $uri->segment("items");
     $rl1 = $orm->fetch_where(array('enable' => '1'), array('cat_id' => 'ASC', 'order_cat' => 'DESC'));
     foreach ($rl1 as $row) {
         if ($row->cat_id == $initlevel) {
             $new_array[$row->id_category] = $row;
             $new_array[$row->id_category]->sub = array();
         } else {
             $nnew_array[$row->id_category] = $row;
             $nnew_array2[$row->cat_id][] = $row;
             if ($row->cat_id == $itemid) {
                 $new_array[$itemid]->sub[] = $row;
                 $checksub = false;
             }
         }
     }
     if ($checksub and @$nnew_array[$itemid]->cat_id != "") {
         $cidn12 = $nnew_array[$itemid]->cat_id;
         $arraycid = $nnew_array2[$cidn12];
         $new_array[$cidn12]->sub = $arraycid;
     }
     foreach ($new_array as $row) {
         $name_category = Basic::TransVar("name_category");
         $href = html::anchor("category/items/" . @$row->id_category, @$row->{$name_category});
         $img = $row->image_category != "" ? html::image(basics::upload() . $row->image_category) : null;
         if (!(@$row->id_category == '')) {
             $html .= "<li class='supcat'>{$img} {$href}</li>";
             foreach ($row->sub as $sub) {
                 $href = html::anchor("category/items/" . $sub->id_category, $sub->{$name_category});
                 $html .= "<li  class='subcat'>{$href}</li>";
             }
             //           $html .= "</ul>";
         }
     }
     //       echo Kohana::debug($new_array);
     return $html;
 }