Could you display the short_description on your home page? I can not do this on my project....
I had in New.php :
->addAttributeToSelect(array(’name’, ‘price’, ‘small_image’, ‘short_description’), ‘inner’)
and I keep in new.phtml:
<?php echo $this->helper('review/product')->getSummaryHtml($_product, 'short') ?>
[EDIT] Sorry, I just found the answer: replace in new.phtml
<?php echo $this->helper('review/product')->getSummaryHtml($_product, 'short') ?>
by
<?php echo $_product->getShortDescription() ?>
Is there a way to get the standard list and grid view for viewing the products in home page.. with pagination and switching grid/list view. so far i’ve been able to get the product list view yet, i cannot get the toolbar
I am having trouble showing a short description via the homepage.phtml file supplied by dan. Currently, the relevant portion of the file looks like this:
// show a link to the product <p><a class="product-name" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>)"><?php echo $_product->getName() ?></a></p> // (supposedly) show a short description of the product -- this is the line I'm interested in getting to work <?php echo $this->helper('review/product')->getSummaryHtml($_product, 'short') ?> // show the price <?php echo $this->helper('catalog/product')->getPriceHtml($_product) ?>
You were referring to a change in the new.phtml file in the template\category\product directory, but I tried it in the homepage.phtml file without luck.
Does anyone know how to get a short description to show on the homepage under featured products?
I am having trouble showing a short description via the homepage.phtml file supplied by dan. Currently, the relevant portion of the file looks like this:
// show a link to the product <p><a class="product-name" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>)"><?php echo $_product->getName() ?></a></p> // (supposedly) show a short description of the product -- this is the line I'm interested in getting to work <?php echo $this->helper('review/product')->getSummaryHtml($_product, 'short') ?> // show the price <?php echo $this->helper('catalog/product')->getPriceHtml($_product) ?>
You were referring to a change in the new.phtml file in the template\category\product directory, but I tried it in the homepage.phtml file without luck.
Does anyone know how to get a short description to show on the homepage under featured products?
I have another question. I tried to show my special price products on my home page. I used the same code than for new product, I just modified new_from_date by special_from_date etc… but it selects every product....
class Mage_Catalog_Block_Product_Specials extends Mage_Catalog_Block_Product_Abstract { public function __construct() { parent::__construct();
To get products that are only in category 7 add this to you Homepage.php file line 40
->addAttributeToFilter('category_ids', 7)
Although, I don’t think it works for products that are in more than 1 category, as the category IDs are shown as comma separated, like this 7,8,9 and I don’t know how to test for values within the commas.
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.
First, thank you for this wonderful trick. Although, I think we should never put any new code into Mage’s core files. Make good usage of local.xml config file instead.
Move Homepage.php in code/local/[StoreName]/Catalog/Block/Product/Homepage.php
Then edit etc/local.xml and add this in the main <global> tag :