Hi,
For a project (and for many other ones I guess), we had to add this "one or many categories" option in the product list module as we use categories as "attributes".
For example, for a product which can be published in a certain category and which has a certain supplier, we build a category tree like this:
Code:
Main categories
- One category
- Another category
- ...
Suppliers
- My first supplier
- Another one
- ...
Thus, only by giving the user the right to manage categories (pages), s/he can create new suppliers (= new pages) and we can create menus with one page per supplier. That page can have a "product list" module and so, this way, when the user create a news product in Isotope, s/he selects both the main category and the supplier.
(by the way, if you have any better ideas for us to manage this kind of attributes...)
We start using this technique a lot and faced the fact that the product list module does not allow us to select one (or several) categories in the page tree. We made the following changes as a module:
config/database.sql
Code:
CREATE TABLE `tl_module` (
`iso_categories` blob NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
dca/tl_module.php
Code:
$GLOBALS['TL_DCA']['tl_module']['palettes']['iso_productlist']
= preg_replace('/([,;]iso_category_scope)([,;$])/', '\1,iso_categories\2', $GLOBALS['TL_DCA']['tl_module']['palettes']['iso_productlist']);
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_category_scope']['options'][] = 'categories';
$GLOBALS['TL_DCA']['tl_module']['fields']['iso_categories'] = array (
'label' => &$GLOBALS['TL_LANG']['tl_module']['iso_categories'],
'filter' => true,
'inputType' => 'pageTree',
'foreignKey' => 'tl_page.title',
'eval' => array('mandatory'=>false, 'multiple'=>true, 'fieldType'=>'checkbox')
);
ModuleIsotopeProductList.php
Code:
// add this case to the switch in the findProduct() function
case 'categories':
$arrCategories = deserialize($this->iso_categories);
break;
This way, we can select a particular category when creating a product list module (for example a "Featured product" module with a "Featured products" category selected).
It sure would be a great idea to add such a (simple) feature in the next release of Isotope
Nicolas.
Bookmarks