This article will explain how to add upsell, cross sell and related products programmatically to Magento. One of practical examples would be data migration from some other ecommerce system to Magento. You can read a nice article on how to add upsell, cross sell and related products from administration here. It explains what all these product relations mean and where are they used on the site.Read more
Most of the time working with Magento, a single database connection is just enough. Magento has excellent system of adding new tables in database or extending existing ones. So, why would there be a need for an external database connection outside the Magento system? Well, one of the examples is data migration from another ecommerce system. In this article, a simple connection to external database is explained with CRUD (create, read, update, delete) examples.Read more
Don’t do it. Just, simply, never write a database query inside a loop. Ever. Put in a little bit of effort and write code that will insert or read all data in one big batch, or at least group big chunks of data in the smallest possible number of queries. That’s it. Move on. These aren’t the droids you’re looking for.Read more
When doing some database upgrades in Magento, and in general, the best and the smartest way would be to create install or upgrade scripts to keep a persistent data structure. When a core setup is not enough and attributes have to be created or updated, either the customer or catalog product setup class has to be defined. Switching between those two classes is not solved very well in Magento and this little snippet will make the switching as easy as pie.Read more
[Guest post] Sooner or later, while working, every developer needs to deal with uniform tasks that arise every now and then. The majority of our clients usually only need minor changes in their store’s appearance or bug fixing. Working for such clients typically requires a smaller amount of work. With this type of client, the process of ‘overtaking’ the project needs to be as quick as possible.Read more
If you are in the business of creating your own custom extension (module) for magento, then chances are that at some point you will need your extension to be able to persist data to database, this is where the installation scripts come in place. Later on, when you upgrade your extension and decide to add few new tables to database or few new columns to database table that was initially created by the original installation extension you will need to look for upgrade script. Finally, if you want to set some initial default values in the database tables of your extension you will need to look for data scripts.Read more
Sometimes during the various Magento upgrade projects you might find it handy to have a SQL file ready to “restore” the old Magento version. Maybe a client has the Magento Community Edition 220.127.116.11 and is requesting an update to newest version. One of the actions you might want to take is to grab its database structure dump and compare it to original v.18.104.22.168 just to see if there were some custom tables added by developers, then you can compare it with original Magento installation.Read more
We received a request from a client where they wanted to implement an expanded order grid while still keeping the default Magento’s one. For this example we’ll create a new module named Inchoo Orders.Read more
Maybe you can ask yourself why do I need prepared data for filters in my collections – in Magento admin grids. Well, I can perhaps create new grid and action for some custom functionality and show such grid and then additionally do (filter by) whatever I need.
But notice that if you create such collection with some addFieldToFilter() method you always use specified filter for that collection.
If you are interested how to use only one collection for showing different results for that collection (prepared filter), keep reading.
Did you ever need to create grid in Magento administration that is filterable by more column’s values, i.e. something from multiselect drop-down. Or perhaps more specific, you want to export all pending orders (order status: pending, pending_payment, pending_paypal) but you aren’t satisfied with Magento implementation of selecting, searching and exporting one by one pending order status. If you’re interested how I implemented similar behavior with input text field, simulating MySQL “IN” and “NOT IN” statement, keep reading!Read more
In this post, I will just mention some of the issues with date format from my own experience, in hope that this will help somebody to save few hours of tracing Magento to find the solution :-).Read more
Why Magento can’t use indexes on columns in admin grid when you are searching for some value e.g. order#?
This article will be really short but extremely useful in case if you have a Magento website that have “several” administrators. I’ve worked on project that have more than 2.000 administrators with different roles (that number constantly grows). You probably can imagine how slow things can be when lots of administrators use administration, specially when they are searching or sorting some data (order# or first_name, etc.).Read more
Did you ever had a problem where you can not see all available categories in “Categories” tab while editing a product? Does your Indexer process hangs when updating “Catalog URL rewrites”? At the same time your category tree looks just fine on “Manage Categories” menu and you can see assigned products in each category? This issue can happen for a number of reasons, but it usually happens when you are using some bad script for importing category information from some other 3rd party system (like switching your shop from osCommerce, for example). Well, look no further, here’s the solution.Read more
In some situation when you want to re-index Magento catalog you will get an error message or reindex process will be broken. This problem is appearing when you have a lot of products in database and limited server resource. You can try to reindex from command line or shell.Read more
You probaly know that Magento uses EAV database structure for categories, products. In some cases this solution is not the best or fastest.Read more