• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 56
  • Last Modified:

Drupal: HOw to recreate a function within a module so it won't be over written on update

i had to make a change to one of the files in commerce_discount.  I added a join to the query so I could see another field in the product display.  I realized/remembered that should i need to update the commerce discount module, I will lose the changes I made.  I figure  I need to create/recreate the file with my changes, but how do I do this and call the new file and where do I store it so it will not be overwritten?

So for example, if I have made a change to coupon_discount.module, how do I recreate it?
0
quikwallace
Asked:
quikwallace
1 Solution
 
Aaron FeledyDrupal Developer and ConsultantCommented:
Being that security, bugfix, and feature updates will be made to that file in the future, it probably wouldn't be wise to keep your original version of the file intact. That would result in missing out on these updates and potentially breaking the module all together following an update.

Your best bet would be to clone the module with Git so that source changes are tracked. That way you can create a local branch, then merge in the latest updates to the module, including those to the file you modified, while keeping your code changes intact.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now