June 9, 2016

Orders do not show up in Your Account > Order History

My customers place orders, and when they go to the Your Account > Order History section of their account, the orders do not show up while admin can see in the back-end.

After investigating I seen that order has been NOT completed payment in payment gateway. So the payment module set the order state is "pending_payment". Looking Mage_Sales module we will see list of order state defined in app/code/core/Mage/Sales/etc/config.xml

<config>
    <global>
        <sales>
            <order>
                <states>
                    <new translate="label">
                        <label>New</label>
                        <statuses>
                            <pending default="1"/>
                        </statuses>
                        <visible_on_front>1</visible_on_front>
                    </new>
                    <pending_payment translate="label">
                        <label>Pending Payment</label>
                        <statuses>
                            <pending_payment default="1"/>
                        </statuses>
                    </pending_payment>
you will notice this state does not have a <visible_on_front>1</visible_on_front> node

So the solution is change order status to processing or allow this state to be shown. For the second option you can use the following: 

<config>
    <global>
        <sales>
            <order>
                <states>
                    <pending_payment translate="label">
                        <visible_on_front>1</visible_on_front>
                    </pending_payment>
                </states>
            </order>
        </sales>
    </global>
</config>
in your own custom extension's etc/config.xml file.

March 10, 2016

Magento EE synchronize data and configurations between a staging and a main website


From "Scheduler Timeline" dashboard in Magento EE 1.x I saw a cron name "enterprise_staging_automates". This cron runs every minute.

Back to Magento EE features, Magento EE allows you to create staging sites, and merge them at a certain date/time

Look around Magento core I discover module Enterprise_Staging that handles Content Staging inside enterprise (effectively allowing you to duplicate the store and views and preview changes). The following code automate:

public function automates() { try { $currentDate = Mage::getModel('core/date')->gmtDate(); $collection = Mage::getResourceModel('enterprise_staging/staging_collection') ->addIsSheduledToFilter(); foreach ($collection as $staging) { $applyDate = $staging->getMergeSchedulingDate(); if ($currentDate >= $applyDate) { $mapData = $staging->getMergeSchedulingMap(); if (!empty($mapData)) { $mapper = $staging->getMapperInstance()->unserialize($mapData); if ($mapper->getIsBackup()) { $staging->backup(); } $staging->setIsMegreByCron(true); $staging->merge(); } } } } catch (Enterprise_Staging_Exception $e) {} }
To achieve this function we need to add a staging website in install_dir/staging folder of Magento directory. We can add a staging website in System > Content staging menu. After creating a staging website, this cron will sync the data form main website to staging website from time to time.

Did you try this?
 

February 18, 2016

Git merge a specific commit in current branch



You can use git cherry-pick to apply a single commit by itself to your current branch.

Example: git cherry-pick d42c389f
There was an error in this gadget