예제 #1
0
 /**
  * Retrieve how much products should be displayed.
  *
  * @return int
  */
 public function getProductsCount()
 {
     if (!$this->hasData('products_count')) {
         return parent::getProductsCount();
     }
     return $this->_getData('products_count');
 }
예제 #2
0
파일: New.php 프로젝트: nil12285/gwine
 /**
  * Produces html
  *
  * @return string
  */
 protected function _toHtml()
 {
     $productIds = Mage::getModel('productblock/featuredcatalogproduct')->getCollection();
     $columns = $this->getData('columns');
     $title = $this->getData('Title');
     $_add_to_link = $this->getData('add_to_link');
     $products_count = $this->getData('products_count') ? $this->getData('products_count') : parent::getProductsCount();
     //$product = Mage::getModel('catalog/product');
     $pIds = array();
     foreach ($productIds as $pId) {
         $pIds[] = $pId->getEntityId();
     }
     $collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->addFieldToFilter('entity_id', array('in' => $pIds));
     //->getSelect()
     $this->assign('_columnCount', $columns);
     $this->assign('_title', $title);
     $this->assign('_add_to_link', $_add_to_link);
     $this->assign('_products', $collection);
     return parent::_toHtml();
 }
예제 #3
0
파일: NewTest.php 프로젝트: relue/magento2
 public function testSetGetProductsCount()
 {
     $this->assertEquals(Mage_Catalog_Block_Product_New::DEFAULT_PRODUCTS_COUNT, $this->_block->getProductsCount());
     $this->_block->setProductsCount(100);
     $this->assertEquals(100, $this->_block->getProductsCount());
 }