Example #1
0
 public function __construct($productId)
 {
     $this->productId = $productId;
     if (isset($this->productId) && $this->productId != '') {
         $this->listImages = array();
         $imageDa = new ImageDa();
         $listTmpImages = $imageDa->GetImgListByProduct($this->productId);
         if (isset($listTmpImages) && count($listTmpImages) > 0) {
             $this->load->helper('url');
             foreach ($listTmpImages as $img) {
                 $img->Path = base_url($img->Path);
                 array_push($this->listImages, $img);
             }
         }
     }
 }
Example #2
0
 public function init()
 {
     if (isset($this->productId)) {
         $productDa = new ProductDa();
         $this->detail = $productDa->getProductDetail($this->productId);
         $imageDa = new ImageDa();
         $this->imgs = $imageDa->GetImgListByProduct($this->productId);
         $this->load->helper('url');
         foreach ($this->imgs as $img) {
             $img->Path = base_url($img->Path);
         }
         $relateProducts = $productDa->getRelateProduct($this->productId, $this->categoryId);
         foreach ($relateProducts as $product) {
             $productItem = new ProductItemModel();
             $productItem->init($product);
             array_push($this->relateProducts, $productItem);
         }
     }
 }
Example #3
0
 public function init()
 {
     if (isset($this->productId)) {
         $productDa = new ProductDa();
         $this->detail = $productDa->getProductDetail($this->productId);
         $imageDa = new ImageDa();
         $this->imgs = $imageDa->GetImgListByProduct($this->productId);
         $this->load->helper('url');
         foreach ($this->imgs as $img) {
             $img->Path = base_url($img->Path);
         }
         $relateProducts = $productDa->getRelateProduct($this->productId, $this->categoryId);
         foreach ($relateProducts as $product) {
             $productItem = new ProductItemModel();
             $productItem->init($product);
             array_push($this->relateProducts, $productItem);
         }
         $attributeValuesDa = new AttributeValueDa();
         $attrs = $attributeValuesDa->getListMappingProduct($this->productId);
         $stdAttrs = array();
         if (isset($attrs) && count($attrs) > 0) {
             foreach ($attrs as $attr) {
                 if (isset($stdAttrs[$attr->AttributeId])) {
                     $stdAttr = $stdAttrs[$attr->AttributeId];
                     $stdAttr->Value += ";" + $attr->Value;
                 } else {
                     $stdAttrs[$attr->AttributeId] = $attr;
                 }
             }
         }
         if (count($stdAttrs) > 0) {
             foreach ($stdAttrs as $attr) {
                 array_push($this->attrs, $attr);
             }
         }
     }
 }
Example #4
0
 public function uploadTest()
 {
     $path = 'uploads/test.png';
     $imageDa = new ImageDa();
     $imgId = $imageDa->InsertImg($path);
     $this->load->helper('url');
     $fullPath = base_url($path);
     $result = array(0 => $imgId, 1 => $fullPath);
     $jsonResult = json_encode($result);
     echo $jsonResult;
 }