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

Magento

eCommerce Software for Online Growth

Magento Forum

   
ways to show products at the home page
 
nikefido
Guru
 
Avatar
Total Posts:  421
Joined:  2008-07-11
New Haven, CT
 

did you check your homepage.phtml on line 51 like the error says?

Looks to me on first glance like you used a variable without the ‘$’ - php tries to interpret them as constants without the dollar sign.

 Signature 

@ My Magento Blog

- Handy tutorials on programming and designing Magento. A continual work in progress!
- Now with a new design, new hosting and a new domain! Check it out!

 
Magento Community Magento Community
Magento Community
Magento Community
 
deeru
Jr. Member
 
Total Posts:  8
Joined:  2007-12-06
 

I’ve only copied Homepage.php and hompage.phtml ...
I don’t know what is the problem

 
Magento Community Magento Community
Magento Community
Magento Community
 
finch8243
Member
 
Total Posts:  51
Joined:  2007-08-31
 

As an FYI, on the new version of Magento 1.1.1, the new.phtml / new.php (and in this forum, the homepage.phtml / homepage.php) pages don’t load up product quantities.  isSaleable() always returns NO.  Ideas on how to fix this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
dlange
Jr. Member
 
Total Posts:  5
Joined:  2008-07-17
 

Is there really nobody who knows how to enable a pagination toolbar for the homepage? I used exactly the same code as posted in the first posts but I need a pagination toolbar because we have too many products we would like to show on the frontpage.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Hercilio Costa
Member
 
Total Posts:  44
Joined:  2008-07-15
 

I’m having really dificult to understand the block type tags. Is there any wiki or tutorial talking about that subject?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jacky2008
Member
 
Total Posts:  39
Joined:  2008-04-15
 

I give my successful code as below:  (can show X products/row * Y row)

1. find app\code\core\Mage\Catalog\Block\Product\New.php
change ‘setPageSize(20)’ such as 20, that is the total products you would show at homepage
2. find app\design\frontend\default\yourtemplate\template\catalog\product\new.phtml
change all the data as my show

<?php if (($_products $this->getProductCollection()) && $_products->getSize()): ?>
<div class="box recently">
<
h3><?php echo $this->__('New Products'?></h3>
<
table cellspacing="0" class="recently-list" id="recently-compared-list-table">
<
tr>
<?php $i=0; foreach ($_products->getItems() as $_product): ?>
    <?php 
if ($i%4==0): ?> <!--these three lines control add '<tr>' per row-->
    <
tr>
    
<?php endif ?>

    
<td>
        <
div>
            <
a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
                <
img class="product-image" src="<?php echo $_product->getSmallImageUrl() ?>" width="130" height="130" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />
            </
a>
        </
div>
            <
p><class="product-name" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>)"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
            
<?php echo $this->getReviewsSummaryHtml($_product'short'?>
            <?php 
echo $this->getPriceHtml($_product?>
            <?php 
if($_product->isSaleable()): ?>
            
<button class="form-button" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><?php echo $this->__('Add to Cart'?></span></button>
            
<?php else: ?>
            
<div class="out-of-stock"><?php echo $this->__('Out of stock'?></div>
            
<?php endif; ?>
            
<div class="clear"></div>
            <
class="add-to">
                
<?php if ($this->helper('wishlist')->isAllow()) : ?>
                
<a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="link-cart"><?php echo $this->__('Add to Wishlist'?></a>
                
<?php endif; ?>
                <?php 
if($_compareUrl=$this->getAddToCompareUrl($_product)): ?><br />
                <
a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare'?></a>
                
<?php endif; ?>
            
</p>
        </
td>
        
    
<?php if ($i%4==3): ?>   <!--these three lines control add '</tr>' per row-->
    </
tr>
    
<?php endif ?>

<?php $i
++; endforeach; ?>
</table></div>
<?php endif; ?>

3.  add such as {{block type="catalog/product_new" template="catalog/product/new.phtml"}}
That’s all.

Besides, need help
1.  It show ‘Out of store’ alway at homepage.
2. how to add ‘resize’ to reduce the picture weight

Anybody know how to do?
Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
mikej165
Member
 
Total Posts:  62
Joined:  2008-07-31
 

I’m unable to get this to work. I added the following code to my CMS home page:

<h1> Featured Products</h1>
{{block type=”category/product_list” category_id=”24” template=”catalog/product/list.phtml”}}

The text ‘Featured Products’ shows up, but the actual products don’t. I’m using the modern theme.

Can any suggest why this is so?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Paulus
Jr. Member
 
Total Posts:  20
Joined:  2008-07-21
 

Cooler, thanks for the code, it seems to work just fine.

however, this is only for new items. Any idea how to get this to display for X random products?

Also, i get this: “Out of stock” on one of my items even though it is in stock and also tells you it is when you actually click on it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hyteckit
Sr. Member
 
Avatar
Total Posts:  145
Joined:  2008-04-01
Los Angeles, CA
 

I’m displaying products from one selected category on my home page.  It works, but doesn’t look so nice.  Need to tweak the look.  I think I’ll create a category call “Featured Products” and then select that category to be display on the homepage.

Check it out here:

GeekGears.com

 Signature 

Current Project:
GeekGears.com - Accessories for your iPod, iPhone, MP3 Players, Cell Phone, PDA, GPS Devices, Digital Camera, and more.
Extension: Product Gallery Importer, Enhanced Search

 
Magento Community Magento Community
Magento Community
Magento Community
 
mikej165
Member
 
Total Posts:  62
Joined:  2008-07-31
 

Hyteckit: Loved your site. I see you’re using the Modern theme, as am I. I’m attempting to to show a specific category on the home page and I’m having no luck. Perhaps you or someone can point me in the right direction. I’ve followed the instructions to the letter and and still I don’t see anything on the home page. I inserted the following code in the CMS:

<h1> Featured Products</h1>

{{block type=”category/product_list” category_id=”15” template=”catalog/product/list.phtml”}}

“Featured Products” shows up, but nothing else. The category is valid. The items are in-stock and show up when I view the category directly. It simply will not display them on the home page, whether I use Modern or Default themes.

Can anyone suggest a solution? The learning curve with Magento is very steep, but I feel it is the best eCommerce solution I’ve yet used - it blows OSCommerce away.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hyteckit
Sr. Member
 
Avatar
Total Posts:  145
Joined:  2008-04-01
Los Angeles, CA
 

mikej165,

Hmm… don’t know.  That’s pretty much all I did to get it to show up.  Category id 61 being my feature products category.

{{block type="catalog/product_list" category_id="61" template="catalog/product/list.phtml"}}

 Signature 

Current Project:
GeekGears.com - Accessories for your iPod, iPhone, MP3 Players, Cell Phone, PDA, GPS Devices, Digital Camera, and more.
Extension: Product Gallery Importer, Enhanced Search

 
Magento Community Magento Community
Magento Community
Magento Community
 
mikej165
Member
 
Total Posts:  62
Joined:  2008-07-31
 

Aha! When it doubt, it’s probably a typo.

I was using this:
{{block type=”category/product_list” category_id=”15” template=”catalog/product/list.phtml”}}

After re-reading your post, I changed it to this:
{{block type="catalog/product_list" category_id="15" template="catalog/product/list.phtml"}}

All is well and good in the universe now. Thank you very much!

 
Magento Community Magento Community
Magento Community
Magento Community
 
dave132
Jr. Member
 
Total Posts:  9
Joined:  2008-02-18
 

I’ve added this:

{{block type="catalog/product_list" category_id="3" template="catalog/product/list.phtml"}}

Is there a way to override the default list view from grid to list? On the home page I’d like the list view and on all others I’d like the grid view.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kimura
Member
 
Avatar
Total Posts:  47
Joined:  2008-04-21
Hungary
 

Hello

I’ve got more landing pages, where I want to display products by attributes this way:

{{block type=”category/product_list” category_id=”15” template=”catalog/product/list.phtml”}}

but not with category id, with attribute id. I’ve tried a lot of solutions, but there is no good one.

Another sulution is display the searc result:

I don’t want to show the other searching result options.

Any idea?

Thanks

Image Attachments
magg.jpg
 Signature 

sokkal szerényebben

 
Magento Community Magento Community
Magento Community
Magento Community
 
jaihk
Jr. Member
 
Total Posts:  9
Joined:  2008-04-12
 
finch8243 - 25 July 2008 06:29 PM

As an FYI, on the new version of Magento 1.1.1, the new.phtml / new.php (and in this forum, the homepage.phtml / homepage.php) pages don’t load up product quantities.  isSaleable() always returns NO.  Ideas on how to fix this?

Hi, it’s maybe a bug. The solution is to replace the line:

if($_product->isSaleable()):

by

if(Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->_getData('is_in_stock')):

Good luck smile

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
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
50143 users|547 users currently online|102284 forum posts