Thursday, June 9, 2016

Get first item or last item from the collection

$collection->getFirstItem() and $collection->getLastItem();

Database table for configurable product

catalog_product_relation
catalog_product_superlink_table

commonly used block types

core/template
page/html
page/html_head
page/html_header
page/html_footer
page/template_links
page/html_breadcrumbs
core/text_list
page/html_wrapper
page/switch
core/messages

Add an external javascript/css file to Magento

<action method="addJs"><script>js/custom.js</script></action>
<action method="addCss"><stylesheet>css/custom.css</stylesheet></action>
OR
<action method="addItem"><type>skin_js</type><name>js/custom.js</name></action>
<action method="addItem"><type>skin_css</type><name>css/custom. css</name></action>

fetch top 3 bestsellers products programmatically

Mage::getResourceModel('reports/product_collection')->addOrderedQty()->addAttributeToSelect('*')->setPage(1, 3)->load();

Wednesday, June 8, 2016

steps to increase the performance of magento


  1. Enable Gzip compression
  2. Combine external CSS/JS into one file
  3. Disable modules which are not used
  4. MySQL Query Caching
  5. Enable Magento caching
  6. Disable the Magento log
  7. Image Optimization

set different themes for logged in users or set different themes on runtime

 if(Mage::getSingleton('customer/session')->isLoggedIn())
{
Mage::getDesign()->setPackageName('packagename')->setTheme('themename');
}

Fatal error: Class Zend\Stdlib\Parameters contains 1 abstract method... magento 2

Fatal error: Class Zend\Stdlib\Parameters contains 1 abstract method and must therefore be declared abstract or implement the remaining met...