Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2012
    Location
    Los Angeles, CA
    Posts
    185
    Plugin Contributions
    2

    help question When I want to customize code, where do I put it?

    I have been meaning to ask this for some time, I know we are encouraged to use software such as WinMerge when comparing files to be merged, but what if the files just do not merge well...for instance the update_product.php in ZC 1.5.6 loses major components when you upload or try to merge it with the same file from AutoTweet 2.5

    Is it ok to take the functional parts of the AutoTweet copy of update_product.php and just past them at the bottom of the original file (similar to adding html code to the body section - while not disturbing the original or previous additions) or do they absolutely have to be in a specific line or space in the file to work?

    Like in math, you work on the stuff in the parenthesis 1st, then divide or multiply before addition and subtraction. Is there a protocol for this?

  2. #2
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: Code Protocol is there such a thing?

    Generally speaking, when software modifies an existing ZC file, it does so from some historically known file version. In essence it takes a known good file and adds to it what is needed to operate.

    So if it works just fine in ZC 1.5.5, then compare the default version of ZC 1.5.5's file with the new file to identify what was changed to make it work. Then look at how the new version's file is similar/different and determine where to incorporate the necessary information. It may be just adding something to the end, the beginning, or some other file.

    The ideal goal is that no ZC provided file should need modification to support additional functionality. Changes should only be needed to address personal preferences of layout (template related).

    Now, I say that and there has been some development to make it "easier" to load additional javascript (makes it possible to modify the html of the page without modifying other display files; however, the method provided requires modification of that file in order to load additional javascript at times, so... kind of a catch-22. Want to add code without modifying core or provided files, but may have to modify a core/provided file to do that... I'm still meddling with some things where I might be wrong about needing to modify a file, but...)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jun 2007
    Posts
    474
    Plugin Contributions
    2

    Default Re: When I want to customize code, where do I put it?

    It depends on the code and the file.

    For some stuff it goes on the page where you want it to appear. For other stuff it has to go at the beginning or end.

    For what you are describing, it most likely needs to be dropped in the file where you want it to appear. You just have to make sure you account for the ordering of elements - similar to what you described with math.

    So for instance, maybe there is a section called/displaying as "Section A". Find that section in the file, find where it closes itself, and put your new code underneath it.

    If you provide more specifics we can walk through it more with you.

 

 

Similar Threads

  1. I want to define myself grobal var,where to put it?
    By linjuming in forum General Questions
    Replies: 1
    Last Post: 7 Jul 2012, 02:52 PM
  2. Where do I put product_listing.php to customize it.
    By alterego55 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 15 Oct 2010, 01:45 AM
  3. Want to put php code in sidebox
    By bgroup99 in forum Basic Configuration
    Replies: 0
    Last Post: 30 Nov 2007, 08:05 PM
  4. Where do I put the new template in order to customize it?
    By STFlats in forum Templates, Stylesheets, Page Layout
    Replies: 11
    Last Post: 4 Apr 2007, 05:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR