Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Featured extends MagentoCatalogBlockProductListProduct
- {
- protected $categoryFactory;
- public function __construct(
- MagentoCatalogBlockProductContext $context,
- MagentoCatalogModelCategoryFactory $categoryFactory,
- array $data = []
- ) {
- $this->categoryFactory = $categoryFactory;
- parent::__construct(
- $context,
- $data
- );
- }
- public function getCategoryProductsAscZeroLast($categoryId)
- {
- $products = $this->categoryFactory->create()->load($id)->getProductCollection()->addAttributeToSelect('*');
- //$products->getSelect()->setOrder('cat_index_position', 'DESC');
- return $products;
- }
- }
- public function getCategoryProductsAscZeroLast($categoryId)
- {
- $products = $this->getCategoryData($categoryId)->getProductCollection();
- $products->addAttributeToSelect('*');
- $products->getSelect()->order(new Zend_Db_Expr("CASE WHEN `cat_index_position` = '0' THEN 9999 ELSE 1 END"));
- return $products;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement