Page 3 of 7 FirstFirst 12345 ... LastLast
Results 21 to 30 of 62
  1. #21

    Default Re: Updating Mod for 150 - Little Problem

    Ok, I found a tutorial at w3schools.com on how to write a PHP define.

    The sample they provided looks simple enough:
    Code:
    <?php
    define("GREETING","Hello you! How are you today?");
    echo constant("GREETING");
    ?>
    But here are my questions:

    1. Where do I put the define?
    2. How do I determine what the define's value should be?

    I think that in order to understand what the define's value should be, I need to understand the logic behind the output (i.e. where will it appear so I can figure out what its supposed to say? what purpose is it serving?)
    Go that extra mile, you never know what's at the end of the road

    Empowerment Sanctuary

  2. #22

    Default Re: Updating Mod for 150 - Little Problem

    A question about learning to interpret error messages:

    How can I tell that the error message below is telling me that I'm missing a define? Is there something specific in there that points me in that direction, or does it just come with time and learning?
    Code:
    [31-Mar-2012 22:09:27]
    PHP Warning:  include(includes/modules/FILENAME_RECENT_PRODUCTS_MODULE.php) [<a 
    href='function.include'>function.include</a>]: failed to open stream: No such file or directory in 
    /***/***/public_html/***/includes/templates/atestcustom/templates/tpl_modules_recent_products.php 
    on line 12
    
    [31-Mar-2012 22:09:27] 
    PHP Warning:  include() [<a href='function.include'>function.include</a>]: Failed opening 
    'includes/modules/FILENAME_RECENT_PRODUCTS_MODULE.php' for inclusion 
    (include_path='.:/usr/lib/php:/usr/local/lib/php') in 
    /***/***/public_html/***/includes/templates/atestcustom/templates/tpl_modules_recent_products.php on line 12

    Note that I've already made the following changes, yet the error remains the same:


    Changed includes/modules/FILENAME_RECENT_PRODUCTS_MODULE.php

    to

    includes/modules/FILENAME_RECENT_PRODUCTS.php

    and

    Changed line 12 of /includes/templates/atestcustom/templates/tpl_modules_recent_products.php from

    PHP Code:
    include(DIR_WS_MODULES zen_get_module_directory(FILENAME_RECENT_PRODUCTS_MODULE)); 
    to

    PHP Code:
    include(DIR_WS_MODULES zen_get_module_directory(FILENAME_RECENT_PRODUCTS)); 
    Last edited by ScriptJunkie; 2 Apr 2012 at 05:39 PM.
    Go that extra mile, you never know what's at the end of the road

    Empowerment Sanctuary

  3. #23
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    6,997
    Plugin Contributions
    27

    Default Re: Updating Mod for 150 - Little Problem

    They usually go in a separate file.. Depending on the how it's being used in Zen Cart they could be in a language folder, a class folder, a functions folder, an extra datafiles folder or even an extra configures folder in Zen Cart.

    Do a search through your store using the developers toolkit (search for "define(") to look for existing examples to see how you would construct one.

    For Edit Orders there is one similar to what you are trying to do. From line 21 of admin/includes/extra_configures/edit_orders.php

    Code:
    define('FILENAME_ORDER_EDIT', 'edit_orders.php');
    Super Orders also uses a similar file to point links to the orders.php file

    Quote Originally Posted by ScriptJunkie View Post
    Ok, I found a tutorial at w3schools.com on how to write a PHP define.

    The sample they provided looks simple enough:
    Code:
    <?php
    define("GREETING","Hello you! How are you today?");
    echo constant("GREETING");
    ?>
    But here are my questions:

    1. Where do I put the define?
    2. How do I determine what the define's value should be?

    I think that in order to understand what the define's value should be, I need to understand the logic behind the output (i.e. where will it appear so I can figure out what its supposed to say? what purpose is it serving?)
    Last edited by DivaVocals; 2 Apr 2012 at 06:29 PM.
    My Site
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  4. #24

    Default Re: Updating Mod for 150 - Little Problem

    *****Warning: Post typed as I wandered through my thought process. Please bear with me*****


    Ohhhh I see....the define you listed below tells the code which file to look in. I think I get it now!

    PHP Code:
    define('FILENAME_ORDER_EDIT''edit_orders.php'); 
    So, I would write it this way:

    PHP Code:
    define('FILENAME_RECENT_PRODUCTS''recent_products.php'); 
    But, as you said...there are several folders I could place such a file in (or several files I could add the define to). How do I determine how the define is being used in Zen Cart in order to determine where to place it?

    Since this mod has no class folder, no functions folder, no extra datafiles folder or an extra configures folder....How do I determine which of those is the best one to create for the new defines file?

    :::thinking:::: the file that calls this define is the one referenced in the error log: includes/templates/custom_template/templates/tpl_modules_recent_products.php. The code from that file which actually calls the define (if I understand all this correctly), is:

    PHP Code:
    include(DIR_WS_MODULES zen_get_module_directory(FILENAME_RECENT_PRODUCTS)); 
    So....I'm guessing here....the above include is telling zen cart what the name of the module is? And the define statement is telling zen cart which file some of that mod's code is in?

    Is that right? If so, I would think that adding the define statement to the language file would be appropriate?

    Doing so would change language/english/extra_definitions/recent_products.php file from:

    PHP Code:
    <?php

    // recently viewed sidebox title name
      
    define('BOX_HEADING_RECENTLY_VIEWED''Recently Viewed');

    ?>
    to

    PHP Code:
    <?php

    // recently viewed sidebox title name
      
    define('BOX_HEADING_RECENTLY_VIEWED''Recently Viewed');
      
    // define file name  
      
    define('FILENAME_RECENT_PRODUCTS''recent_products.php'); 

    ?>
    Is that right?


    Quote Originally Posted by DivaVocals View Post
    They usually go in a separate file.. Depending on the how it's being used in Zen Cart they could be in a language folder, a class folder, a functions folder, an extra datafiles folder or even an extra configures folder in Zen Cart.

    Do a search through your store using the developers toolkit (search for "define(") to look for existing examples to see how you would construct one.

    For Edit Orders there is one similar to what you are trying to do. From line 21 of admin/includes/extra_configures/edit_orders.php

    Code:
    define('FILENAME_ORDER_EDIT', 'edit_orders.php');
    Super Orders also uses a similar file to point links to the orders.php file
    Go that extra mile, you never know what's at the end of the road

    Empowerment Sanctuary

  5. #25
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    6,997
    Plugin Contributions
    27

    Default Re: Updating Mod for 150 - Little Problem

    I can't say that what you posted WON'T work, but it's not the way I would do it..

    I wouldn't put it in a language file because it's not a constant that is used to display text on screen anywhere (which is the purpose of the language files). If the constant being called is not part of a class or a function, then that's not where you'd put it either..

    Eliminating all of these, the extra_datafiles is probably the place I'D put it as it's not a constant related to a configuration item I wouldn't use the extra_configures folder, but you'd be better off waiting for someone more knowledgeable than I to confirm this. (BTW, the word "extra" in the folder name is a HINT that these are extra files usually related to a something that expands current functionality. (Again, someone can correct me on that too, it's how I always interpreted these folder names)

    Quote Originally Posted by ScriptJunkie View Post
    *****Warning: Post typed as I wandered through my thought process. Please bear with me*****


    Ohhhh I see....the define you listed below tells the code which file to look in. I think I get it now!

    PHP Code:
    define('FILENAME_ORDER_EDIT''edit_orders.php'); 
    So, I would write it this way:

    PHP Code:
    define('FILENAME_RECENT_PRODUCTS''recent_products.php'); 
    But, as you said...there are several folders I could place such a file in (or several files I could add the define to). How do I determine how the define is being used in Zen Cart in order to determine where to place it?

    Since this mod has no class folder, no functions folder, no extra datafiles folder or an extra configures folder....How do I determine which of those is the best one to create for the new defines file?

    :::thinking:::: the file that calls this define is the one referenced in the error log: includes/templates/custom_template/templates/tpl_modules_recent_products.php. The code from that file which actually calls the define (if I understand all this correctly), is:

    PHP Code:
    include(DIR_WS_MODULES zen_get_module_directory(FILENAME_RECENT_PRODUCTS)); 
    So....I'm guessing here....the above include is telling zen cart what the name of the module is? And the define statement is telling zen cart which file some of that mod's code is in?

    Is that right? If so, I would think that adding the define statement to the language file would be appropriate?

    Doing so would change language/english/extra_definitions/recent_products.php file from:

    PHP Code:
    <?php

    // recently viewed sidebox title name
      
    define('BOX_HEADING_RECENTLY_VIEWED''Recently Viewed');

    ?>
    to

    PHP Code:
    <?php

    // recently viewed sidebox title name
      
    define('BOX_HEADING_RECENTLY_VIEWED''Recently Viewed');
      
    // define file name  
      
    define('FILENAME_RECENT_PRODUCTS''recent_products.php'); 

    ?>
    Is that right?
    Last edited by DivaVocals; 2 Apr 2012 at 09:40 PM.
    My Site
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  6. #26

    Default Re: Updating Mod for 150 - Little Problem

    ahhhhh ok. I'll give that a shot and see if it works.

    If not, I'll report back here and see what suggestions others might have.

    And...as I've just realized that I completely forgot about final IH testing (SO SORRY), I'm going to go do that right now.


    Quote Originally Posted by DivaVocals View Post
    I can't say that what you posted WON'T work, but it's not the way I would do it..

    I wouldn't put it in a language file because it's not a constant that is used to display text on screen anywhere (which is the purpose of the language files). If the constant being called is not part of a class or a function, then that's not where you'd put it either..

    Eliminating all of these, the extra_datafiles is probably the place I'D put it as it's not a constant related to a configuration item I wouldn't use the extra_configures folder, but you'd be better off waiting for someone more knowledgeable than I to confirm this. (BTW, the word "extra" in the folder name is a HINT that these are extra files usually related to a something that expands current functionality. (Again, someone can correct me on that too, it's how I always interpreted these folder names)
    Go that extra mile, you never know what's at the end of the road

    Empowerment Sanctuary

  7. #27
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,428
    Plugin Contributions
    3

    Default Re: Updating Mod for 150 - Little Problem

    Should add there is a syntax error somewhere in

    /includes/modules/recent_products.php

    or at least thats what dreamweavers syntax checker tells me

    apparently its the very last line, which tends to mean there is an errant brace or something somewhere above

    I also get the above error id I add an extra datafile with this in it

    define('FILENAME_RECENT_PRODUCTS_MODULE', 'recent_products.php');

    I note you aren't using the MODULE bit, if i don't use that i just get the old error you mentioned
    Last edited by nigelt74; 3 Apr 2012 at 01:32 AM.
    Nigel
    Webzings Design
    The last couple of Zen-Cart sites we have worked on, Darncat Designs, Sweet Brucies

  8. #28
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    20,981
    Plugin Contributions
    25

    Default Re: Updating Mod for 150 - Little Problem

    the extra_datafiles is probably the place I'D put it
    Not that I'm an expert on the filesystem either, but that makes the most sense to me. It would be "easier" to put all the defines in one (language) file for this small mod, but that wouldn't really be treating the different defines properly.

  9. #29
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,428
    Plugin Contributions
    3

    Default Re: Updating Mod for 150 - Little Problem

    /includes/modules/recent_products.php

    bah humbug

    has

    14 {
    11 }

    no wonder there are syntax errors!!!
    Nigel
    Webzings Design
    The last couple of Zen-Cart sites we have worked on, Darncat Designs, Sweet Brucies

  10. #30
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,428
    Plugin Contributions
    3

    Default Re: Updating Mod for 150 - Little Problem

    Ok I think i may have it working, well sort of. I am still not sure I have added the braces in the correct places

    and it is saying "featured products" rather than "recently viewed"

    go here and have a look at various products and the recently viewed should appear both below and in the sidebox

    http://grumpykiwi.com/
    Nigel
    Webzings Design
    The last couple of Zen-Cart sites we have worked on, Darncat Designs, Sweet Brucies

 

 
Page 3 of 7 FirstFirst 12345 ... LastLast

Similar Threads

  1. CSS updating problem!
    By Magik in forum Basic Configuration
    Replies: 5
    Last Post: 11 Jan 2010, 03:24 AM
  2. Downloads Updating Problem
    By Rasyr in forum Bug Reports
    Replies: 1
    Last Post: 18 Jan 2008, 07:12 PM
  3. problem with updating status
    By snarkys in forum Built-in Shipping and Payment Modules
    Replies: 11
    Last Post: 13 Jan 2007, 02:50 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
  •