i am having a problem with using this with multiable stores. i need there to be featured products but different products for different stores. if you go to http://www.buynewenglandarbors.com and see the first product which is MP5836-B and that is from a different store.
Here is the code...
class Mage_Catalog_Block_Product_Homepage extends Mage_Catalog_Block_Product_Abstract
{
public function __construct()
{
parent::__construct();
Im looking for a way to get a static block on my home page.. I dont know the code or reference tag to use to get a static block to appear. The idea is to have a header ad at the top and then I still need to find the code to get a few rows of featured products to show underneath it. Does anyone have all the steps figured out yet to make featured products show?
I’m hoping someone could explain to me why I have this error.. its very very likely it’s something I have done or not done. I followed the instructions in post #9 by dan_w and I have managed to get a single product displayed on the home page right now (even though I have two test products selected as ‘featured’).. plus I get this error..
Fatal error: Class ‘Mage_Review_Helper_Product’ not found in /****/***********/public_html/app/code/core/Mage/Core/Model/App.php on line 779
I have a modified Modern theme running (when I say modified, I mean the CSS), and its Version 1.1.4 according to my Admin section even though I just had Magento Connect upgrade it, it has not changed the version number.
Ok, in order to put products on the homepage based on a custom attribute, you need a block, a template file, and a little bit of css markup. I have attached two files, Homepage.php and homepage.phtml. Homepage.php should be placed in app/code/core/Mage/Catalog/Block/Product/ and homepage.phtml should be placed in app/design/frontend/[your package]/[your theme]/template/catalog/product/. Homepage.php is based off of the new product block but instead of looking for a date period it looks for a custom attribute called ‘home_page_featured’, which leads me to the next step: creating the custom attribute. Create an attribute called ‘home_page_featured’ of the yes/no variety and add this to your default attribute group. You may choose whatever attribute label you wish. Now when you edit a product there will be a yes/no option for this attribute. Set the products that you want to appear on the homepage as yes.
Now to get the products to appear on the homepage, place this in your homepage cms page wherever you want the products to appear:
The homepage.phtml uses the following css classes:
.home-page-cntr{}
.home-page-item{}
.home-page-img{}
.home-page-txt{}
home-page-cntr is the container that holds all of the home-page-products and can be used to determine the width, shape and decoration of the box that holds your featured products. home-page-item is the container that holds each individual item within the main container, home-page-cntr. home-page-img is the image for the item, which is resized and can be adjusted in the homepage.phtml file. Right now, I believe it is set at 65 x 65 pixels. home-page-txt includes the name, price and link to the product. Additional info can be added such as short desc if it so desired. Whatever markup you choose for these classes, make sure you add to the boxes.css file for the skin that you are using. I know that Homepage.php does not follow conventions as it was added to the core app files rather than the local app files, and if anyone is interested I will show how to do that. I just wanted to give you an idea on how to go about doing something like this. Also, if anyone is interested in a “Featured Product” module by category, theres an excellent post from Andy here: http://www.magentocommerce.com/boards/viewthread/4780/
hello for every
i have this error when i apply this method
Fatal error: Class ‘Mage_Review_Helper_Product’ not found in C:Program FilesEasyPHP 2.0b1wwwmagento-1.1.6magentoappcodecoreMageCoreModelApp.php on line 785
can some one help us????
I have version 1.1.6 installed and I have same common problem as a lot of us: instead of new products homepage shows items been added first, when I started to add products in the store.
I played with the CMS code and it didn’t change anything, it still shows old products.
I’m kinda hesitate to do some changes in a core files, hoping that Magento team will post or posted already solution.
<global> .... bunch of stuff... <blocks> <catalog> <!-- block from the other tutorial for featured products on catalog pages --> <rewrite> <product_featured>STORENAME_Catalog_Block_Product_Featured</product_featured> </rewrite> <rewrite> <category_view>STORENAME_Catalog_Block_Category_View</category_view> </rewrite> <!-- block for the homepage feature and goes along with the rest of these changes --> <rewrite> <product_homepage>STORENAME_Catalog_Block_Product_Homepage</product_homepage> </rewrite> </catalog> </blocks> </global>
finally in the CMS > Manage Pages > Home page > Custom Design
I think that is it So now you get featured products on the homepage, without adding files to the core.
I been through this topic and believe this is excellent/clean way to implement this features if it works, unfortunate i have problem regarding what that “STORENAME” should be:
“Fatal error: Class ‘STORENAME_Catalog_Block_Product_Homepage’ not found in /home/~/public_html/app/code/core/Mage/Core/Model/Layout.php on line 451”
as DDMAN had pointed out
“Trying to get this to work but I’m a little confused on “STORENAME”
Is that the code found in system > configuration > Manage stores
I have the code under website, the name under Store name and the code under store view.
I been through this topic and believe this is excellent/clean way to implement this features if it works, unfortunate i have problem regarding what that “STORENAME” should be:
“Fatal error: Class ‘STORENAME_Catalog_Block_Product_Homepage’ not found in /home/~/public_html/app/code/core/Mage/Core/Model/Layout.php on line 451”
as DDMAN had pointed out
“Trying to get this to work but I’m a little confused on “STORENAME”
Is that the code found in system > configuration > Manage stores
I have the code under website, the name under Store name and the code under store view.
Please advise “
tilzinger, please give us a clue
Based on what I have been doing the STORENAME refers to the name of the folder in your local code and can be named whatever you want as long as you use it the same across all your local code files.
Example:
app/code/core/Mage is the core code folder structure
when you want to create local code you create a directory structure that mimics the core code such as app/code/local/storename/ and then whatever code you are putting in your local code.
What I did to make life easier for me is I kept the storename the same as what it is in the core. This means I don’t have to change “Mage” in any of my local code to “storename”
So I created a directory called app/code/local/Mage and in my local.xml instead of putting
<global> .... bunch of stuff... <blocks> <catalog> <!-- block from the other tutorial for featured products on catalog pages --> <rewrite> <product_featured>STORENAME_Catalog_Block_Product_Featured</product_featured> </rewrite> <rewrite> <category_view>STORENAME_Catalog_Block_Category_View</category_view> </rewrite> <!-- block for the homepage feature and goes along with the rest of these changes --> <rewrite> <product_homepage>STORENAME_Catalog_Block_Product_Homepage</product_homepage> </rewrite> </catalog> </blocks> </global>
I Change out STORENAME and put Mage (which is the name of the first folder in app/code/local. If the name of that folder was “mycoolstore” then I would but mycoolstore everywhere I see STORENAME
so for my example the code becomes
<global> .... bunch of stuff... <blocks> <catalog> <!-- block from the other tutorial for featured products on catalog pages --> <rewrite> <product_featured>Mage_Catalog_Block_Product_Featured</product_featured> </rewrite> <rewrite> <category_view>Mage_Catalog_Block_Category_View</category_view> </rewrite> <!-- block for the homepage feature and goes along with the rest of these changes --> <rewrite> <product_homepage>Mage_Catalog_Block_Product_Homepage</product_homepage> </rewrite> </catalog> </blocks> </global>
Remember In app/code/local/STORENAME/Catalog/Block/Product/Homepage.php you need to change STORENAME to what ever your STORENAME is… and since I kept STORENAME as Mage the code that goes in Homepage.php for the class is taking STORENAME
class STORENAME_Catalog_Block_Product_Homepage extends Mage_Catalog_Block_Product_Abstract
and changing it to Mage
class Mage_Catalog_Block_Product_Homepage extends Mage_Catalog_Block_Product_Abstract
Earlier in this thread it is discussed numerous times that you need to change “5” in both the template and the .php file as well.
@breatfed - If you add short description to your add Attribute to Select array and then do an echo I think it will work. However, I’m uncertain of what the system name is for short description.