[+] MO : add the option to show all Manufacturer

Add the option to show all Manufacturer in blocktopmenu module.
This commit is contained in:
gr4devel
2013-08-29 21:32:10 +02:00
parent e6abe1c5a0
commit 39c8a8fc2d

View File

@@ -228,6 +228,8 @@ class Blocktopmenu extends Module
// BEGIN Manufacturer
$this->_html .= '<optgroup label="'.$this->l('Manufacturer').'">';
// Option to show all Manufacturer
$this->_html .= '<option value="ALLMAN0">'.$this->l('All manufacturers').'</option>';
$manufacturers = Manufacturer::getManufacturers(false, $id_lang);
foreach ($manufacturers as $manufacturer)
$this->_html .= '<option value="MAN'.$manufacturer['id_manufacturer'].'">'.$spacer.$manufacturer['name'].'</option>';
@@ -472,6 +474,11 @@ class Blocktopmenu extends Module
$this->_html .= '<option value="CMS_CAT'.$id.'">'.$category->name.'</option>'.PHP_EOL;
break;
// Case to handle the option to show all Manufacturer
case 'ALLMAN':
$this->_html .= '<option value="ALLMAN0">'.$this->l('All manufacturers').'</option>'.PHP_EOL;
break;
case 'MAN':
$manufacturer = new Manufacturer((int)$id, (int)$id_lang);
if (Validate::isLoadedObject($manufacturer))
@@ -563,6 +570,17 @@ class Blocktopmenu extends Module
}
break;
// Case to handle the option to show all Manufacturer
case 'ALLMAN':
$this->_menu .= '<li><a>'.$this->l('All manufacturers').'</a><ul>'.PHP_EOL;
$manufacturers = Manufacturer::getManufacturers();
$link = new Link;
foreach ($manufacturers as $key => $manufacturer) {
$this->_menu .= '<li><a href="'.$link->getManufacturerLink((int)$manufacturer['id_manufacturer'], $manufacturer['link_rewrite']).'">'.$manufacturer['name'].'</a></li>'.PHP_EOL;
}
$this->_menu .= '</ul>';
break;
case 'SUP':
$selected = ($this->page_name == 'supplier' && (Tools::getValue('id_supplier') == $id)) ? ' class="sfHover"' : '';
$supplier = new Supplier((int)$id, (int)$id_lang);
@@ -896,4 +914,4 @@ class Blocktopmenu extends Module
}
}
}