Solved

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

Posted on 2014-02-04
2
28 Views
Last Modified: 2016-05-17
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
Comment
Question by:quikwallace
2 Comments
 
LVL 13

Accepted Solution

by:
Arrow_1 earned 500 total points
ID: 39837485
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now