Category: Magento
-
Magento do something when Order is Complete
Do something when any order is complete or invoice paid by Magento observer $order = $observer->getOrder(); if($order->getState() == Mage_Sales_Model_Order::STATE_COMPLETE){ //after order complete codes } or $invoice = $observer->getEvent()->getInvoice(); if($invoice->getState() == Mage_Sales_Model_Order_Invoice::STATE_PAID){ //afterInvoice Paid codes }
-
Magneto database CRUD
In magento a model is required to perform SQL query in your database tables. Sort data: $collection = Mage::getModel(‘module/model_name’)->getCollection() ->addAttributeToSort(‘order’, ‘ASC’) ->addAttributeToSort(‘last_name’, ‘ASC’) ->addAttributeToSort(‘first_name’, ‘ASC’); Or Condition:
-
Use TCPDF in Magento
Why you going to use TCPDF library in magento since magento zend have pdf library ? because you can make HTML to PDF in tcpdf but not directly with zendframwork. Here is how you can do it very easy
-
Magento Widget Development
Developing a Magento widget starts with widget.xml file in your modules etc directory.
-
Magento Adding extra field ‘CSS Class’ in Product Custom Options
Adding a extra field in product’s custom options may important to apply js or css on a custom option in front-end. Add html for the extra field: Open file app\design\adminhtml\default\default\template\catalog\product\edit\options\option.phtml Add this line
-
Magento Observer and Adding Custom Options Programmatically
Magento Observer is one of the powerful feature of magento, it enable you to do anything on any magento event. Like you want to run a method when customer adding product in cart, or you want to run a script when admin creating product in back-end etc.
-
Magento Quick Snippets
Cart Counter:
-
Magento Static Block as Managable DOM
-
Magento useful functions
This post will be updated continuously with new functions Get store data
-
Boost Magento page speed
1. Enable cache 2. Enable Zend Full page cache 3. zlib.output_compression on 4. turn on all compression of mod_deflate.c 5. “ExpiresActive On” in mod_expires.c 6. add some more cache and compression # YEAR Header set Cache-Control “max-age=29030400” # WEEK Header set Cache-Control “max-age=604800” # 45 MIN Header set Cache-Control “max-age=86400” mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include…