Randomize Collection In magento <?php $_model = Mage::getModel('catalog/category'); // Using the "catalog/navigation" Block Classes, we can invoke the getStoreCategories() method to get all Store Cats. $storeId = Mage::app()->getStore()->getId(); $_categories = Mage::getModel('catalog/category') ->getCollection() ->addAttributeToSelect('*') ->addIsActiveFilter() ->addLevelFilter(2) ->setStoreId($storeId); $_categories->getSelect()->order(new Zend_Db_Expr('RAND()')); $new="";$new2=""; // We'll loop through the returned Category Object foreach( $_categories as $_category ) { //this gives random order of products }
Step 1) Override the file /app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tabs.php, Inside _beforeToHtml() method, add the following code: $ this -> addTab ( 'Custom' , array ( 'label' = > Mage :: helper ( 'customer' ) -> __ ( 'Custom' ) , 'class' = > 'ajax' , 'url' = > $ this -> getUrl ( '*/*/custom' , array ( '_current' = > true ) ) , ) ) ; Step 2) Override the file /app/code/core/Mage/Adminhtml/controllers/CustomerController.php, Add the following code: public function customAction() { $this->_initCustomer(); $this->getResponse()->setBody( Mage::app()->getLayout()->createBlock('core/template')->setTemplate('custom/customer/tab/custom.phtml')->setCustomerId(Mage::registry('current_customer')->getId()) ->setUseAjax(true)-...
Comments
Post a Comment