Question

========= UPDATE =========

I accepted simonthesorcerer response, but it didn't work for me.

I found a free module you can get on this url: http://www.magentocommerce.com/magento-connect/thirty4+interactive/extension/841/catalog-sale-items

it works fine on CE 1.7.0.2 if you install it manually from here: http://freegento.com/magento-extensions/Thirty4_CatalogSale-0.6.3_ready2paste.tgz

Download, unzip and move the files in the folders into your magento installation.

Hope this gonna be useful to somebody!!

========= END OF UPDATE =========

I'm trying to make a special price page... After trying and retrying and after several fails, I came up with this:

I've created a file called: special.php into this path: app/code/local/Mage/Catalog/Block/Product/ with this code:

<?php
class Mage_Catalog_Block_Product_Special extends Mage_Catalog_Block_Product_List {
   function get_prod_count() {

      Mage::getSingleton('catalog/session')->unsLimitPage();
      return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 300;
   }

   function get_cur_page() {
      return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
   }

   protected function _getProductCollection() {
        $todayDate  = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
        $tomorrow = mktime(0, 0, 0, date('m'), date('d')+1, date('y'));
        $dateTomorrow = date('m/d/y', $tomorrow);

        $collection = Mage::getResourceModel('catalog/product_collection');
        $collection->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());

        $collection = $this->_addProductAttributesAndPrices($collection)
        ->addStoreFilter()
        ->addAttributeToSort('entity_id', 'desc')
        ->addAttributeToFilter('special_from_date', array('date' => true, 'to' => $todayDate)) 
        ->addAttributeToFilter('special_to_date', array('or'=> array(0 => array('date' => true, 'from' => $dateTomorrow), 1 => array('is' => new Zend_Db_Expr('null')))), 'left')
        ->setPageSize($this->get_prod_count())
        ->setCurPage($this->get_cur_page());

        $this->setProductCollection($collection);
        return $collection;
   }
}
?>

after that

I've created a file called: special.phtml into this path: app/design/frontend/default/MY THEME NAME/template/catalog/product/ with this code:

<?php 
    $columnsCount = 3;
    if (($_products = $this->getProductCollection()) && $_products->getSize()): 
?>

<div class="category-products">
<ol class="products-grid"  style="list-style: none;">
    <?php $i = 0; foreach ($_products->getItems() as $_product): ?>
    <?php // if($i++%$columnsCount == 0) : ?><?php // endif; ?>
     <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
            <?php // Product Image ?>
            <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
                <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(300, 200); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
            </a>

            <div class="product-shop">
                <div class="f-fix">
                    <?php // Product Title ?>
                    <h2 class="the-product-manufacturer-grid"><a href=""><?php echo $_product->getAttributeText('manufacturer') ?></a><span class="the-product-name-grid"> / <a class="product-name" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>)"><?php echo $this->htmlEscape($_product->getName()) ?></a></span></h2>

                    <?php // Product Price ?>
                    <div class="listpricebox"><?php echo $this->getPriceHtml($_product, true, $this->getPriceSuffix()) ?></div>
                </div>
            </div>
    </li>
    <?php // if($i%$columnsCount == 0 || $i == count($_products)): ?><?php // endif; ?>
    <?php endforeach; ?>
</ol>
</div>

<script type="text/javascript">decorateGeneric($$('.grid-row'), ['first', 'last', 'odd', 'even']);</script>
<?php endif; ?>

and finally I'm calling all this stuff into a CMS page

{{block type="catalog/product_special" template="catalog/product/special.phtml"}}

now, everything is working fine except the fact that this page only shows products with a special price set one-by-one by editing the product. But the biggest part of my products are made in sale via Catalog Price Rules Do somebody have an idea can I show both Catalog Price Rules products and "Special Price" Products?

====== UPDATE ======

Here's the code

<?php
class Mage_Catalog_Block_Product_Special extends Mage_Catalog_Block_Product_List {

   protected function _getProductCollection() {
        // we need the date to filter for the special price
    $dateToday = date('m/d/y'); 
    $tomorrow = mktime(0, 0, 0, date('m'), date('d')+1, date('y'));
    $dateTomorrow = date('m/d/y', $tomorrow);

// this gets the product collection and filters for special price;
// grabs products with special_from_date at least today, and special_to_date at least tomorrow
        $_productCollection = Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToFilter('special_from_date', array('date' => true, 'to' => $dateToday))
            ->addAttributeToFilter('special_to_date', array('date' => true, 'from' => $dateTomorrow))
            ->load();

// this loads the standard magento catalog proce rule model
        $rules = Mage::getResourceModel('catalogrule/rule_collection')->load();

// read: if there are active rules
        if($rules->getData()) {
            $rule_ids = array(); // i used this down below to style the products according to which rule affected
            $productIds[] = array(); // this will hold the ids of the products

            foreach($rules as $rule) {
                $rule_ids[] = $rule->getId();
                $productIds = $rule->getMatchingProductIds(); // affected products come in here
            }

// merge the collections: $arr is an array and keeps all product IDs we fetched before with the special-price-stuff
            $arr = $_productCollection->getAllIds();
            if($productIds) {
                // if there are products affected by catalog price rules, $arr now also keeps their IDs
                $arr = array_merge($arr,$productIds);
            }

// we initialize a new collection and filter solely by the product IDs we got before, read: select all products with their entity_id in $arr
            $_productCollection = Mage::getModel('catalog/product')->getCollection()
                ->addAttributeToFilter('entity_id',array('in'=>$arr))
                ->load();
        }
   }
}
Was it helpful?

Solution

it took me a while to figure this out. Should work for you, if you customy it for your needs.

To list products affected by a price rule, you must make your way over the rule-model.

Here is the code:

<?php
// we need the date to filter for the special price
    $dateToday = date('m/d/y'); 
    $tomorrow = mktime(0, 0, 0, date('m'), date('d')+1, date('y'));
    $dateTomorrow = date('m/d/y', $tomorrow);

// this gets the product collection and filters for special price;
// grabs products with special_from_date at least today, and special_to_date at least tomorrow
        $_productCollection = Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToFilter('special_from_date', array('date' => true, 'to' => $dateToday))
            ->addAttributeToFilter('special_to_date', array('date' => true, 'from' => $dateTomorrow))
            ->load();

// this loads the standard magento catalog proce rule model
        $rules = Mage::getResourceModel('catalogrule/rule_collection')->load();

// read: if there are active rules
        if($rules->getData()) {
            $rule_ids = array(); // i used this down below to style the products according to which rule affected
            $productIds[] = array(); // this will hold the ids of the products

            foreach($rules as $rule) {
                $rule_ids[] = $rule->getId();
                $productIds = $rule->getMatchingProductIds(); // affected products come in here
            }

// merge the collections: $arr is an array and keeps all product IDs we fetched before with the special-price-stuff
            $arr = $_productCollection->getAllIds();
            if($productIds) {
                // if there are products affected by catalog price rules, $arr now also keeps their IDs
                $arr = array_merge($arr,$productIds);
            }

// we initialize a new collection and filter solely by the product IDs we got before, read: select all products with their entity_id in $arr
            $_productCollection = Mage::getModel('catalog/product')->getCollection()
                ->addAttributeToFilter('entity_id',array('in'=>$arr))
                ->load();
        }

== UPDATE ==

I added some comments to the code and renamed $skus to $productIds (which fits better).

If you are still getting errors, please let me know what's exactly happening. This code is tested for Magento v1.7.0.2.

Cheers
Simon

OTHER TIPS

Here is the code that works for me.

  1. First create template file for example sales-special.phtml in your app/design/frontend/jewelry/default/template/catalog/product folder

content of sales-special.phtml is

  $_productCollection = Mage::getModel('catalog/product')->getCollection();
$_productCollection->addAttributeToSelect(array(
   'image',
   'name',
   'short_description'
))
->addFieldToFilter('visibility', array(
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
)) 
->addFinalPrice()
//                        ->addAttributeToSort('price', 'asc') 
->getSelect()
->where('price_index.final_price < price_index.price');
Mage::getModel('review/review')->appendSummary($_productCollection);

$_helper = $this->helper('catalog/output');
$_collectionSize = $_productCollection->count();

if(!$_collectionSize): ?>
<div class="category-products"><p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p></div>
<?php else: ?>
<div class="category-products">
<div class="toolbar-top"><?php echo $this->getToolbarHtml() ?></div>
<?php // List mode ?>
<?php if($this->getMode()!='grid'): ?>
<?php 
$_iterator = 0;
// List Mode            
$_wImgList = 190;
$_hImgList = 190;
if(Mage::helper('themeframework/settings')->getProductsList_ImageRatio()!=0){
$_ratioImgList = Mage::helper('themeframework/settings')->getProductsList_ImageRatio();
if($_ratioImgList!='-1'){
$_hImgList = $_wImgList/$_ratioImgList;    
}else{
$_hImgList = ($_wImgList * Mage::helper('themeframework/settings')->getProductsList_CustomHeight())/Mage::helper('themeframework/settings')->getProductsList_CustomWidth();
}                        
} 

$altImgList = Mage::helper('themeframework/settings')->getProductsList_AltImg();
$gutterList = Mage::helper('themeframework/settings')->getProductsList_Gutter(); 
?>
<ol class="products-list" id="products-list">
<?php foreach ($_productCollection as $_product): ?>
<li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>" <?php if($gutterList): ?>style="margin-bottom: <?php echo $gutterList; ?>px"<?php endif; ?>>

<?php if (Mage::helper('themeframework/settings')->getProductsList_ShowThumbnail()): ?>

<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
<?php if (Mage::helper('themeframework/settings')->getProductsList_ShowLabel()):?>
<!--show label product - label extension is required-->
<?php Mage::helper('productlabels')->display($_product);?>
<?php endif ?>
<?php if($altImgList):?>
<img class="em-img-lazy img-responsive em-alt-hover" src="<?php echo $this->getSkinUrl('images/loading.gif') ?>" data-original="<?php echo $this->helper('catalog/image')->init($_product, $altImgList)->resize($_wImgList, $_hImgList); ?>" width="<?php echo $_wImgList ?>" height="<?php echo $_hImgList ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, $altImgList), null, true) ?>" />
<?php endif;?>
<img id="product-collection-image-<?php echo $_product->getId(); ?>" class="em-img-lazy img-responsive <?php if ($altImgList): ?>em-alt-org<?php endif ?>" src="<?php echo $this->getSkinUrl('images/loading.gif') ?>" data-original="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_wImgList, $_hImgList); ?>" width="<?php echo $_wImgList ?>" height="<?php echo $_hImgList ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
</a>
<?php else:?>
<?php if (Mage::helper('themeframework/settings')->getProductsList_ShowLabel()):?>
<!--show label product - label extension is required-->
<?php Mage::helper('productlabels')->display($_product);?></a>
<?php endif ?>            
<?php endif 
// Product description ?>
<div class="product-shop">
<div class="f-fix">
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
<!--product name-->
<?php if (Mage::helper('themeframework/settings')->getProductsList_ShowProductName()):?>
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>">
<?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?>
</a></h2>
<?php
    if ($this->getChild('name.after')) {
        $_nameAfterChildren = $this->getChild('name.after')->getSortedChildren();
        foreach ($_nameAfterChildren as $_nameAfterChildName) {
            $_nameAfterChild = $this->getChild('name.after')->getChild($_nameAfterChildName);
            $_nameAfterChild->setProduct($_product);
            echo $_nameAfterChild->toHtml();
        }
    } endif ?>  

<!--product description-->
<?php if (Mage::helper('themeframework/settings')->getProductsList_ShowDesc()): ?>
<div class="desc std">
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
</div> 
<?php endif ?> 
<!--show reviews-->
<?php if (Mage::helper('themeframework/settings')->getProductsList_ShowReviews()):?>
<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<?php endif; ?>
<?php endif
if (Mage::helper('themeframework/settings')->getProductsList_ShowPrice()): ?>
<?php echo $this->getPriceHtml($_product, true) ?>
<?php endif ?>

<div class="actions">
<?php if($_product->isSaleable()): ?>
<?php if (Mage::helper('themeframework/settings')->getProductsList_ShowAddtocart()): ?>
<button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Add to Cart')) ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
<?php endif ?>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<?php if (Mage::helper('themeframework/settings')->getProductsList_ShowAddto()): ?> 
<ul class="add-to-links">
<?php if ($this->helper('wishlist')->isAllow()) : ?>
    <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist" title="<?php echo $this->__('Add to Wishlist') ?>"><?php echo $this->__('Add to Wishlist') ?></a></li>
<?php endif; ?>
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
    <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare" title="<?php echo $this->__('Add to Compare') ?>"><?php echo $this->__('Add to Compare') ?></a></li>
<?php endif; ?>
</ul>
<?php endif ?>
</div>
</div>
</div>
</li>
<?php endforeach; ?>
</ol>
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>

<?php else: ?>

<?php // Grid Mode ?>
<?php
// set column count    
$_pageLayout = substr((str_replace(array('page/','.phtml'),'',Mage::app()->getLayout()->getBlock('root')->getTemplate())),0,1);            

// Grid Mode            
$_wImgGrid = 280;
$_hImgGrid = 280;       
if(Mage::helper('themeframework/settings')->getProductsGrid_ImageRatio()!=0){
$_ratioImgGrid = Mage::helper('themeframework/settings')->getProductsGrid_ImageRatio();
if(Mage::helper('themeframework/settings')->getGeneral_DisableResponsive(1)!=0){
switch(Mage::helper('themeframework/settings')->checkDevice()){
case 'desktop':
switch($_pageLayout){
case 3:
    $_columnCount = Mage::helper('themeframework/settings')->getProductsGrid_Threecolumns(3);                    
    break;
case 1:
    $_columnCount = Mage::helper('themeframework/settings')->getProductsGrid_Onecolumn(5);
    break;
default:
    $_columnCount = Mage::helper('themeframework/settings')->getProductsGrid_Twocolumns(4); 
    break;
}
$_winWidth = 1200;
break;
case 'tablet':
switch($_pageLayout){
case 3:
    $_columnCount = Mage::helper('themeframework/settings')->getProductsGrid_TabletThreecolumns(3);                    
    break;
case 1:
    $_columnCount = Mage::helper('themeframework/settings')->getProductsGrid_TabletOnecolumn(5);
    break;
default:
    $_columnCount = Mage::helper('themeframework/settings')->getProductsGrid_TabletTwocolumns(4); 
    break;
}
$_winWidth = 1024;
break;
case 'mobile': 
$_columnCount = Mage::helper('themeframework/settings')->getProductsGrid_ItemsMobile(3);
$_winWidth = 320;
break;
}
}else{
switch($_pageLayout){
case 3:
$_columnCount = Mage::helper('themeframework/settings')->getProductsGrid_Threecolumns(3);                    
break;
case 1:
$_columnCount = Mage::helper('themeframework/settings')->getProductsGrid_Onecolumn(5);
break;
default:
$_columnCount = Mage::helper('themeframework/settings')->getProductsGrid_Twocolumns(4); 
break;
}
$_winWidth = 1200;                
} 
switch($_pageLayout){
case 3:
$_columnsContent = 12;                    
break;
case 1:
$_columnsContent = 24;
break;
default:
$_columnsContent = 18; 
break;
}
$_wImgGrid = (($_columnsContent/24) * $_winWidth)/$_columnCount - 20;
if($_ratioImgGrid==-1){
$_hImgGrid = ($_wImgGrid*Mage::helper('themeframework/settings')->getProductsGrid_CustomHeight())/Mage::helper('themeframework/settings')->getProductsGrid_CustomWidth();
}else{
$_hImgGrid = ($_wImgGrid/$_ratioImgGrid);
}
}   

$altImgGrid = Mage::helper('themeframework/settings')->getProductsGrid_AltImg();    

// Hover Effect
switch(Mage::helper('themeframework/settings')->getProductsGrid_ConfigHover()){
case 'enable':
$_classHoverEffect = 'emcatalog-enable-hover';
break;
case 'medium_desktop':
$_classHoverEffect = 'emcatalog-disable-hover-below-desktop';
break;
case 'tablet':
$_classHoverEffect = 'emcatalog-disable-hover-below-tablet';
break;
case 'mobile':
$_classHoverEffect = 'emcatalog-disable-hover-below-mobile';
break;
default:
$_classHoverEffect= '';
break; 
}

// Element Align Center
switch(Mage::helper('themeframework/settings')->getProductsGrid_AlignCenter()){
case 0:
$_classAlignCenter = '';
break;
default:
$_classAlignCenter= 'text-center';
break; 
}

// Product Name Single Line
switch(Mage::helper('themeframework/settings')->getProductsGrid_AutoProductName()){
case 0:
$_classNameSingleLine = '';
break;
default:
$_classNameSingleLine= 'em-productname-single-line';
break; 
}
?>
<?php if ($_collectionSize > 0): ?>
<div id="em-grid-mode">       
<ul class="emcatalog-grid-mode products-grid  <?php echo $_classHoverEffect ?>">
<?php $i=0; foreach ($_productCollection as $_product): ?>   
<li class="item<?php echo $i == 0 ?' first':''; ?><?php echo $i+1 == $_collectionSize ?' last':''; ?>">
<div class="product-item">                        
<div class="product-shop-top">
<!-- Show Thumbnail -->
<?php if (Mage::helper('themeframework/settings')->getProductsGrid_ShowThumbnail()): ?>
    <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
        <?php if (Mage::helper('themeframework/settings')->getProductsGrid_ShowLabel()):?>
            <!--show label product - label extension is required-->
            <?php Mage::helper('productlabels')->display($_product);?>
        <?php endif;?>

        <?php if($altImgGrid):?>
            <img class="em-img-lazy img-responsive em-alt-hover" src="<?php echo $this->getSkinUrl('images/loading.gif') ?>" data-original="<?php echo $this->helper('catalog/image')->init($_product, $altImgGrid)->resize($_wImgGrid, $_hImgGrid); ?>" width="<?php echo $_wImgGrid ?>" height="<?php echo $_hImgGrid ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, $altImgGrid), null, true) ?>" />
        <?php endif;?>
        <img id="product-collection-image-<?php echo $_product->getId(); ?>" class="em-img-lazy img-responsive <?php if ($altImgGrid): ?>em-alt-org<?php endif ?>" src="<?php echo $this->getSkinUrl('images/loading.gif') ?>" data-original="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_wImgGrid, $_hImgGrid); ?>" width="<?php echo $_wImgGrid ?>" height="<?php echo $_hImgGrid ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /><span class="bkg-hover"></span>                                                    
    </a>
<?php else:?>
    <?php if (Mage::helper('themeframework/settings')->getProductsGrid_ShowLabel()):?>
        <!--show label product - label extension is required-->
        <?php Mage::helper('productlabels')->display($_product);?>
    <?php endif;?>
<?php endif; ?>

<div class="bottom">
    <?php if (Mage::helper('themeframework/settings')->getProductsGrid_ShowAddtocart()): ?>
    <div class="em-btn-addto <?php echo $_classAlignCenter ?> <?php if (Mage::helper('themeframework/settings')->getProductsGrid_ShowAddtocart()==2): ?>em-element-display-hover<?php endif;?>">
        <?php if($_product->isSaleable()): ?>
            <!--show button add to cart-->                                            
            <button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Add to Cart')) ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>                                            
        <?php else: ?>
            <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
        <?php endif; ?>

        <!--show button add to compare-wishlist-->                                         
        <ul class="add-to-links">
            <?php if ($this->helper('wishlist')->isAllow()) : ?>
                <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist" title="<?php echo $this->__('Add to Wishlist') ?>"><?php echo $this->__('Add to Wishlist') ?></a></li>
            <?php endif; ?>
            <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                <li><a href="<?php echo $_compareUrl ?>" class="link-compare" title="<?php echo $this->__('Add to Compare') ?>"><?php echo $this->__('Add to Compare') ?></a></li>
            <?php endif; ?>
        </ul>
    </div>
    <?php endif;?>
    <?php if(Mage::helper('core')->isModuleEnabled('EM_Quickshop') && Mage::helper('quickshop')->getConfig('enable')): ?>
    <div class="quickshop-link-container hidden-xs">
        <a href="<?php echo Mage::helper('quickshop/links')->addQuickShopLink($_product->getProductUrl()); ?>" class="quickshop-link" title="<?php echo $this->__('Quickshop') ?>"><?php echo $this->__('Quickshop') ?></a>
    </div> 
    <?php endif;?>
</div> 
</div>

<div class="product-shop">
<div class="f-fix">
    <!--product name-->
    <?php if (Mage::helper('themeframework/settings')->getProductsGrid_ShowProductName()):?>                    
    <h2 class="product-name <?php echo $_classAlignCenter ?> <?php echo $_classNameSingleLine ?> <?php if (Mage::helper('themeframework/settings')->getProductsGrid_ShowProductName() == 2):?>em-element-display-hover<?php endif;?>"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>">
        <?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>
    </a></h2>
    <?php
            // Provides extra blocks on which to hang some features for products in the list
            // Features providing UI elements targeting this block will display directly below the product name
            if ($this->getChild('name.after')) {
                $_nameAfterChildren = $this->getChild('name.after')->getSortedChildren();
                foreach ($_nameAfterChildren as $_nameAfterChildName) {
                    $_nameAfterChild = $this->getChild('name.after')->getChild($_nameAfterChildName);
                    $_nameAfterChild->setProduct($_product);
                    echo $_nameAfterChild->toHtml();
                }
            }
    ?>
    <?php endif; ?>

    <!--show reviews-->
    <?php if (Mage::helper('themeframework/settings')->getProductsGrid_ShowReviews()):?>
        <div class="<?php if(Mage::helper('themeframework/settings')->getProductsGrid_ShowReviews() == 2):?>em-element-display-hover<?php endif;?> <?php echo $_classAlignCenter ?>"><?php echo $this->getReviewsSummaryHtml($_product, 'short') ?></div>                                        
    <?php endif; ?>

    <!--product price-->
    <?php if (Mage::helper('themeframework/settings')->getProductsGrid_ShowPrice()): ?>
        <div class="<?php echo $_classAlignCenter ?> <?php if(Mage::helper('themeframework/settings')->getProductsGrid_ShowPrice() == 2): ?>em-element-display-hover<?php endif;?>"><?php echo $this->getPriceHtml($_product, true) ?></div>
    <?php endif; ?>

    <!--product description-->
    <?php if (Mage::helper('themeframework/settings')->getProductsGrid_ShowDesc()): ?>
    <div class="desc std <?php echo $_classAlignCenter ?> <?php if(Mage::helper('themeframework/settings')->getProductsGrid_ShowDesc() == 2):?>em-element-display-hover<?php endif;?>">
        <?php 
            $shortdes =  $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description');
            if(strlen($shortdes)>100) { //dem ki tu chuoi $str, 80 la chieu dai muon quy dinh
                $strCutTitle = substr($shortdes, 0, 57); //cat 80 ki tu dau
                $shortdes = substr($strCutTitle, 0, strrpos($strCutTitle, ' '));
                $shortdes = substr_replace($shortdes ,"...",-3);
            }
            echo $this->stripTags($shortdes,null,true);
        ?>
    </div>
    <?php endif; ?>                                                         
</div>
</div>
</div> 
</li>   
<?php $i++;?>
<?php if($i >= $_collectionSize) break;?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<?php 
if(Mage::helper('themeframework/settings')->getGeneral_DisableResponsive(1)!=0){
switch($_pageLayout){
case 3:
$_columnCountDesktop = Mage::helper('themeframework/settings')->getProductsGrid_Threecolumns(3);
$_columnCountDesktopSmall = Mage::helper('themeframework/settings')->getProductsGrid_DesktopSmallThreecolumns(3);
$_columnCountTablet = Mage::helper('themeframework/settings')->getProductsGrid_TabletThreecolumns(3);                    
break;
case 1:
$_columnCountDesktop = Mage::helper('themeframework/settings')->getProductsGrid_Onecolumn(5);
$_columnCountDesktopSmall = Mage::helper('themeframework/settings')->getProductsGrid_DesktopSmallOnecolumn(5);
$_columnCountTablet = Mage::helper('themeframework/settings')->getProductsGrid_TabletOnecolumn(5);
break;
default:
$_columnCountDesktop = Mage::helper('themeframework/settings')->getProductsGrid_Twocolumns(4);
$_columnCountDesktopSmall = Mage::helper('themeframework/settings')->getProductsGrid_DesktopSmallTwocolumns(4);
$_columnCountTablet = Mage::helper('themeframework/settings')->getProductsGrid_TabletTwocolumns(4); 
break;
}
$_columnCountMobile = Mage::helper('themeframework/settings')->getProductsGrid_ItemsMobile(3);
}else{
switch($_pageLayout){
case 3:
$_columnCountDesktop = Mage::helper('themeframework/settings')->getProductsGrid_Threecolumns(3);                    
break;
case 1:
$_columnCountDesktop = Mage::helper('themeframework/settings')->getProductsGrid_Onecolumn(5);
break;
default:
$_columnCountDesktop = Mage::helper('themeframework/settings')->getProductsGrid_Twocolumns(4); 
break;
}               
}
endif; ?>

<div class="toolbar-bottom em-box-03">
<?php echo $this->getToolbarHtml() ?>
</div>
</div>
<?php endif; ?>
<!--  colorswatch -->
<?php
// Provides a block where additional page components may be attached, primarily good for in-page JavaScript
if ($this->getChild('after')) {
$_afterChildren = $this->getChild('after')->getSortedChildren();
foreach ($_afterChildren as $_afterChildName) {
$_afterChild = $this->getChild('after')->getChild($_afterChildName);
//set product collection on after blocks
$_afterChild->setProductCollection($_productCollection);
echo $_afterChild->toHtml();
}
}
?>
  1. Second, create CMS page with your details in admin panel. In content tab add below code

    {{block type="catalog/product_special" template="catalog/product/sales_specials.phtml"}}

In design tab Select your layout as 2 column with left bar and in Custom Layout Update XML write below code.

<reference name="content">
<block after="-" type="catalog/product_list" name="offerte.new" alias="offerte" template="catalog/product/sales_specials.phtml">
<action method="setProductsCount"><count>15</count></action>
</block>
</reference>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top