1

I tried add a list_mode in magento but all that this was able to accomplish (for me, on v1.9.1.0) was appending the list in Configuration > System > Catalog > Front End > List Mode. I saved the new setting but when echoing "$this->getMode()" nothing is returned unless I select one of the grid or list options.

\app\code\local\Mage\Adminhtml\Model\System\Config\Source\Catalog\ListMode.php

class Mage_Adminhtml_Model_System_Config_Source_Catalog_ListMode
{
    public function toOptionArray()
    {
        return array(
            //array('value'=>'', 'label'=>''),
            array('value'=>'grid', 'label'=>Mage::helper('adminhtml')->__('Grid Only')),
            array('value'=>'list', 'label'=>Mage::helper('adminhtml')->__('List Only')),
            array('value'=>'slider', 'label'=>Mage::helper('adminhtml')->__('Slider Only')),
            array('value'=>'grid-list', 'label'=>Mage::helper('adminhtml')->__('Grid (default) / List')),
            array('value'=>'list-grid', 'label'=>Mage::helper('adminhtml')->__('List (default) / Grid')),
            array('value'=>'slider-grid-list', 'label'=>Mage::helper('adminhtml')->__('Slider (default) / Grid / List')),
        );
    }
}

1 Answer 1

2

Resolved:

Needed to add to the list of acceptable views.

/home/user/public_html/app/code/local/Mage/Catalog/Block/Product/List/Toolbar.php

/**
 * Init Toolbar
 *
 */
protected function _construct()
{
    parent::_construct();
    $this->_orderField  = Mage::getStoreConfig(
        Mage_Catalog_Model_Config::XML_PATH_LIST_DEFAULT_SORT_BY
    );

    $this->_availableOrder = $this->_getConfig()->getAttributeUsedForSortByArray();

    switch (Mage::getStoreConfig('catalog/frontend/list_mode')) {
        case 'slider':
            $this->_availableMode = array('slider' => $this->__('Slider'));
            break;

        case 'grid':
            $this->_availableMode = array('grid' => $this->__('Grid'));
            break;

        case 'list':
            $this->_availableMode = array('list' => $this->__('List'));
            break;

        case 'grid-list':
            $this->_availableMode = array('grid' => $this->__('Grid'), 'list' =>  $this->__('List'));
            break;

        case 'list-grid':
            $this->_availableMode = array('list' => $this->__('List'), 'grid' => $this->__('Grid'));
            break;

        case 'slider-grid-list':
            $this->_availableMode = array('slider' => $this->__('Slider'), 'grid' => $this->__('Grid'), 'list' => $this->__('List'));
            break;
    }
    $this->setTemplate('catalog/product/list/toolbar.phtml');
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.