Maybe someone will find it usefull: $write = Mage::getSingleton(“core/resource”)->getConnection(“core_write”); $query = “insert into mytable ” . “(field1, field2, field3, field4) values ” . “(:field1, :field2, :field3, 12)”; $binds […]
Send pdf automatically when invoice is created in Magento
It is a bit different then method showed in previous post – this time its not transactional email sent at demand, but we will catch event fired after […]
Quicktip: How to send PDF invoice via transactional email in Magento?
Seems to be complex, but its not that bad: $orderModel = Mage::getModel(‘sales/order’)->load($myOrderId); $invoices = $orderModel->getInvoiceCollection(); $invoicesSet = array(); foreach ($invoices as $_invoice) { array_push($invoicesSet, $_invoice); } $pdf = […]
Quick tip: updating inventory in Magento using SKU
Its not that bad, all you have to do is get Stock Object, update quantity and save again along with product: $_product = Mage::getModel(‘catalog/product’)->loadByAttribute(‘sku’, $SKU); $qty = 12; […]
Quick tip: Conditions for addAttributeToFilter in Magento collections
As probably you know (or maybe not) in Magento you can add your own filters to every collection, basically it looks like: $collection = Mage::getModel(‘catalog/product’)->getCollection(); $collection->addAttributeToFilter(‘myfield’, array(‘eq’ => […]
Quick tip: PHP Extensions “0” must be loaded error in Magento install
Such error happens in 1.7.x branch (I saw it in 1.7.2), when entering database parameters you’re seeing “PHP Extensions “0” must be loaded” instead of next step. This […]
Quicktip: Magento 1.7.0.2 shows Database server does not support InnoDB storage engine
During configuration of Magento 1.7.0.2 (in fact whole 1.7.x branch) you may encounter such error: Database server does not support InnoDB storage engine Of course your MySQL server […]
Quick tip: Ajax filter is not working in Magento grid?
It is a common issue, you added: $this->setUseAjax(true); but filtering just shows ajax spinner and not loading content? Check your grid class ([COMPANY]_[MODULE]_Block_Adminhtml_[CONTROLLER]_Grid extending from Mage_Adminhtml_Block_Widget_Grid) and if […]
Quick tip: Redirect to admin product edit at specified tab in Magento
It’s quite easy if you know how to do it, if not use this snippet: $this->_redirect(‘adminhtml/catalog_product/edit’, array(‘id’ => $productid, ‘active_tab’ => ‘mytab’)); It works in every controller extending […]