Results 1 to 9 of 9
  1. #1
    Join Date
    Dec 2008
    Location
    Pittsburgh, PA
    Posts
    237
    Plugin Contributions
    1

    Default best way to include/require php file w/ zen_get_products_name( function

    I'm working on a custom report in the admin to list in a table links to products that have no pictures or have "no_image.jpg" as the image name...

    basically every time I try something like:
    Code:
    require(DIR_WS_FUNCTIONS . 'general.php');  //for zen_get_products_name
    include DIR_FS_CATALOG . 'includes/functions/functions_lookups.php'; //for zen_get_products_name
    i get... PHP Fatal error: Cannot redeclare ... some function

    I do start my php file with...

    require('includes/application_top.php');

    aside from the ol' copy n' paste how can I include/require this function?

    I should probably just spend some time reading through wiki developers api, but haven't yet, if anyone has an advised reading in that feel free to suggest it.

    Thanks,
    b

  2. #2
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: best way to include/require php file w/ zen_get_products_name( function

    And the log file, what does it say?

    Also, have you considered using EP4 to export , and with libreoffice calc or Excel , filter the images by "no-image.jpg" ?
    If that's the intention, its much easier to filter , work the the missing images, and reupload / update the products.
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

  3. #3
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: best way to include/require php file w/ zen_get_products_name( function

    The zen_get_products_name function is already accessible to the admin and needs no further include/require. So in this case, the answer to the question is what has already been done: includes/require includes/application_top.php

    You can also use the admin's tools->developer's toolkit to search the admin side for the function's use on the admin side for such situations to see if/how it was implemented.

    As mesnitu suggested there are multiple ways to go about it, even if to take a plugin that looks for product that have an image link to a non-existent image and in a way reversing the logic. Instead of collecting all of the images, collect all of the product...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Dec 2008
    Location
    Pittsburgh, PA
    Posts
    237
    Plugin Contributions
    1

    Default Re: best way to include/require php file w/ zen_get_products_name( function

    I use EasyPopulate, and that is a totally acceptable way to do what I'm trying to do, but I'm sadistic and trying to learn to code better. (:

    Plus I'm creating a one page "errant products" report that runs various queries like if cost is greater than price, etc.

    So if I add
    include DIR_FS_CATALOG . 'includes/functions/functions_lookups.php'; //for zen_get_products_name

    i get...

    PHP Fatal error: Cannot redeclare zen_get_countries() (previously declared in /home/content/blah/blah/html/admin/includes/functions/general.php:822

    PHP Fatal error: Cannot redeclare zen_redirect() (previously declared in /blahblahblah/admin/includes/functions/general.php:12

  5. #5
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: best way to include/require php file w/ zen_get_products_name( function

    Not sure if you missed my post or if it was confusing.If the function you are wanting to use is zen_get_products_name, then you *only* need to include "includes/application_top.php" prior to calling it.If there is some other function desired to be used, then please either identify the function or the desired result to be obtained.As for the admin's general.php function file, that is already included (along with all of the other ZC default function files found in admin/includes/functions). That means you do not need to uniquely include that or any other default ZC admin function file...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Dec 2008
    Location
    Pittsburgh, PA
    Posts
    237
    Plugin Contributions
    1

    Default Re: best way to include/require php file w/ zen_get_products_name( function

    If I don't include anything I get...

    PHP Fatal error: Call to undefined function zen_get_info_page()

    which is defined in includes/functions/functions_lookups.php

  7. #7
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: best way to include/require php file w/ zen_get_products_name( function

    Code:
    $product_info_page = zen_get_handler_from_type(zen_get_products_type((int)$pID)) . '_info';
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: best way to include/require php file w/ zen_get_products_name( function

    "list in a table links to products that have no pictures or have "no_image.jpg"
    You may be re-inventing the wheel:
    https://github.com/torvista/Image-Checker
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  9. #9
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,669
    Plugin Contributions
    11

    Default Re: best way to include/require php file w/ zen_get_products_name( function

    Quote Originally Posted by wolfderby View Post
    If I don't include anything I get...

    PHP Fatal error: Call to undefined function zen_get_info_page()

    which is defined in includes/functions/functions_lookups.php
    welcome to the wonderful world of ZC functions.

    you are working on a custom report on the admin side. the undefined function is on the catalog side. some functions are only on 1 side, and not the other; some functions are the same; and some functions with the same name are different on both sides. oy!

    you need to figure out which functions from the catalog side you need and somehow only include those.... or some other coding hocus pocus...

    this is an issue that will hopefully get resolved in future releases of ZC.

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

 

 

Similar Threads

  1. What would be the best way to include WordPress?
    By Drachsi in forum General Questions
    Replies: 9
    Last Post: 27 Mar 2013, 10:37 PM
  2. Error MessageWarning: require(includes/application_top.php) [function.require]: faile
    By valbuhagiar in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 31 Oct 2011, 07:44 PM
  3. HELP! INCLUDE or REQUIRE function for new file
    By liugenping in forum General Questions
    Replies: 1
    Last Post: 8 Oct 2011, 02:10 PM
  4. Need to include a ssi function in a sidbox (basic PHP)
    By dieter in forum General Questions
    Replies: 1
    Last Post: 26 Sep 2007, 07:47 AM
  5. Replies: 3
    Last Post: 4 Oct 2006, 07:29 PM

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