<?php

$loader = $this->registry->get('load');
$loader->controller('product/productList');

class ControllerProductProductGridListColor extends ControllerProductProductList {

  private $error = array();

  public function index($setting = null) {

    if( !$this->config->get('futuragrade_list_product') || !$this->config->get('futuragrade_status') || !isset($this->request->get['product_id']) ){
      return false;
    }

		$this->document->addScriptApp(array(
      'catalog/view/theme/appmobile/public/js/page.productgridlistcolor.js'
    ));

    $this->load->model('catalog/product');

    $gridid = $this->model_catalog_product->getIDProductGrid($this->request->get['product_id']);

    if(!$gridid){
      return false;
    }

    $setting = array(
      'grid_id'            => $gridid,
      'product_list_color' => true
    );

    $this->data['productcolorlist'] = $this->getChild('product/productList/productColorList', $setting);
    $this->data['icon_cart'] = $this->config->get('icon_cart');

    if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/productgridlistcolor.twig')) {
			$this->template = $this->config->get('config_template') . '/template/product/productgridlistcolor.twig';
		} else {
			$this->template = 'default/template/product/productgridlistcolor.twig';
		}

		$this->response->setOutput($this->render());

  }

}
