to begin I want to thanks Andy for this usefull “featured product” module.
It works for me, but I have a little question :
I would like to use this module to display products of any categories on my home page, instead of displaying a product in a category page.
So I tried to modify the code of the function getFeaturedProduct() in the app/code/local/MyCompany/Catalog/Block/Product/Featured.php file.
But I didn’t found how to select every products of my catalog, instead of selecting products from a particular category.
Now i’m going to try to display a random item from all the items marked as featured, because I actually get the same item at every refresh.
I’ll post the code here if I find something.
Ok, I finally have a working function to display a random article from theire who are marked as featured on my home page. You have to follow this tutorial and just change the function getFeaturedProduct() from app/code/local/MyCompany/Catalog/Block/Product/Featured.php by this code :
I did as being said in the tutorial in wiki page. But it doesn’t show on any page. Is it working for any person? If so can anyone put this in the extension?
I did as being said in the tutorial in wiki page. But it doesn’t show on any page. Is it working for any person? If so can anyone put this in the extension?
I’ve just tried this and it doesn’t wokr to me. When I add the block on file “local.xml” all category pages are blank (without products).
Not to steal the significance of Andy’s thread, http://www.magentocommerce.com/boards/viewthread/4780/P0/, as it’s what got me started modding out my functions. And to get this to work you need to follow the same steps as far as getting this in place, so I won’t be redundant. Also I’m not the best of documenters.
Simply though looking at the way the Magento team handled New and Random, I simply thought, why don’t we do this with the Featured function. It would make it cleaner and utilize more of the core functions instead of using Zend DB to figure out how to build a query statement. So I don’t take much credit for this. It was already there, finding it was a chore though.
I did want it to be flexible though so that I can make it global or by category, change the order and the product number. And please note that it still is a bit custom for my needs and I’m pulling only the attributes I need.
This a snippet from my singlebycategory.phtml template that I utilize on the “Shop Now” block of my current project: http://www.netizenron.com/boomsite.php.
I successfully got this module working, however, I’m lacking a couple of things.
1. I have my featured product displayed on the same page as several other products on the category page, and the featured product is listed at the top of the page as a featured item (created from this module) then it’s also shown further down in the page with the rest of the product collection. How do I avoid repetition of the featured item?
2. I can only display the featured items name, SKU, description, and photo. I need to display all the options so a user can purchase the featured item without having to click into it’s detail page… how do I do this? Below is the code I have in featured.phtml
class MyCompany_Catalog_Block_Category_View extends Mage_Catalog_Block_Category_View { public function getFeaturedProductHtml() { return $this->getBlockHtml(’product_featured’); } } class MyCompany_Catalog_Block_Category_View extends Mage_Catalog_Block_Category_View { public function getFeaturedProductHtml() { return $this->getBlockHtml(’product_featured’); } }
Fatal error: Class ‘MyCompany_Catalog_Block_Category_View’ not found in /nfs/c02/h04/mnt/45486/domains/kehot.com.ar/html/app/code/core/Mage/Core/Model/Layout.php on line 445