Month: January 2010
Mass update stock levels in Magento - FAST
This isn't ground-breaking code, but rather just using some core code in a rather stripped out manner. As we're not big fans of Magento data flow here, we perform most of our stock and catalogue updates using external scripts to … Continue reading
Display Attributes on Invoice or Packing Slip in Magento
Add this to Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php, replace ATTRNAME as appropriate. public function draw() { ... $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $this->getSku($item), array('ATTRNAME')); if ($product) { $lines[0][] = array( 'text' => Mage::helper('core/string')->str_split($product->getData('ATTRNAME'), 15), 'feed' => 305 ); } Then add this to Mage/Sales/Model/Order/Pdf/Invoice.php, replace ATTR_TITLE … Continue reading
Cleanly delete all categories in Magento
If you have been working on a demo store - or yours is still in the early stages of construction, you will probably find it necessary to remove all the categories to start fresh at some point. Thanks to CasualCommerce, … Continue reading
Fast bulk product status change with Magento
If you have a large catalogue, using some standard features are simply impractical to use. Recently, we needed to disable an entire range of products based on its SKU - via the backend, bulk status changing 5000 products will take … Continue reading
Speed up Magento, product import, export and general via the database
If your Magento product imports and exports certainly aren't as speedy as they used to be, it could be that the database table is just filling up with old records. There are a few to look at. TRUNCATE dataflow_batch_export; TRUNCATE … Continue reading
Magento/WordPress injection vulnerability
We had been recently contacted by an agency (non-Sonassi Hosting) keen to resolve a Magento redirect on checkout bug. We quickly realised after inspection that the site had been subject to an all-too-common POST injection vulnerability. Discussing ultimate prevention is … Continue reading