Category Archives: Magento

Magento Fatal Error Function Name Must Be A String With PHP 7

I have installed my magneto 1.x on PHP 7.x version, however I have got error like Fatal error: Uncaught Error: Function name must be a string …app\code\core\Mage\Core\Model\Layout.php. How can I solve this issue

You can modify the following file directly or you can create same file under the local folder

1. find the following file

app\code\core\Mage\Core\Model\Layout.php

2. find the following line from above file

$out .= $this->getBlock($callback[0])->$callback[1]();

3. then replace with following

$out .= $this->getBlock($callback[0])->{$callback[1]}();

Magento 2 Change Order Status Programmatically

How to change the Magento 2 order status programmatically

You can use “setState” to change the status of an order.

$orderId = 1;

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('\Magento\Sales\Model\Order')
                           ->load($orderId); 

$order->setState("processing")->setStatus("processing");

$order->save();

How Can I Backup And Restore The Magento 2

What command should I use to backup and restore the Magento 2 easily

Backup

Here is the command usage to backup the Magento 2

magento setup:backup [--code] [--media] [--db]

[–code] is backing up the Magento file system (excluding var and pub/static directories).

[–media] is backing up the pub/media directory.

[–db] is backing up the Magento 2 database.

if you would like to backup database and Magento file system, you should execute the following command

magento setup:backup --code --db

Restore

When you try to restore the backup, first you need to get backup name.

Run the following command to get backup name.

magento info:backups:list

Once you got the backup name, execute the following command

magento setup:rollback -m 1440512939_filesystem_media.tgz