Jump to content

Best way to make changes in core files


tommy100
 Share

Recommended Posts

Hi,

I need to make some changes in php files located in the shop root (product.php, etc.) and also in some classes. What's the best way to do this, so future version upgrades are as hassle free as possible?

Thanks!
Tommy

Share this post


Link to post
Share on other sites

In PrestaShop v1.4, you would override the ProductController and Product class so that modifying those files wasn't required, which makes upgrading easy. In PrestaShop v1.3 and earlier, the only option is to actually modify the files, then keep a log of the changes so you can make the same changes again when you replace the files with the updated ones.

Share this post


Link to post
Share on other sites

Rocky,

Do you name the override php file the same as the original? If not, how does the system know to use your new file? Do you have to provide a constructor that calls the parent constructor? Can you just override specific functions, or do you copy the entire class and modify the code as needed?

I have some OO knowledge with Java, but just need some direction to get started. Thanks

Share this post


Link to post
Share on other sites

Hi,
I need to make some changes in php files located in the shop root (product.php, etc.) and also in some classes. What's the best way to do this, so future version upgrades are as hassle free as possible?

Use any version control system (svn, git...) and it's merge tool

Share this post


Link to post
Share on other sites

It is good to use version control tools. But I think this option only available for developers.

Most store owner don't know how to use this kind of tools, just do some small changes by themselves or hire a developer to make changes.

Share this post


Link to post
Share on other sites

It is good to use version control tools. But I think this option only available for developers.

Most store owner don't know how to use this kind of tools, just do some small changes by themselves or hire a developer to make changes.

you are right

http://winmerge.org/ - simple and clean free tool for two files compare
may be it would be helpful

Share this post


Link to post
Share on other sites

You should use the name of the class as the filename with PHP as the extension, then create a class that extends the class name ending with Core. You should override only functions you need to modify, not copy all the code. See my post here.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More