Monday 16 May 2016

how to call a custom phtml file on CMS Page and blocks (Admin panel) magento 2


Calling in blocks and cms pages

{{block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::html/test.phtml"}}

Thursday 12 May 2016

how to order canceled by code on magento 2

require_once '../app/Mage.php';
    umask(0);
    Mage::app('default');
    Mage::getSingleton('core/session', array('name'=>'frontend'));
   

    //$toDate = date('Y-m-d H:i:s', strtotime("-3 minutes"));
    $toDate = date('Y-m-d H:i:s', strtotime("-96 hours"));
   
    $orderCollection = Mage::getModel('sales/order')->getCollection()
        ->addAttributeToFilter('created_at', array('to'=>$toDate))
        ->addFieldToFilter('status', 'pending');
      
    foreach($orderCollection as $_order)
    {
        $order = Mage::getModel('sales/order')->load($_order['entity_id']);
      
        if($order->canCancel())
        {
        $order->cancel();
        $comment = 'Order marked as cancelled';
        $isCustomerNotified =true;
        $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, "canceled", $comment, $isCustomerNotified);
       
        $order->save();
        $order->sendOrderUpdateEmail(true, $comment);

    }   
    }

Tuesday 3 May 2016

how to remove space before body class on magento

/app/code/core/Mage/Page/Block/Html.php  (Line number 157)

public function getBodyClass()
{
    return trim($this->_getData('body_class');
}