Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006
    Posts
    39
    Plugin Contributions
    1

    Default Constants not defined in admin\includes\functions\general.php

    While copying products with attributes in admin, the message that shows on top of the screen after successful operation does not display the constant defined on line 146 in attributes_controller.php:
    Code:
    define('TEXT_ATTRIBUTE_COPY_INSERTING','<strong>Inserting New Attribute from </strong>');
    but the constant name itself e.g. "TEXT_ATTRIBUTE_COPY_INSERTING2881 for Products ID#495".
    The log file says:
    /admin/category_product_listing.php?action=copy_product_confirm&cPath=54_125_126_128&pa ge=1, IP address: ********
    #1 zen_copy_products_attributes() called at [/admin/includes/modules/copy_product_confirm.php:141]
    #2 require(/admin/includes/modules/copy_product_confirm.php) called at [/admin/category_product_listing.php:278]
    --> PHP Warning: Use of undefined constant TEXT_ATTRIBUTE_COPY_INSERTING - assumed 'TEXT_ATTRIBUTE_COPY_INSERTING' (this will throw an Error in a future version of PHP) in /admin/includes/functions/general.php on line 2201.

    What I did, that seemed to rectify the problem, at least no more log entries, was to move the define statement mentioned above in the language file: admin\includes\languages\english.php. However there are other constants which again are declared in the attributes_controller.php file and once the application flow reaches them there might be another error.
    What I noticed was that there are messages that are hard coded in /admin/includes/functions/general.php, e.g. line 2116:
    Code:
     $messageStack->add_session('<b>WARNING: Cannot copy from Product ID #' . $products_id_from . ' to Product ID # ' . $products_id_to . ' ... No copy was made' . '</b>', 'caution');
    This seems to contradict the multi-language nature of zencart.
    Any feedback will be appreciated.
    Zencart version:1.5.6a
    PHP Version: 7.3.1
    Database Engine: MySQL 5.6.42-84.2

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

    Default Re: Constants not defined in admin\includes\functions\general.php

    Regarding the define as it relates to stock by attributes, I'll have to look at how best to incorporate it if the version in question is the same as provided at: https://github.com/mc12345678/Stock_...butes_Combined. There were changes made to the attributes controller that may have effected the previous operations in the area of taking alternate action.

    As to the hard coded text, I don't specifically have an answer but would say that with the level of rework that was done on this area, it is not a surprise that this aspect remained as it was before. Additionally, changing this area should be done with care to ensure that regardless the sentence structure of the associated language no code change in this area would be required to accommodate the other language(s).

    A little further review of the above log file and it looks like the define would be best placed in the file for category_product_listing.php file or as an extra_definition of some type.
    Last edited by mc12345678; 13 Mar 2019 at 11:02 PM.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. Replies: 7
    Last Post: 7 Jul 2015, 05:54 PM
  2. v151 admin/includes/functions/compatibility.php
    By makenoiz in forum Upgrading to 1.5.x
    Replies: 6
    Last Post: 11 Dec 2012, 11:53 PM
  3. /admin/includes/functions/general.php not in my files
    By suzijohn in forum Upgrading from 1.3.x to 1.3.9
    Replies: 1
    Last Post: 9 Jan 2011, 11:32 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