Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
trash
/
vhost_www.arlenshop.fr_1556185825
/
htdocs
/
modules
/
csmanufacturer
/
//srv/data/trash/vhost_www.arlenshop.fr_1556185825/htdocs/modules/csmanufacturer/csmanufacturer.php
<?php if (!defined('_PS_VERSION_')) exit; class csmanufacturer extends Module { function __construct() { $this->name = 'csmanufacturer'; $this->tab = 'My Blocks'; $this->version = '1.0'; $this->author = 'Codespot'; parent::__construct(); $this->displayName = $this->l('CS Manufacturer Logo'); $this->description = $this->l('Adds Manufacturer Logo.'); } function install() { if (!parent::install() || !$this->registerHook('home') || !$this->registerHook('header') || !$this->registerHook('actionObjectManufacturerUpdateAfter') || !$this->registerHook('actionObjectManufacturerDeleteAfter')) return false; return true; } public function uninstall() { if (parent::uninstall() == false) return false; $this->_clearCache('csmanufacturer.tpl'); return true; } public function getContent() { $output = '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submitManuFeatured')) { if(Tools::getValue('manufactures')!='') { $this->_clearCache('csmanufacturer.tpl'); $manus = implode(",", Tools::getValue('manufactures')); if (Shop::getContext() != Shop::CONTEXT_SHOP) foreach (Shop::getContextListShopID() as $id_shop) { Configuration::updateValue('HOME_FEATURED_ID_MANUFACTURE', $manus,false,null,$id_shop); } else Configuration::updateValue('HOME_FEATURED_ID_MANUFACTURE',$manus); } else Configuration::updateValue('HOME_FEATURED_ID_MANUFACTURE', ''); if (isset($errors) AND sizeof($errors)) $output .= $this->displayError(implode('<br />', $errors)); else $output .= $this->displayConfirmation($this->l('Settings updated')); } return $output.$this->displayForm(); } public function displayForm() { global $cookie; $categories = Category::getCategories((int)($cookie->id_lang), false); $id = (int)Context::getContext()->shop->id; $id_shop = $id ? $id: Configuration::get('PS_SHOP_DEFAULT'); $arrCheck = explode(",",Configuration::get('HOME_FEATURED_ID_MANUFACTURE')); $manu_list = Manufacturer ::getManufacturers(false,0,false); static $irow_manu = 0; $output = ' <form action="'.$_SERVER['REQUEST_URI'].'" method="post"> <fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend> <div class="margin-form"> <p class="clear"> Mark all checkbox(es) of manufacture which you want to display in the <strong>Featured Tab</strong><sup> *</sup></p> </div> <div style="overflow: auto;" id="manufactureList"> <table cellspacing="0" cellpadding="0" class="table"> <tr> <th>c</th> <th>ID</th> <th style="width: 600px">Manufactures</th> </tr>'; foreach($manu_list as $manu) { $output .= ' <tr '.($irow_manu++ % 2 ? 'class="alt_row"' : '').'> <td><input type="checkbox"'; if(isset($arrCheck) && count($arrCheck)>0) { if(in_array($manu['id_manufacturer'], $arrCheck)) $output .= ' checked=checked'; } $output .= ' name="manufactures[]" value="'.$manu['id_manufacturer'].'"/>'.' </td> <td>'.$manu['id_manufacturer'].'</td> <td>'.$manu['name'].'</td> </tr> '; } $output.='</table> </div> <br/> <center><input type="submit" name="submitManuFeatured" value="'.$this->l('Save').'" class="button" /></center> </fieldset> </form>'; return $output; } function hookHeader($params) { global $smarty; $this->context->controller->addCss($this->_path.'css/csmanufacturer.css', 'all'); } function hookDisplayhome($params) { global $smarty,$cookie; $arrManuFeatureId=array(); $featureManu=array(); if(Configuration::get('HOME_FEATURED_ID_MANUFACTURE') != '') { $arrManuFeatureId = explode(",",Configuration::get('HOME_FEATURED_ID_MANUFACTURE')); $allManu=Manufacturer::getManufacturers(false,0,true); foreach($allManu as $manuFacture) { if(in_array($manuFacture['id_manufacturer'],$arrManuFeatureId)) { $featureManu[]=$manuFacture; } } } if (!$this->isCached('csmanufacturer.tpl', $this->getCacheId('csmanufacturer'))) { $manufacturersAll = Manufacturer::getManufacturers(false,0,true); $smarty->assign(array( 'manufacs' => $manufacturersAll, 'featureManu' => $featureManu, 'ps_manu_img_dir' => _PS_MANU_IMG_DIR_ )); } return $this->display(__FILE__, 'csmanufacturer.tpl',$this->getCacheId('csmanufacturer')); } public function hookActionObjectManufacturerUpdateAfter($params) { $this->_clearCache('csmanufacturer.tpl'); } public function hookActionObjectManufacturerDeleteAfter($params) { $this->_clearCache('csmanufacturer.tpl'); } }