0

i am working on multi store website. i want to show all Featured product from all store in main store. can we get Featured products from all store in magento ?

  • Posting some extra code of what you've done might help trigger some more responses! – Sander Mangel Apr 1 '14 at 11:47
2

I guess you have some category or attribute that defines these 'featured products'. In that case we can retrieve the collection under scope 0 (admin scope) using emulation.

$appEmulation = Mage::getSingleton('core/app_emulation');
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation(0);

$collection = Mage::getModel('catalog/product')->getCollection()
   ->addAttributeToFilter('is_featured', 1) // or whatever you use to define featured products
   ->addAttributeToSelect('thumbnail')
   ->addAttributeToSelect('name')
   ->addAttributeToSelect('...');

$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);

An important note, checking the stock and some other store level dependent will probably not work as expected. So although this is possible it could have some issues

  • Thanks for answer. but when i try this code i got Fatal error: Call to a member function getBackend() on a non-object in /var/www/gala/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 816 – Sandeep Solanki Apr 8 '14 at 10:09
  • did you try the exact code? – Sander Mangel Apr 8 '14 at 10:58
  • yes. i tryed the exact code – Sandeep Solanki Apr 8 '14 at 11:12
  • skip this one ->addAttributeToSelect('...'). it was an example to indicate you could load more attributes. – Sander Mangel Apr 8 '14 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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