function index() { $order = new Order(); echo 'Grand total is $' . $order->total(); $product = Product::getProductByID(1); echo $product->name . '<br>'; echo $product->price . '<br>'; echo $product->id . '<br>'; echo $product->products_description->description . '<br>'; /* $att = $product->aattributes; foreach($att as $at){ echo $at->name .'<BR>'; $r = $at->where('aattributes_products.product_id' , $product->id)->aattributes_product; echo $r->aattributes_value_id; foreach($at->aattributes_values->value as $av){ foreach($av->aattributes_values as $f){ echo $f->value.'<BR>'; } } echo '<BR>'; } $my_at = new Aattribute_Model; $my_at->name = 'color'; $r = $my_at->where('aattributes_values.value', 'blue')->products; */ echo '<BR><BR>'; $cat = $product->categories; echo 'has ' . $product->find_related('categories')->count_all() . ' categories<br>'; echo 'has ' . $product->like('name', $product->name)->count_all() . ' related products<br>';
<table class="list"> <col width="35" /> <col width="20" /> <col width="20"/> <col width="20" /> <col width="100" /> <tr> <th><input type="checkbox" id="" onClick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></th> <th>ID</th> <th>Product Name</th> <th>Price</th> <th>Product Description</th> </tr> <?php foreach ($products as $pr) { $product = Product::getProductByID($pr->id); echo '<tr> <td class="centered"><input type="checkbox" id="" name="selected[]" /></td> <td align="right">' . $product->id . '</td> <td>' . $product->name . '</td> <td align="right">' . '$' . number_format($product->price, 2) . '</td> <td>' . $product->products_description->description . '</td> </tr>'; } ?> </table> </div> -->
public function loadDetail() { if (!empty($this->item)) { return $this->item; //return the cache } else { if (isset($this->data->id)) { $product = Product::getProductByID($this->data->id); if (!empty($product)) { $this->item->id = $product->id; $this->item->name = $product->name; $this->item->price = $product->price; $this->item->size = $product->size; $this->item->shipping_info = $product->shipping_info; $this->item->tax_ids = $product->tax_ids; $this->item->is_shippable = $product->is_shippable; $this->item->options = $this->data->options; $this->data->item = $this->item; return $this->item; } } return FALSE; } }