Ctrl+Alt+Life: Hacking life, tech, and beyond.
-
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 }
-
CodeIgniter Force Clear Browser Cache
Sometimes when I make changes in live and want visitor to clear their browser cache to see latest changes. I setup http header to expire current cache by setting a back date. here is the code for CodeIgniter. after few days of update I remove this code so browser can cache again. ๐ $this->output->set_header(“HTTP/1.0 200…
-
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
Need tech consultancy?