Welcome Guest, Not a member yet? Register   Sign In
Accessing models from helpers
#8

[eluser]james182[/eluser]
ok so i am having issues getting this to work, it shows the first but that's it.

Helper
Code:
function product_by_id($id)
    {
        $ci =& get_instance();
        $ci->load->model('store/products_m');

        $title = $ci->products_m->get_product_title($id);
        
        return $title->title;
    }

Model
Code:
public function get_product_title($id)
    {
        return $this->db->select('title')
                        ->where('id', $id)
                        ->get('store_products')
   ->row();
    }

View
Code:
<ul>
                            &lt;?php foreach($order->ordered_items as $itm): ?&gt;
                                <li>&lt;?php echo product_by_id($itm->product_id) .' -- $'.$itm->price; ?&gt;</li>
                            &lt;?php endforeach; ?&gt;
                            </ul>


Messages In This Thread
Accessing models from helpers - by El Forum - 05-15-2010, 09:31 AM
Accessing models from helpers - by El Forum - 05-15-2010, 09:38 AM
Accessing models from helpers - by El Forum - 05-15-2010, 09:50 AM
Accessing models from helpers - by El Forum - 05-15-2010, 09:56 AM
Accessing models from helpers - by El Forum - 05-15-2010, 09:58 AM
Accessing models from helpers - by El Forum - 05-15-2010, 10:43 AM
Accessing models from helpers - by El Forum - 05-15-2010, 10:59 AM
Accessing models from helpers - by El Forum - 03-12-2012, 04:02 AM
Accessing models from helpers - by El Forum - 03-12-2012, 07:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB