Skip to main content
more description
Source Link
Ibrahim Mumcu
  • 531
  • 3
  • 10
  • 22

I have a page that I getting all products with some attributes. (room, color, size, price)

I change "Catalog Input Type for Store Owner" for room attribute on database. It was dropdown, now multiselect.

After this change the page returning null. Is anyone know why?

It's the part of code:

$room = $_POST['room']; $collection = Mage::getResourceModel('reports/product_collection') ->addAttributeToSelect('*') //->addAttributeToFilter('color', 7) ->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id', null, 'left') ->addAttributeToFilter('category_id', array('in' => $catID)) ->addAttributeToFilter('size', array('in'=>$size)) ->addAttributeToFilter('room', array('in'=>$room)) ->addStoreFilter() ->setOrder('created_at', 'desc') ->setPage($pageNumber, $productPerPage) ->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds()); //$collection->getSelect()->order('rand()'); //$collection->getSelect()->limit(12); $collection->addAttributeToFilter('price', array('gt'=>$priceL)); $collection->addAttributeToFilter('price', array('lt'=>$priceG)); 

Edit: If I remove "->addAttributeToFilter('room', array('in'=>$room))" line, it's perfectly working.

I have a page that I getting all products with some attributes. (room, color, size, price)

I change "Catalog Input Type for Store Owner" for room attribute on database. It was dropdown, now multiselect.

After this change the page returning null. Is anyone know why?

It's the part of code:

$room = $_POST['room']; $collection = Mage::getResourceModel('reports/product_collection') ->addAttributeToSelect('*') //->addAttributeToFilter('color', 7) ->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id', null, 'left') ->addAttributeToFilter('category_id', array('in' => $catID)) ->addAttributeToFilter('size', array('in'=>$size)) ->addAttributeToFilter('room', array('in'=>$room)) ->addStoreFilter() ->setOrder('created_at', 'desc') ->setPage($pageNumber, $productPerPage) ->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds()); //$collection->getSelect()->order('rand()'); //$collection->getSelect()->limit(12); $collection->addAttributeToFilter('price', array('gt'=>$priceL)); $collection->addAttributeToFilter('price', array('lt'=>$priceG)); 

I have a page that I getting all products with some attributes. (room, color, size, price)

I change "Catalog Input Type for Store Owner" for room attribute on database. It was dropdown, now multiselect.

After this change the page returning null. Is anyone know why?

It's the part of code:

$room = $_POST['room']; $collection = Mage::getResourceModel('reports/product_collection') ->addAttributeToSelect('*') //->addAttributeToFilter('color', 7) ->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id', null, 'left') ->addAttributeToFilter('category_id', array('in' => $catID)) ->addAttributeToFilter('size', array('in'=>$size)) ->addAttributeToFilter('room', array('in'=>$room)) ->addStoreFilter() ->setOrder('created_at', 'desc') ->setPage($pageNumber, $productPerPage) ->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds()); //$collection->getSelect()->order('rand()'); //$collection->getSelect()->limit(12); $collection->addAttributeToFilter('price', array('gt'=>$priceL)); $collection->addAttributeToFilter('price', array('lt'=>$priceG)); 

Edit: If I remove "->addAttributeToFilter('room', array('in'=>$room))" line, it's perfectly working.

Source Link
Ibrahim Mumcu
  • 531
  • 3
  • 10
  • 22

getting error after change attribute input type

I have a page that I getting all products with some attributes. (room, color, size, price)

I change "Catalog Input Type for Store Owner" for room attribute on database. It was dropdown, now multiselect.

After this change the page returning null. Is anyone know why?

It's the part of code:

$room = $_POST['room']; $collection = Mage::getResourceModel('reports/product_collection') ->addAttributeToSelect('*') //->addAttributeToFilter('color', 7) ->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id', null, 'left') ->addAttributeToFilter('category_id', array('in' => $catID)) ->addAttributeToFilter('size', array('in'=>$size)) ->addAttributeToFilter('room', array('in'=>$room)) ->addStoreFilter() ->setOrder('created_at', 'desc') ->setPage($pageNumber, $productPerPage) ->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds()); //$collection->getSelect()->order('rand()'); //$collection->getSelect()->limit(12); $collection->addAttributeToFilter('price', array('gt'=>$priceL)); $collection->addAttributeToFilter('price', array('lt'=>$priceG));