Exemple #1
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);
         }
     }
 }
Exemple #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);
         }
         $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);
             }
         }
     }
 }