Magento uses keywords in for IN and nin for NOT IN … $productIds = array(1251,1253,1256); if ($column->getFilter()->getValue()) { $this->getCollection()->addFieldToFilter(’entity_id’, array(’in’=>$productIds)); } else { $this->getCollection()->addFieldToFilter(’entity_id’, array(’nin’=>$productIds)); } …
Posted on July 6, 2017, 10:12 am, by admin, under
Tips.
addAttributeToFilter() is used to filter EAV collections. addFieldToFilter() is used to filter Non-EAV collections.
tag is used for re-usage of existing layout <vendorname_modulename_constrollername_indexaction> <reference name="myreferencename"> <block type="vendorname/blockname" name="modulename_blockname" template="storelocator/template.phtml"> </block> </reference> </vendorname_modulename_constrollername_indexaction> <vendorname_modulename_constrollername_listaction> <update handle="vendorname_modulename_constrollername_indexaction"/> </vendorname_modulename_constrollername_listaction>
Posted on June 30, 2017, 1:08 pm, by admin, under
Tips.
Redirect to the list Action in the same Controller $this->getResponse()->setRedirect(Mage::getUrl(’*/*/list’));
Method 1: <?php … $this->getResource()->getTable(’catalog/category_product’); Method 2: … Mage::getSingleton(’core/resource’)->getTableName(’catalog/category_product’);
<?php … public function getCustomer() { $customerId = $this->_getCustomerId(); return Mage::getModel(’customer/customer’)->load($customerId); } private function _getCustomerId() { return Mage::getSingleton(’customer/session’)->getCustomerId(); } …
<?php // require_once ‘/var/www/magento/app/Mage.php’; // Mage::init(); function getSession() { return Mage::getSingleton(’customer/session’); } if (!getSession()->isLoggedIn()) { $this->_redirect(’customer/account/login’); return; } if (getSession()->isLoggedIn()) { echo ‘loggedIn’; $customerData = Mage::getSingleton(’customer/session’)->getCustomer(); printf("%s\n %s\n %s\n %s", $customerData->getId(), $customerData->getWebsiteId(), $customerData->getStoreId(), $customerData->getIsActive()); //Zend_Debug::dump($customerData); }
1) eav_attribute whenever you create a attribute this table gets entry which stores all important data which helps to make a relation, like entity_type_id,attribute_code,backend_type and many more but this are the important fields. 2) eav_entity_type Magento has 8 types of entity, by which, type of attribute is decided. in your case it is catalog_product 1) […]
EAV makes a lot of sense for a generic e-commerce solution. A store that sells laptops (which have a CPU speed, color, ram amount, etc) is going to have a different set of needs than a store that sells yarn (yarn has a color, but no CPU speed, etc.). Even within our hypothetical yarn store, […]
<?php $collection = Mage::getResourceModel(’mybrands/orders’) ->addFieldToSelect(’name’) ->addFieldToSelect(’order_id’); echo ‘<pre>’; print_r($collection->getSelect()->__toString());