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 as appropriate and OFFSET with the left offset. /* Add table head */ ... $page->drawText(Mage::helper('sales')->__('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, there is a pretty straightforward MySQL "script" to clear out the tables and start fresh. … 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 hours, but fortunately SQL is a spot more lightweight. In the code below (to be … 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 dataflow_batch_import; TRUNCATE log_customer; TRUNCATE log_quote; TRUNCATE log_summary; TRUNCATE log_summary_type; TRUNCATE log_url; TRUNCATE log_url_info; TRUNCATE log_visitor; … 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 beyond the scope of this post, but you can check for tell tale signs. If … Continue reading
Quick script to batch create Magento categories
A site we administer with a reasonable amount of SKUs (far in excess of 100,000), needed some quick category manipulation for a series of new data to be dropped in. The new information had a desired category tree that had to be built up quick, but with over 600 categories to be created, human effort … Continue reading
Export Excel CSVs with double quotes
This is a necessary evil for anyone who is working with CSV files manipulating them for data import to Magento (when XML is not suitable). Add the following function (sub routine) to Excel and hit the Macro button to run it. You'll have no more failed Magento imports with this handy function. Sub subExportCSV() On … Continue reading
Quick script to export Magento categories with IDs
If you are after a quick method to get all the category ID's for your categories for some Excel lookups (for new data imports), then this quick PHP script should help you out: <?php define('MAGENTO', realpath(dirname(__FILE__))); require_once MAGENTO . '/app/Mage.php'; Mage::app(); $category = Mage::getModel('catalog/category'); $tree = $category->getTreeModel(); $tree->load(); $ids = $tree->getCollection()->getAllIds(); if ($ids) { $file … Continue reading
Speeding up the Magento admin
I've noticed a few people discussing this issue on the Magento Commerce forum, so it might be worthwhile for us to offer a level of assistance (other than the fast Magento hosting we provide already from sonassi hosting). Downloading the following file, SlowManageCategories.zip patch. Extract the zip file and copy Sonassi_All.xml to your ./app/etc/modules/ directory. … Continue reading
Resolved: Routing complications at LINX
Following from our post on the routing complications at the London Internet Exchange. Whilst we haven't had official word from LINX, our tests have shown correct routing to our data centre with no issues. Once the issue is confirmed, we will update this thread. UPDATE More information from LINX, they diagnosed a faulty port on … Continue reading