Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2010
    Posts
    28
    Plugin Contributions
    0

    help question How do I get custom functions included?

    Zencart v1.3.9f

    Where do I put my php file so all the functions in the file will be available to the rest of the application. I put it in:
    includes/templates/mytemplate/includes/myfile.php

    That doesn't seem to work.

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: How do I get custom functions included?

    Where do I put my php file so all the functions in the file will be available to the rest of the application.
    Depend upon what the function(s) are
    Check the wiki for the developers view

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: How do I get custom functions included?

    Custom functions can go in their own file in /includes/functions/extra_functions/ (no custom template folder).

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: How do I get custom functions included?

    Quote Originally Posted by gjh42
    Custom functions should go in their own file in /includes/functions/extra_functions/ (no custom template folder).
    If and only if they are structured/written in ZenCart format
    You might also need to break out other items

    auto_loaders
    classes
    extra_cart_actions
    extra_configures
    extra_datafiles
    functions
    init_includes
    languages
    modules

  5. #5
    Join Date
    Sep 2010
    Posts
    28
    Plugin Contributions
    0

    Default Re: How do I get custom functions included?

    Thanks guys (gals). I have created a theme from an existing (non zencart) website and I am trying to make it look like the parent site. The menu will appear in the header as I don't intend on using any existing zen cart structure for it (because I don't know how and I'm up against a market window). The menu is based upon a sprite graphic.

    Link1 Link2 Link3 Link4 Link5

    I created a function called get_main_menu() and it creates ul/li items that are defined in CSS with position: top: and left: properties. The background images are defined in CSS as well. There is no text except the title attribute. The image is the anchor.

    Actually, this will be the first of probably several (or many) functions that I would normally put into a lib.php file.

    Is the /includes/functions/extra_functions/ still appropriate? Thx.

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: How do I get custom functions included?

    For functions, yes. The other code elements kobra mentioned would be separated out into their own files as well if you have them.

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: How do I get custom functions included?

    To continue, if you are fluent in PHP, tpl_header.php is not difficult to understand, and you can modify or clone some of the nav in that to work within Zen Cart's structure. This thread discusses some of the header nav structure: http://www.zen-cart.com/forum/showthread.php?t=163968

  8. #8
    Join Date
    Sep 2010
    Posts
    28
    Plugin Contributions
    0

    Default Re: How do I get custom functions included?

    Excellent comments all. Thx.

 

 

Similar Threads

  1. How to get custom shipping module costs through to checkout?
    By s_mack in forum Addon Shipping Modules
    Replies: 33
    Last Post: 3 Feb 2017, 06:16 AM
  2. v139h USPS Custom Dimension Feature not included in Ajeh's 7/28/2013 update
    By nighkidz2 in forum Addon Shipping Modules
    Replies: 0
    Last Post: 11 Sep 2013, 06:53 AM
  3. Custom Functions
    By solo_400 in forum Code Collaboration
    Replies: 2
    Last Post: 25 Feb 2013, 02:50 PM
  4. v139h zen_draw_checkbox_field - how do I get my custom field to show selection in checkbox?
    By johnlewisdesign in forum Customization from the Admin
    Replies: 2
    Last Post: 1 May 2012, 03:12 PM
  5. Custom Search box, integrated in header (example link included)
    By edwardtilbury in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 10 Dec 2008, 05:20 PM

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