Besides 'Category', 'Material', 'Brand', 'Color', 'By price range', 'Color Group', and 'Price', I'd like to add the filter 'Shipped by'

This is what I have in my view:


                <dl id="narrow-by-list">
                <?php $_filters = $this->getFilters() ?>
                <?php $allowedfilter = Array('Category', 'Material', 'Brand', 'Color', 'By price range', 'Color Group', 'Price'); ?>
                <?php foreach ($_filters as $_filter): ?>
                    <?php if ($_filter->getItemsCount() && in_array($_filter->getName(), $allowedfilter)): ?>
                            <span><?php echo str_replace(' Group', '', $this->__($_filter->getName())) ?></span>
                            <?php echo $_filter->getHtml() ?>
                    <?php endif; ?>
                <?php endforeach; ?>

Now, this is what I have in my filter:


$brandsort = Array();
if (preg_match('/Brand/i', $this->getName())) {
    $attribute = Mage::getModel('eav/entity_attribute')->load('brand', 'attribute_code');
    $option_col = Mage::getResourceModel('eav/entity_attribute_option_collection')->setAttributeFilter($attribute->getId())
    foreach ($option_col as $theoption) {
        if ($theoption['sort_order'] < 1) $theoption['sort_order'] = 999;
        $brandsort[$theoption['option_id']] = $theoption['sort_order'];

$items = $this->getItems();

$branditems = Array();
if (preg_match('/Brand/i', $this->getName())) {
    foreach ($items as $key => $item) {
        $items[$key]['sort_order'] = $brandsort[$item['value']];
    function cmp($a, $b) {
        return $a['sort_order'] - $b['sort_order'];

    usort($items, "cmp");

<?php foreach ($items as $_item): ?>
        <a href="<?php echo $this->urlEscape($_item->getUrl()) ?>">
            <?php if ($_item->getCount() > 0): ?>
                <?php if (file_exists('skin/frontend/{my_theme}/images/colors/' . strtolower(str_replace(' ', '_', $_item->getLabel())) . '.jpg') && preg_match('/Color/i', $this->getAttributeModel()->getFrontendLabel())):
                    echo '<img style="border:1px solid #CCCCCC;margin-bottom:3px !important;" src="/skin/frontend/{my_theme}/images/colors/' . strtolower(str_replace(' ', '_', $_item->getLabel())) . '.jpg" alt="' . $_item->getLabel() . '" />';
                endif; ?>
                <?php echo $_item->getLabel() ?>
            <?php endif; ?>
        <?php if ($this->shouldDisplayProductCount()): ?>
            (<?php echo $_item->getCount() ?>)
        <?php endif; ?>
<?php endforeach ?>

I found this code that I think it does what I want, but I don't know how to integrate it to my existing code:

$items->joinField('manages_stock','cataloginventory/stock_item','use_config_manage_stock','product_id=entity_id','cataloginventory_stock_item.use_config_manage_stock=1 or cataloginventory_stock_item.manage_stock=1');

What I want is to filter products given the values of use_config_manage_stock and manage_stock i.e. products that are shipped from the stores of shipped by the manufacturer.

It doesn't have to be this way, I'm just bringing what I have so far.

Any help will be appreciated.

1 Answer 1


You can create your module according to this module


Hope this will be helpful.

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.