Question

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

J'accepte simonthesorcerer réponse, mais n'a pas fonctionné pour moi .

J'ai trouvé un module gratuit, vous pouvez obtenir sur cette URL: http://www.magentocommerce.com/magento-connect/thirty4+interactive/extension/841/catalog-sale-items

il fonctionne bien sur CE 1.7.0.2 si vous l'installez à partir d'ici manuellement: http://freegento.com/magento-extensions/Thirty4_CatalogSale-0.6.3_ready2paste.tgz

Téléchargez, décompressez et déplacer les fichiers dans les dossiers dans votre installation magento.

Je espère que cela va être utile à quelqu'un !!

========= FIN DE MISE A JOUR =========

Je suis en train de faire une page de prix spécial ... Après avoir essayé et Retrying et après plusieurs échoue, je suis venu avec ceci:

J'ai créé un fichier nommé: special.php dans ce chemin: app/code/local/Mage/Catalog/Block/Product/ avec ce 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;
   }
}
?>

après

J'ai créé un fichier nommé: special.phtml dans ce chemin: app/design/frontend/default/MY THEME NAME/template/catalog/product/ avec ce 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; ?>

et enfin j'appelle tout ce genre de choses dans une page CMS

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

maintenant, tout fonctionne bien, sauf le fait que cette page ne montre que des produits à un prix spécial mis un par un en éditant le produit. Mais la plus grande partie de mes produits sont fabriqués en vente via Catalogue Règles Prix ce que quelqu'un a une idée je peux montrer à la fois Prix catalogue Règles produits et « Prix spécial » Produits?

====== ====== MISE À JOUR

Voici le 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();
        }
   }
}
Était-ce utile?

La solution

il m'a fallu un certain temps pour comprendre. Si le travail pour vous, si vous customy pour vos besoins.

Pour les produits de la liste concernés par une règle de prix, vous devez faire votre chemin sur la règle modèle.

Voici le 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();
        }

== == Mise à jour

J'ai ajouté quelques commentaires au code et $skus remplacé le nom de $productIds (qui est mieux adaptée).

Si vous obtenez toujours des erreurs, s'il vous plaît laissez-moi savoir ce qui se passe exactement. Ce code est testé pour Magento v1.7.0.2.

Vive
Simon

Autres conseils

Voici le code qui fonctionne pour moi.

  1. Tout d'abord créer un fichier modèle par exemple-special.phtml de vente dans votre dossier app/design/frontend/jewelry/default/template/catalog/product

contenu des ventes special.phtml est

  $_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. Ensuite, créez la page CMS avec vos coordonnées dans le panneau d'administration. Dans l'onglet ci-dessous le code contenu add

    {{type de bloc = "catalogue / product_special" template = "catalogue / produit / sales_specials.phtml"}}

Dans l'onglet de conception Sélectionnez votre mise en page 2 colonne avec barre de gauche et en écriture sous le code XML Mise à jour Mise en page personnalisée.

<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>
Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top