(858) 586 7777 | About | Testimonials | Contact
vteams vteams vteams vteams
  • How does it work?
    • Startup Process
    • Your First Day
  • Technologies
    • Hire PHP Developer
    • Hire App Developer
    • Hire JavaScript Developer
    • Hire ROR Developer
    • Hire IOS Developer
    • Hire .NET Developer
    • Hire AI Developer
    • Hire Robotics Engineer
  • Sample Budgets
  • Meet The Team
  • Experiments
  • Captain’s Log
  • Blog
vteams vteams
  • How does it work?
    • Startup Process
    • Your First Day
  • Technologies
    • Hire PHP Developer
    • Hire App Developer
    • Hire JavaScript Developer
    • Hire ROR Developer
    • Hire IOS Developer
    • Hire .NET Developer
    • Hire AI Developer
    • Hire Robotics Engineer
  • Sample Budgets
  • Meet The Team
  • Experiments
  • Captain’s Log
  • Blog
Blog
  1. vteams
  2. Blog
  3. Migrating Magento Websites to PHP7
Apr 15
Magento-to-PHP7

Migrating Magento Websites to PHP7

  • April 15, 2016

Magento is one of the biggest and most popular e-commerce platforms written in PHP. However, migrating Magento sites to PHP 7 can prove to be a tedious task. While most of the Magento code is still valid in PHP 7, a few situations can arise where there are incompatibilities. This article will take you through these incompatibilities step by step to ensure a hassle free Magento to PHP 7 migration.

Following are the three main issues and their solutions:

1- Uniform Variable Syntax Errors

The following files cause variable syntax errors that need to be resolved with the help of steps mentioned below:

a) app/code/core/Mage/Core/Model/Layout.php:555

A fatal error is caused by this file which crashes Magento. To override this file, go to line#555 and replace $out .= $this->getBlock($callback[0])->$callback[1](); with $out .= $this->getBlock($callback[0])->{$callback[1]}();.

b) app\code\core\Mage\ImportExport\Model\Import:135

Magento CSV importer is affected by this file and you need to nullify it first. After that override _validateFile() function and go to line#135 and replace $params[‘object’]->$params[‘method’]($filePath); with $params[‘object’]->{$params[‘method’]}($filePath);.

c) app\code\core\Mage\ImportExport\Model\Export\Entity\Product\Type\Abstract.php:99

The abstract class issue has an impact on Magento‘s export functionality. Magento extends the following three classes from this abstract class:

  • Mage_ImportExport_Model_Export_Entity_Product_Type_Configurable
  • Mage_ImportExport_Model_Export_Entity_Product_Type_Grouped
  • Mage_ImportExport_Model_Export_Entity_Product_Type_Simple
    .

The root cause of this error inside the above mentioned classes is actually in line#99, so you need to override these three classes in your local code pool. To override the Attribute() function, go to line#99 and replace $data[‘filter_options’] = $this->$data[‘options_method’](); with $data[‘filter_options’] = $this->{$data[‘options_method’]}();.

d) app\code\core\Mage\ImportExport\Model\Export\Entity\Customer.php:250

This file affects export customers’ functionality. To override the above mentioned file, go to line#250 and replace $data[‘filter_options’] = $this->$data[‘options_method’](); with $data[‘filter_options’] = $this->{$data[‘options_method’]}();.

e) lib\Varien\File\Uploader.php:259

An issue may emerge here that file uploading won’t work. As Magento extends Mage_Core_Model_File_Uploader from the above class, so you need to override it and rewrite _validateFile() function. Now, go to line#259 and replace $params[‘object’]->$params[‘method’]($this->_file[‘tmp_name’]); with $params[‘object’]->{$params[‘method’]}($this->_file[‘tmp_name’]);.

2- Type Casting Issue

app\code\core\Mage\Core\Model\Resource\Session.php:218

User login won’t work in light of the fact that Magento Sessions don’t deal with PHP 7. read($sessId) function should return a string, so typecast the return variable by replacing return $data; with return (string)$data;.

3- Incorrect Grand Total

This issue can arise due to wrong sort order of subtotal, discount, and shipping etc. You need to correct the sort order by creating an extension. For this, put the following code in config.xml of the created extension:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<global>
    <sales>
        <quote>
            <totals>
                <msrp>
                     <before>grand_total</before>
                </msrp>
                <shipping>
                     <after>subtotal,freeshipping,tax_subtotal,msrp</after>
                </shipping>
            </totals>
        </quote>
    </sales>
</global>

 

  • Facebook
  • Twitter
  • Tumblr
  • Pinterest
  • Google+
  • LinkedIn
  • E-Mail

Comments are closed.

SEARCH BLOG

Categories

  • Blog (490)
  • Captain's Log (1)
  • Closure Reports (45)
  • Experiments (7)
  • How-To (56)
  • Implementation Notes (148)
  • Learn More (156)
  • LMS (8)
  • Look Inside (10)
  • Operations Log (12)
  • Programmer Notes (20)
  • R&D (14)
  • Rescue Log (4)
  • Testimonials (25)
  • Uncategorized (4)

RECENT STORIES

  • GitHub Actions- Automate your software workflows with excellence
  • Yii Framework – Accomplish Repetitive & Iterative Projects with Ease
  • A Recipe for CRM Software Development
  • Are Agile and DevOps the same?
  • The Data Scientist’s Toolset

ARCHIVES

In Short

With the vteams model, you bypass the middleman and hire your own offshore engineers - they work exclusively for you. You pay a reasonable monthly wage and get the job done without hassles, re-negotiations, feature counts or budget overruns.

Goals for 2020

  • Open development center in Australia
  • Complete and Launch the Robot
  • Structural changes to better address Clients' needs

Contact Us

Address: NEXTWERK INC.
6790 Embarcadero Ln, Ste 100,
Carlsbad, CA 92011, USA

Tel: (858) 586 7777
Email: fahad@nextwerk.com
Web: www.vteams.com

© 2020 vteams. All Rights Reserved.

Content Protection by DMCA.com