Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
Page 2 of 12
ways to show products at the home page
 
PaulAlford
Member
 
Total Posts:  64
Joined:  2007-12-04
Summerville, SC
 

Thanks Dan.

The 2 files you sent are in the folders you said, but I am using the default template/theme.
The identifier is set to “home_page_featured”
The scope is set to “store view”

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

Success !!!  I got it Dan.  I think it was because I assigned the attribute to a new set instead of clicking default and going in there.  Its working now. 

Now.... the items showing showing up in 1 column, how do I tell it to go to 2 columns down there ?

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

Paul,
Glad to hear you’re starting to get things sorted. The reason that it’s showing in one column, is because you embedded the block in a column of the sample table that comes with magento. That table was hard-coded for design reasons in some of the earlier reasons to show the look that “could” be achieved. You’ll probably want to remove the block from the table and alter the css that controls the homepage.phtml to achieve a “best-sellers table” look.

Dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
drunknbass1
Jr. Member
 
Total Posts:  1
Joined:  2008-03-28
 

when i add the block code to my page i it goes blank?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jwebber
Member
 
Avatar
Total Posts:  34
Joined:  2008-03-12
 

Thanks for this code Dan!

I have implemented it here and added quite a few styling elements: http://www.telescopeoutdoor.com/ ( I called it Popular Products)

 Signature 

-John Webber
My company: Ad Stream, Inc.
MagThemes.com - Free & Paid Magento Themes & Plugins

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

Great job John.  Anyway, you would copy and past the home CMS code here so I can see how you got the itmes into 2 columns down there ?

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

John,
I like the design! Very clean. I thought I’d give you a heads up. In your footer, the href for Customer Service isn’t closed and is throwing off the markup for the remaining links.

Dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
jwebber
Member
 
Avatar
Total Posts:  34
Joined:  2008-03-12
 

Thanks for the comments!

@dan: Thanks for the heads up

@PaulAlford: I am only testing Magento right now, waiting for 1.0 before I start rolling out big changes. I have posted my code and CSS here but please take it with a grain of salt, I put this together very quickly today. I have a limited knowledge of object oriented PHP so my code tweaks are pretty simplistic and probably not the best way to do it :)

I just have this in my Home Page CMS:

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

Here is the code in homepage.phtml:

<?php if (($_products $this->getProductCollection()) && $_products->getSize()): ?>
<div class="home-page-cntr">
<
h3>Popular Products</h3>
<?php $i=0; foreach ($_products->getItems() as $_product): ?>
    <?php 
if ($i>6): continue; endif; ?>

    
<div class="home-page-item<?php if ($i==2 || $i==5): echo "1"; endif; ?>"[i][b]Right here I just check to see if this is the last item in the column, if it is I echo a 1 to load a slightly modified style that doesn't have the right border[/b][/i]
        <div class="home-page-img">
            <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
                 <img src="<?php echo $this->helper('
catalog/image')->init($_product, 'small_image')->resize(110,110); ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>"/>
            <?php echo $_product->getName() ?></a>
        </div>
        <div class="home-page-txt">
            <?php echo $this->helper('
catalog/product)->getPriceHtml($_product?>           
</div>
</
div>
<?php $i++; endforeach; ?>
<?php 
for($i;$i%6!=0;$i++): ?>
    <?php 
endfor ?>
</div>
<?php endif; ?>

And here are my CSS styles:

/* Controls featured items on home page */
.home-page-cntr{
    width
445px;
    
floatright;
    
margin0 0 0 15px;
    
border1px solid #ccc;
    
}
.home-page-cntr a{
    text
-decorationnone;
    
font-weightnormal;
    
}
.home-page-cntr a:hover {
    color
#000000;}
.home-page-cntr h3 {
    padding
2px 5px;
    
background-color#eee;
    
border-bottom1px solid #ccc;}
.home-page-item, .home-page-item1{
    float
left;
    
width120px;
    
height170px;
    
padding8px;
    
border-right1px solid #ccc;
    
margin5px 5px 10px 5px;
    
line-height16px;
    
}
.home-page-item1{
    border
-rightnone;
    
}
.home-page-img{
    }
.home-page-txt{
    font
-size11px;
    
font-weightbold;
    
}

 Signature 

-John Webber
My company: Ad Stream, Inc.
MagThemes.com - Free & Paid Magento Themes & Plugins

 
Magento Community Magento Community
Magento Community
Magento Community
 
jwebber
Member
 
Avatar
Total Posts:  34
Joined:  2008-03-12
 

Dan, I would like to just get the Final price for an item, instead of showing the strikethrough and Special text. What is the best way to get the final price of an item, whether it is on special or not, and just echo it out as a dollar amount?

I tried this in homepage.phtml but I dont think it pulls the correct Special price:

<?php echo "$".round($_product->getPrice(), 2) ?>

thanks!

 Signature 

-John Webber
My company: Ad Stream, Inc.
MagThemes.com - Free & Paid Magento Themes & Plugins

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

Alright John… I really like the look and layout of your template/theme.  Please tell me you would willing to share the whole theme.  I want my home page to have this layout.  I love it.  I am still on the default theme and dont know what file to chnage or what to do to swap themes, so maybe you or someone could help me with those instructions too.

Thanks in advance

Paul

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

John,
I haven’t tested this. I am away from my work computer. In the homepage.phtml, the price is called from the price.html file. If you take a look at that template, this is what called the Special Price:
<?php echo Mage::helper('core')->currency($_finalPrice) ?>

Try replacing <?php echo $this->helper('catalog/product')->getPriceHtml($_product) ?> with above. Like I said though, not sure if it will work.

Dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
Zer0
Member
 
Total Posts:  52
Joined:  2008-03-22
Prague / Czech Republic
 

Hello,

I tried this code

{{block type="catalog/product_new" template="catalog/product/new.phtml"}}
but it does not working for configurable products.

Have someone solved this issue before, please?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jwebber
Member
 
Avatar
Total Posts:  34
Joined:  2008-03-12
 

@Paul: My theme is still very unfinished. I am however building a new site where I will be giving away themes that I build for Magento. The site will be http://www.magthemes.com. I am still waiting to get 1.0 installed and working before I launch any themes though.

@dan: thanks for the tip, i will give this a try today.

-john

 Signature 

-John Webber
My company: Ad Stream, Inc.
MagThemes.com - Free & Paid Magento Themes & Plugins

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

Thats awesome John.... I know nothing is official and finished until 1.0… I was just wanting to play with the theme.  I like how you have the outdoor furniture theme - colors, menu, where things are, etc..  nice & professional.

I will definitely check out your themes website - after we pass 1.0.

Paul

 
Magento Community Magento Community
Magento Community
Magento Community
 
lusas
Jr. Member
 
Total Posts:  5
Joined:  2008-04-03
 
dan_w - 27 March 2008 06:53 AM

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/

Thanks for the script! It works perfectly.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 2 of 12
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
52316 users|446 users currently online|105636 forum posts