Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 18
ways to show products at the home page
 
Andrea, Argentina
Sr. Member
 
Total Posts:  164
Joined:  2007-12-05
Buenos Aires, Argentina
 

Can anyone post different codes (block type........) to show products at the home?

The ones I found posted in this forum seem not to work anymore with the last version (8.1.7)
I can’t show in the middle the grid of products (one cateogry, random, by date, or something that could work).

Thank you
Andrea

 
Magento Community Magento Community
Magento Community
Magento Community
 
Andrea, Argentina
Sr. Member
 
Total Posts:  164
Joined:  2007-12-05
Buenos Aires, Argentina
 

SOLVED:

Adding
{{block type="catalog/product_new" template="catalog/product/new.phtml"}}

to my cms home page I can see the new products.

Hope this helps
Andrea

 
Magento Community Magento Community
Magento Community
Magento Community
 
nafnaf1000
Sr. Member
 
Total Posts:  209
Joined:  2008-02-21
 

How can i add items using a Custom Attribute???

I don’t understand how to use “block type” (nor what it is. )

 
Magento Community Magento Community
Magento Community
Magento Community
 
PaulAlford
Member
 
Total Posts:  64
Joined:  2007-12-04
Summerville, SC
 

How can I edit this default code to show one of my products on the HOME page ??  This code is for a default item.

<div class="box best-selling">
<h3>Best Selling Products</h3>
<table border="0" cellspacing="0">
<tbody>
<tr class="odd">
<td><a href="{{store url=""}}nine-west-women-s-lucero-pump.html"><img class="product-img" src="{{skin url=’images/media/best_selling_img02.jpg’}}” border="0" width="95" /></a>
<div class="product-description">
<p><a href="{{store url=""}}nine-west-women-s-lucero-pump.html">Nine West Women’s Lucero Pump</a></p>
<p>
See all <a href="{{store url=""}}apparel/shoes">Shoes</a>

--------------------
I just found this thread (below text copied from that thread) and I think this might be close to what I want....  But how do I get all of that url info automatically ?  I want the items on the home page (Best Selling Products) to come up on their own without me having to manually code them in each time

How to make links
I managed to catch this info from a screenshot on a screencast
Granted, you can still use an absolute address, but relative ones are real nice.

<a href={{store url="catalog/product/views/sony-ericsson-w810i/id/18/category/8/"}}"> </a>

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

Hello Paul,
There are a couple of different ways of going about this. Are you looking for “Best Sellers” automatically selected from actual sales, or do you want to be able to click a product in backend as “Best Seller” and have it appear, ie owner-defined best-seller not based on hard coding html but rather a yes/no switch on the product edit page?

Dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

@nafnaf1000: What is the name of the custom attribute? Let me know and I will put something together that should work.

Dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
nafnaf1000
Sr. Member
 
Total Posts:  209
Joined:  2008-02-21
 

home_page_featured

Thanks for your help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
PaulAlford
Member
 
Total Posts:  64
Joined:  2007-12-04
Summerville, SC
 

Hey, thanks Dan.  I hope you can tell me how to do this.  I guess me picking a few items on the backend and selecting “Best Selling Product” so it would appear on the home page would be best.  I dont anticipate ANY sales for a while so it wouldnt be best to be selected from ACTUAL sales.

So how can I tell a product to be Best Selling and go show to the home page ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

Hi Paul,
I got pulled away unexpectedly from work tonight before I could post a solution. I will post first thing tomorrow. FYI, we have tested and this solution works with minimal alterations.

Dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

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:

{{block type="catalog/product_homepage" name="home.catalog.product.homepage" alias="product_homepage" template="catalog/product/homepage.phtml"}}

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/

File Attachments
Homepage.php  (File Size: 2KB - Downloads: 7710)
homepage.phtml  (File Size: 2KB - Downloads: 7154)
 
Magento Community Magento Community
Magento Community
Magento Community
 
nafnaf1000
Sr. Member
 
Total Posts:  209
Joined:  2008-02-21
 

Thank you so much, you are the best, i could not work it out for the life of me.

Now that i understand and have an example how it works I set to go. I am almost done with me design smile

(a lot of CSS in this site. I hop the new design will load the site faster as right now it is too slow.}

Thank you for all your help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
PaulAlford
Member
 
Total Posts:  64
Joined:  2007-12-04
Summerville, SC
 

Thanks for this help Dan.  I got some of this accomplished, but still not there yet. 

I added the 2 files to the folders you listed. 

I added the {{block type="catalog/product_homepage" name="home.catalog.product.homepage" alias="product_homepage" template="catalog/product/homepage.phtml"}} to the homepage CMS.

I added a new attribute, called it “home_page_featured”. 

I went to the products and edited one, hoping to see the new YES/NO checkbox for “featured on home page” but I dont even see a tab for attributes for products, so where is this checkbox supposed to be found ?  Now what ?

Thanks again

Paul

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

Paul,
Here’s a couple of things to look out for: make sure that the attribute is of the yes/no type and make sure that you add the new attribute to the default attribute set. Since the attribute isn’t showing up on the product edit page, it sounds like the attribute hasn’t been added to the default attribute set. If you haven’t, go to Catalog-> Attributes -> Manage Attribute Sets and click the default set. From here you can drag and drop the new attribute into the default product edit setup. This should get you closer to where you need to be. Any questions, just let me know.

 
Magento Community Magento Community
Magento Community
Magento Community
 
PaulAlford
Member
 
Total Posts:  64
Joined:  2007-12-04
Summerville, SC
 

Right after I posted the last, I found what you just said and I am now seeing it show up under the product, and I chose yes, but its not showing up (nothing is) where it is suppose to on the home page.  I am thinking I have that CMS code wrong - before and/or after the code you said to use.

Here is my home page code… maybe you can see where it is wrong....

<h3>Store Under Construction - Please Call Us Toll Free 877-875-9101</h3>

<div class="col-left side-col">
<p class="home-callout">
<a href="{{store url="vehicle-wraps"}}"><img src="{{skin url=’images/ph_callout_left_top2.gif’}}” border="0" /></a>
</p>
<p class="home-callout">
<a href="{{store url="banners"}}"><img src="{{skin url=’images/ph_callout_left_SpecialSale.jpg’}}” border="0" />
</p>
{{block type="tag/popular" template="tag/popular.phtml"}}
</div>
<div class="home-spot">
<p class="home-callout">
<img src="{{skin url=’images/home_main_callout2.jpg’}}” border="0" width="470" />
</p>
<p class="home-callout">
<img src="{{skin url=’images/shipping_callout.jpg’}}” border="0" width="470" />
</p>
<div class="box best-selling">
<h3>Featured Items</h3>
<table border="0" cellspacing="0">
<tbody>
<tr class="odd">
<td>{{block type="catalog/product_homepage" name="home.catalog.product.homepage" alias="product_homepage" template="catalog/product/homepage.phtml"}}
</td>
</tr>
</tbody>
</table>
</div>
</div>

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

I copied and pasted your cms code into our current test site and it seemed to work fine. Just to check, is the template file placed in the proper directory, ie are you using the default template layout? Or, are you using a custom theme?

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

Also, make sure that the attribute identifier is set to home_page_featured. The Label can be anything that you want. Just to check, what is the Scope for the attribute set to?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 18