function getProductSpec($productGenSpecId) { $productSpec = new productspec(); $productSpec->where('product_id', $this->id); $productSpec->where('productgenspec_id', $productGenSpecId); $productSpec->get(); if (!$productSpec->exists()) { return false; } else { return $productSpec; } }
function save($object = '', $related_field = '') { if ($this->position == NULL || $this->position == 0) { $o = new productspec(); $o->where("product_id", $this->product_id); $o->select_max('position'); $o->get(); if (count($o->all) != 0) { $max = $o->position + 1; $this->position = $max; } else { $this->postion = 1; } } return parent::save($object, $related_field); }
function loadNewProductSpec($id) { $product = new product($id); $dis['productSpec'] = $product->productSpec; $dis['object'] = $product; $dis['base_url'] = base_url(); $allSpec = new productspec(); $allSpec->where('product_id', $product->id); $allSpec->order_by('position', 'asc'); $allSpec->get_iterated(); $dis['allSpec'] = $allSpec; return $this->load->view('admin/products/loadProductSpec', $dis); }
<?php echo $spec->value; ?> </div> <?php $h = 0; foreach ($this->compareProduct as $r) { $h++; ?> <?php if ($h > 1) { ?> <div class="p_r_txt" style="width: 250px;padding-left:10px;padding-right:10px;" > <?php $pSpec = new productspec(); $pSpec->where('productgenspec_id', $spec->productgenspec_id); $pSpec->where('product_id', $r->id); $pSpec->get(); if ($pSpec->exists()) { echo $pSpec->value; } $pSpec->clear(); ?> </div> <?php } ?> <?php } ?>