Magento project I'm currently in charge for has had the catalog price rules not sticking issue for some time now. This issue has been first reported as catalog price rules being unapplied on their own without any obvious pattern. Since, due to nature of it's catalog, catalog price rules are very backbone of the store in question, situation where prices change on their own was certainly problematic. Even though this Magento project wasn't of this edition or version, it was using Mage_Catalogrule module that was shipped with Magento Community Edition 1.8.0.0. Later research revealed that this issue has been fixed in Magento CE 1.8.1.0 (and all Magento editions and version derived from it), but immediate upgrade wasn't viable alternative at the time because I didn't know what causes this issue and has it been fixed upstream. Allow me to share debug path I had to take to get to the bottom of this.
Continue readingHow to make specific WordPress posts visible only when accessed directly
Recently I had to to publish an article in a way that common site visitors aren't aware of it's existence. Basically this article had to be excluded from all WordPress loops and visible only when accessed directly. General idea of solution presented in this article is to use pre_get_posts hook to alter WP_Query. Goal is excluding hidden post on frontend, area that isn't single post and when area is single post other than hidden post it self. Now allow me to share code snippet that can be used for this purpose.
Continue readingMagento extension for logging SOAP V1 and V2 API requests
Magento application programming interface allows third party applications to programatically interact with Magento instance. Magento supports two API standards, SOAP/XML-RPC and REST. Distinctive characteristics of SOAP (Simple Object Access Protocol) is that it uses XML as it's message format, and when used over HTTP it delivers data trough POST request method. My personal preference lies with REST APIs, but in my experience with version 2 of Magento SOAP API, I can freely say that it's one of the most enjoyable SOAP APIs I had privilege of working with. Only thing that bothers me is that Magento currently doesn't provide feature for allowing developers to peek inside SOAP envelope when something isn't working as it should. Essentially it isn't possible to easily debug SOAP API calls Magento receives. In this article I'm bringing Magento extension allowing you to capture SOAP API requests and log them into file.
Continue readingProgrammatically add new order state and status in Magento
Recently my task was to allow client to have different "type" of order in Magento. Requirement was that these orders need to have their own grid in Magento admin, and also that they need to be processed somewhat differently than regular orders. I have solved this task by adding new order states and statuses to be used only for this type of orders. To support this design it was also required to create new payment method so that orders of this type can be initiated into new order state automatically after being placed using this payment method. In this article I'm bringing you some code snippets and notes on how to implement this kind of solution.
Continue readingBash script to generate list of events for Magento installation
When developing for Magento, there are two ways to modify code provided by other modules - doing rewrites and observing events. If appropriate event is available for observing, it is preferred to use second method to alter other module's behavior. More precisely it is preferred to observe event of your interest, and when this event occurs, to trigger execution of your own code. But how are you supposed to know the list of events that are available for observing on your Magento installation? If you're interested to find out answer to this question, take the red pill, and I'll show you how deep the rabbit-hole goes.
Continue reading