Zen Cart Logo
Forums / Bug Reports / Constants not defined in adminincludesfunctionsgeneral.php

Constants not defined in adminincludesfunctionsgeneral.php

Views: 5,940

Results 1 to 2 of 2
13 Mar 2019, 1:20 PM
#1
vasilt avatar

vasilt

New Zenner

Join Date:
Jan 2006
Posts:
44
Plugin Contributions:
0

Constants not defined in adminincludesfunctionsgeneral.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: ```
define('TEXT_ATTRIBUTE_COPY_INSERTING','<strong>Inserting New Attribute from </strong>');

The log file says:
/admin/category_product_listing.php?action=copy_product_confirm&cPath=54_125_126_128&page=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:```
 $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

13 Mar 2019, 9:56 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Constants not defined in adminincludesfunctionsgeneral.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_By_Attributes_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.