<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}

class Product_site extends MX_Controller
{

    public function __construct()
    {
        $this->load->config('product/config');
        $this->load->library('image')->setSourcePath(trim($this->config->item('product_photo_path'), '/'));
    }

    public function plist()
    {
        $this->load->model('product/product_group_tmodel');
        $this->load->model('product/product_tmodel');
        $group = $this->product_group_tmodel->fetch_current();

        $content = [
            'group_name' => $group['name'],
            'items'      => $this->product_tmodel->fetch_all_by_group_id($group['id_product_group']),
        ];

        return $this->parser->parse('product/plist', $content, TRUE);
    }

}
