Jump to content

Sizechart - how to edit? Change by category not by Manufacturer


Recommended Posts

I have module "sizechart" // prestashop 1.6

 

I have different sizecharts displayed by id_manufacturer. 
I want to be displayed by id_category.
 
Please HELP!
 
modul sizechart atached productssizechart.zip
 
<?php

class productsSizechart extends Module
{
 	function __construct()
 	{
 	 	$this->name = 'productssizechart';
 	 	$this->version = '1.0';
 	 	$this->tab = 'Products';
		
		parent::__construct();
		
		$this->displayName = $this->l('Products Size Chart');
		$this->description = $this->l('Display a Size chart on the products page');
 	}

	function install()
	{
	 	if (!parent::install())
	 		return false;
	 	return $this->registerHook('productfooter');
	}
	

	
	public function hookProductFooter($params)
	{
		if (isset($params['category']->id_category))
		{
                      
							$id_product = $_GET["id_product"];
							$db = Db::getInstance();
							$results = $db->ExecuteS('
							SELECT `id_manufacturer` FROM `'._DB_PREFIX_.'product`
							WHERE `id_product` ="'.intval($id_product).'";
							');
							$manufacturer = $results[0]['id_manufacturer'];
                      if (intval($manufacturer) === 1 )
                      {
 						global $smarty, $cookie;
                        $smarty->assign(array(
                        'this_path' => $this->_path,
						'id_manufacturer' => $results[0]['id_manufacturer'] ,
                        'this_path_ssl' => Configuration::get('PS_FO_PROTOCOL').$_SERVER['HTTP_HOST'].__PS_BASE_URI__."modules/{$this->name}/"));
                        return $this->display(__FILE__, 'productssizechart-puppia.tpl');
                      }
					  
					  if (intval($manufacturer) === 2 )
                      {
 						global $smarty, $cookie;
                        $smarty->assign(array(
                        'this_path' => $this->_path,
						'id_manufacturer' => $results[0]['id_manufacturer'] ,
                        'this_path_ssl' => Configuration::get('PS_FO_PROTOCOL').$_SERVER['HTTP_HOST'].__PS_BASE_URI__."modules/{$this->name}/"));
                        return $this->display(__FILE__, 'productssizechart-deardog.tpl');
                      }
		}
        return;
	}
}
?>

 

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...