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); }
<div class="p_r_txt" style="width: 250px;padding-left:10px;padding-right:10px;"> <?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 }
//$url="file:///C:/Users/simon/Desktop/try1.html"; $html_snippet = $_GET['value']; $table_name = $_GET['tablename']; //."_&_collectibles"; // have to use it later. this is used for spec table //$table_name_currenttable ="bicycles"; // this will come from the post later $product_id = $_GET['id']; //$innerHtml = file_get_html($url); $innerHtml = str_get_html($html_snippet); //echo $html_snippet; //echo $table_name; //echo $product_id; $ProductArray = NULL; $SingleProduct = NULL; $counter = 0; foreach ($innerHtml->find('div[class=comp comp-product-specs]') as $mitem) { $SingleProduct = new productspec(); $SingleProduct->SetProductID($product_id); foreach ($mitem->find('div[class=spec-section expanded]') as $item) { foreach ($item->find('div[class=spec-title-wrp]') as $item_title) { //echo $item_title; $SingleProduct->SetProductSpecType($item_title->plaintext); } foreach ($item->find('div[class=spec-body]') as $item_body) { if ($item_body->find('ul')) { $type_list_data_combined = ""; foreach ($item_body->find('ul li') as $item_spec_li_data) { //echo "This list data: ". $item_spec_li_data; $type_list_data_combined .= $item_spec_li_data->plaintext . ","; } //echo "List Combined data : ". $type_list_data_combined; $SingleProduct->SetProductData(rtrim($type_list_data_combined, ","));