If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Bug Reports / [Beta] Call to undefined function zen_has_product_specials() in copy_product.php

[Beta] Call to undefined function zen_has_product_specials() in copy_product.php

Started by mprough on 14 May 2024, 6:31 PM · Views: 962

Results 1 to 8 of 8
14 May 2024, 6:31 PM
#1
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,336
Plugin Contributions:
41

[Beta] Call to undefined function zen_has_product_specials() in copy_product.php

More than one installation with the error

Zen Cart 2.0
Boot 3.6.4
OPC 2.5.1
PHP 8.3.6
MySQL 8.0.37

[14-May-2024 18:24:18 UTC] Request URI: /XXX/index.php?cmd=category_product_listing&cPath=171&product_type=1&pID=8077&action=copy_product&page=1, IP address: 134.215.175.155
--> PHP Fatal error: Uncaught Error: Call to undefined function zen_has_product_specials() in /home/XXX/public_html/XXX/includes/modules/copy_product.php:60
Stack trace:
#0 /home/XXX/public_html/XXX/category_product_listing.php(1165): require()
#1 /home/XXX/public_html/XXX/index.php(11): require('/home/XXX/pu...')
#2 {main}
thrown in /home/XXX/public_html/XXX/includes/modules/copy_product.php on line 60.

[14-May-2024 18:24:18 UTC] Request URI: /XXX/index.php?cmd=category_product_listing&cPath=171&product_type=1&pID=8077&action=copy_product&page=1, IP address: 134.215.175.155
--> PHP Fatal error: Uncaught Error: Call to undefined function zen_has_product_specials() in /home/XXX/public_html/XXX/includes/modules/copy_product.php:60
Stack trace:
#0 /home/XXX/public_html/XXX/category_product_listing.php(1165): require()
#1 /home/XXX/public_html/XXX/index.php(11): require('/home/XXX/pu...')
#2 {main}
thrown in /home/XXX/public_html/XXX/includes/modules/copy_product.php on line 60.

14 May 2024, 6:43 PM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: [Beta] Call to undefined function zen_has_product_specials() in copy_product.php

You should have a file

admin/includes/init_includes/init_general_funcs.php

that contains:

require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_products.php';

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

14 May 2024, 7:00 PM
#3
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,336
Plugin Contributions:
41

Re: [Beta] Call to undefined function zen_has_product_specials() in copy_product.php

swguy:

You should have a file

admin/includes/init_includes/init_general_funcs.php

that contains:

require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_products.php';

I do

<?php /** * @copyright Copyright 2003-2024 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: DrByte 2024 Mar 22 Modified in v2.0.0 $ */ if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } // customization for the design layout define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125) require 'includes/init_includes/init_pci_settings.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'database.php'; require DIR_WS_FUNCTIONS . 'general.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_general_shared.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_attributes.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_files.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_traffic.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_strings.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_search.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_addresses.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_dates.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_products.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_categories.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_prices.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_taxes.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_gvcoupons.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_customers.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_customer_groups.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_lookups.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_urls.php'; require DIR_WS_FUNCTIONS . 'html_output.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_email.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'functions_ezpages.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'plugin_support.php'; require DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'password_funcs.php'; /** * meta-tag editing functions */ require DIR_WS_FUNCTIONS . 'functions_metatags.php'; // include the list of extra functions foreach (zen_get_files_in_directory(DIR_WS_FUNCTIONS . 'extra_functions') as $file) { require $file; } if (isset($_GET) & sizeof($_GET) > 0 ) { foreach ($_GET as $key=>$value) { $_GET[$key] = strip_tags($value); } } // check for SSL configuration changes: if (!defined('SSLPWSTATUSCHECK')) die('database upgrade required. please run the 1.3.9-to-1.5.0 upgrade via zc_install'); $e = (substr(HTTP_SERVER, 0, 5) == 'https') ? '1' : '0'; if (SSLPWSTATUSCHECK == '') { $sql = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = '".$e.':'.$e."', last_modified = now() where configuration_key = 'SSLPWSTATUSCHECK'"; $db->Execute($sql); die('<meta http-equiv="Refresh" content="0">One-time auto-configuration completed. Please refresh the page.'); } list($a, $c) = explode(':', SSLPWSTATUSCHECK); $a = (int)$a; $c = (int)$c; if ($a == 0) { if ($c == 0 && $e == 1) { // was nonSSL but now is SSL, so need to exp pwds $sql = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = '1:" . $e . "', last_modified = now() where configuration_key = 'SSLPWSTATUSCHECK'"; $db->Execute($sql); $sql = "UPDATE " . TABLE_ADMIN . " set pwd_last_change_date = '1990-01-01 14:02:22'"; $db->Execute($sql); } if ($c == 1 && $e == 0) { // was nonSSL then SSL and now nonSSL again, so recording that we're now nonSSL $sql = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = '0:". $e . "', last_modified = now() where configuration_key = 'SSLPWSTATUSCHECK'"; $db->Execute($sql); } } else if ($a == 1) { // == 1 if ($c == 1 && $e == 0) { // was SSL, but is now nonSSL, so recording the change $sql = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = '0:". $e . "', last_modified = now() where configuration_key = 'SSLPWSTATUSCHECK'"; $db->Execute($sql); } if ($c == 0 && $e == 1) { // was changed to SSL last time checked, so recording that is all SSL now $sql = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = '1:" . $e . "', last_modified = now() where configuration_key = 'SSLPWSTATUSCHECK'"; $db->Execute($sql); } } unset($a,$c,$e); // end ssl config change detection

yep

14 May 2024, 7:08 PM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: [Beta] Call to undefined function zen_has_product_specials() in copy_product.php

I'm stumped. Copy product with product type 1 works for me in ZC 2.0.0/PHP8.3. Let's see if someone else can reproduce it.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

14 May 2024, 7:13 PM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: [Beta] Call to undefined function zen_has_product_specials() in copy_product.php

How about the sites' /includes/functions/functions_products.php. For the zc200 release, lines 838-849 contain

/**
 * Check if a product in the catalogue has a special price defined or not.
 *
 * @param int $product_id
 * @return boolean
 */
function zen_has_product_specials(int $product_id): bool
{
    global $db;
    $result = $db->Execute('SELECT products_id FROM ' . TABLE_SPECIALS . " WHERE products_id = $product_id", 1);
    return !$result->EOF;
}
15 May 2024, 6:27 AM
#6
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,336
Plugin Contributions:
41

Re: [Beta] Call to undefined function zen_has_product_specials() in copy_product.php

Verified replacing the file fixes the issue. It is the beta release was the reason why

15 May 2024, 10:38 AM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: [Beta] Call to undefined function zen_has_product_specials() in copy_product.php

You may want to double check all your files in that case to make sure you have the final 2.0.0 fileset.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

15 May 2024, 10:41 AM
#8
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,336
Plugin Contributions:
41

Re: [Beta] Call to undefined function zen_has_product_specials() in copy_product.php

swguy:

You may want to double check all your files in that case to make sure you have the final 2.0.0 fileset.

Wasn't my build, but upgrading it =)