Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2012
    Posts
    132
    Plugin Contributions
    0

    Default After upgrade from 1.5.2 various problems

    ZC 1.5.8 Php7.41 Nginx Mariadb 10.4x

    Hi,
    first some background information:
    I live outside US and servers date time format is ddmmyy.
    Also I have only 1 language in zen cart and it is not english (finnish)

    First when I upgraded to 1.5.8 all the categories did not show up at all. When I removed english language pack and put the sort order of the finnish language back similar than before the upgrade to 0 they showed up in admin and in old public template. I wonder is this related to old database structure or errors somewhere else?

    Second error I stumbled is following:
    Code:
    29-Nov-2022 02:05:06 Europe/Helsinki] Request URI: /testikauppa/adminx/index.php?cmd=product&cPath=5220&action=insert_product, IP address: 37.33.xxx.xxx
    --> PHP Fatal error: Uncaught Error: Call to undefined function convertToFloat() in /home/admin/web/94.xxx.xxx.xxx/public_html/testikauppa/admin/includes/modules/update_product.php:38
    So why this function is not defined anywhere? I managed to publish a product by replacing convertToFloat() function with simple float() and removing last sanitizing function on the file all together.

    Below is the code if somebody is as desperate and gets same error but I do not recommend to use it on a production site

    MOdified /admin/includes/modules/update_product.php :
    Code:
    <?php
    
    /**
     * @copyright Copyright 2003-2020 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: Scott C Wilson 2020 Apr 13 Modified in v1.5.7 $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    if (isset($_GET['pID'])) {
      $products_id = zen_db_prepare_input($_GET['pID']);
    }
    if (isset($_POST['edit']) && $_POST['edit'] == 'edit') {
      $action = 'new_product';
    } elseif ((isset($_POST['products_model']) ? $_POST['products_model'] : '') . (isset($_POST['products_url']) ? implode('', $_POST['products_url']) : '') . (isset($_POST['products_name']) ? implode('', $_POST['products_name']) : '') . (isset($_POST['products_description']) ? implode('', $_POST['products_description']) : '') != '') {
      $products_date_available = zen_db_prepare_input($_POST['products_date_available']);
      if (DATE_FORMAT_DATE_PICKER != 'yy-mm-dd') {
        $local_fmt = zen_datepicker_format_fordate(); 
       
       $dt = DateTime::createFromFormat($local_fmt, $products_date_available); 
        $products_date_available = 'null';
        if (!empty($dt)) {
            $products_date_available = $dt->format('Y-m-d');
        }
       
       // $dt = DateTime::createFromFormat($local_fmt, $products_date_available); 
      //  $products_date_available = $dt->format('Y-m-d'); 
      }
      $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';
    
      // Data-cleaning to prevent data-type mismatch errors:
      $sql_data_array = array(
        'products_quantity' => (float)($_POST['products_quantity']),
        'products_type' => (int)$_POST['product_type'],
        'products_model' => zen_db_prepare_input($_POST['products_model']),
        'products_price' => (float)($_POST['products_price']),
        'products_date_available' => $products_date_available,
        'products_weight' => (float)($_POST['products_weight']),
        'products_status' => (int)$_POST['products_status'],
        'products_virtual' => (int)$_POST['products_virtual'],
        'products_tax_class_id' => (int)$_POST['products_tax_class_id'],
        'manufacturers_id' => (int)$_POST['manufacturers_id'],
        'products_quantity_order_min' => (float)($_POST['products_quantity_order_min']) == 0 ? 1 : (float)($_POST['products_quantity_order_min']),
        'products_quantity_order_units' => (float)($_POST['products_quantity_order_units']) == 0 ? 1 : (float)($_POST['products_quantity_order_units']),
        'products_priced_by_attribute' => (int)$_POST['products_priced_by_attribute'],
        'product_is_free' => (int)$_POST['product_is_free'],
        'product_is_call' => (int)$_POST['product_is_call'],
        'products_quantity_mixed' => (int)$_POST['products_quantity_mixed'],
        'product_is_always_free_shipping' => (int)$_POST['product_is_always_free_shipping'],
        'products_qty_box_status' => (int)$_POST['products_qty_box_status'],
        'products_quantity_order_max' => (float)($_POST['products_quantity_order_max']),
        'products_sort_order' => (int)$_POST['products_sort_order'],
        'products_discount_type' => (int)$_POST['products_discount_type'],
        'products_discount_type_from' => (int)$_POST['products_discount_type_from'],
        //BOF perfectus-221024
    							//BOF Products Family
                  'products_family' => zen_db_prepare_input($_POST['products_family']),
                  //EOF Products Family
    //EOF perfectus-221024
        'products_price_sorter' => (float)($_POST['products_price_sorter']),
      );
    
      $db_filename = zen_limit_image_filename($_POST['products_image'], TABLE_PRODUCTS, 'products_image');
      $sql_data_array['products_image'] = zen_db_prepare_input($db_filename);
      $new_image = 'true';
    
      // when set to none remove from database
      // is out dated for browsers use radio only
      if (isset($_POST['image_delete']) && $_POST['image_delete'] == '1') {
        $sql_data_array['products_image'] = '';
        $new_image = 'false';
      }
    
      if ($action == 'insert_product') {
        $sql_data_array['products_date_added'] = 'now()';
        $sql_data_array['master_categories_id'] = (int)$current_category_id;
    
        zen_db_perform(TABLE_PRODUCTS, $sql_data_array);
        $products_id = zen_db_insert_id();
    
        // reset products_price_sorter for searches etc.
        zen_update_products_price_sorter($products_id);
    
        $db->Execute("INSERT INTO " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id)
                      VALUES (" . (int)$products_id . ", " . (int)$current_category_id . ")");
    
        zen_record_admin_activity('New product ' . (int)$products_id . ' added via admin console.', 'info');
    
        ///////////////////////////////////////////////////////
        //// INSERT PRODUCT-TYPE-SPECIFIC *INSERTS* HERE //////
        ////    *END OF PRODUCT-TYPE-SPECIFIC INSERTS* ////////
        ///////////////////////////////////////////////////////
      } elseif ($action == 'update_product') {
        $sql_data_array['products_last_modified'] = 'now()';
        $sql_data_array['master_categories_id'] = (!empty($_POST['master_category']) && (int)$_POST['master_category'] > 0 ? (int)$_POST['master_category'] : (int)$_POST['master_categories_id']);
    
        zen_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = " . (int)$products_id);
    
        zen_record_admin_activity('Updated product ' . (int)$products_id . ' via admin console.', 'info');
    
        // reset products_price_sorter for searches etc.
        zen_update_products_price_sorter((int)$products_id);
    
        ///////////////////////////////////////////////////////
        //// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////
    
    
        ////    *END OF PRODUCT-TYPE-SPECIFIC UPDATES* ////////
        ///////////////////////////////////////////////////////
      }
    
      $languages = zen_get_languages();
      for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
        $language_id = $languages[$i]['id'];
    
        $sql_data_array = array(
          'products_name' => zen_db_prepare_input($_POST['products_name'][$language_id]),
          'products_description' => zen_db_prepare_input($_POST['products_description'][$language_id]),
          'products_url' => zen_db_prepare_input($_POST['products_url'][$language_id]));
    
        if ($action == 'insert_product') {
          $insert_sql_data = array(
            'products_id' => (int)$products_id,
            'language_id' => (int)$language_id);
    
          $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
    
          zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
        } elseif ($action == 'update_product') {
          zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = " . (int)$products_id . " and language_id = " . (int)$language_id);
        }
      }
    
      $zco_notifier->notify('NOTIFY_MODULES_UPDATE_PRODUCT_END', array('action' => $action, 'products_id' => $products_id));
    
      zen_redirect(zen_href_link(FILENAME_CATEGORY_PRODUCT_LISTING, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_POST['search']) ? '&search=' . $_POST['search'] : '')));
    } else {
      $messageStack->add_session(ERROR_NO_DATA_TO_SAVE, 'error');
      zen_redirect(zen_href_link(FILENAME_CATEGORY_PRODUCT_LISTING, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_POST['search']) ? '&search=' . $_POST['search'] : '')));
    }
    
    /**
     * NOTE: THIS IS HERE FOR BACKWARD COMPATIBILITY. The function is properly declared in the functions files instead.
     * Convert value to a float -- mainly used for sanitizing and returning non-empty strings or nulls
     * @param int|float|string $input
     * @return float|int
     */

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

    Default Re: After upgrade from 1.5.2 various problems

    PLEASE EVERYONE, do NOT do what is suggested above.

    Quote Originally Posted by OopsIbrickedIT View Post
    ...

    Second error I stumbled is following:
    Code:
    29-Nov-2022 02:05:06 Europe/Helsinki] Request URI: /testikauppa/adminx/index.php?cmd=product&cPath=5220&action=insert_product, IP address: 37.33.xxx.xxx
    --> PHP Fatal error: Uncaught Error: Call to undefined function convertToFloat() in /home/admin/web/94.xxx.xxx.xxx/public_html/testikauppa/admin/includes/modules/update_product.php:38
    So why this function is not defined anywhere?....
    the correct question is why this function is not defined or loaded in your install.

    when i look here, i see the function convertToFloat.

    so either you have not uploaded that file or that file is not getting loaded doing what you are doing.

    but the function is defined.

    please, stop bricking it and blaming others.

    best.
    mxWorks now has premium plugins
    are you using square? have you shown any appreciation with cake on venmo or on paypal?
    called the savior by the chief bottle washer...

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

    Default Re: After upgrade from 1.5.2 various problems

    Kippis!

    Yes, it appears there were issues with completing the upgrade. While you found a temporary fix and there is definitely a permanent solution, it seems like it may help you most for you to describe how you got to the current condition. For example, had zc_install been executed to update the database before logging into the admin, what was the process used to perform the upgrade, basically address as many of the aspects of the posting tips as possible. Use as few or many words as necessary to describe.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Mar 2012
    Posts
    132
    Plugin Contributions
    0

    Default Re: After upgrade from 1.5.2 various problems

    Quote Originally Posted by carlwhat View Post
    PLEASE EVERYONE, do NOT do what is suggested above.



    the correct question is why this function is not defined or loaded in your install.

    when i look here, i see the function convertToFloat.

    so either you have not uploaded that file or that file is not getting loaded doing what you are doing.

    but the function is defined.

    please, stop bricking it and blaming others.

    best.
    Sorry carlwhat, I had no intention to blame anybody. I downloaded the package right after 1.5.8 was released and unzipped in my local machine and only reason why this one of the most crucial include files was gotten lost must be silly me. On the contrary I think 1.5.8 release is a fine improvement to zc as I have earlier stated. One of my external hard drive broke and I would seen right away this if version controlling would have been in use.

    Lesson learned, do not do anything without some sort version control & hash file integrity checking

    As I stated earlier the above postings hack is NOT TO BE USED IN PRODUCTION (& ANYWHERE) I just used it once to get few products published to check template settings are working & 1 customer payment tested in real environment.

  5. #5
    Join Date
    Mar 2012
    Posts
    132
    Plugin Contributions
    0

    Default Re: After upgrade from 1.5.2 various problems

    Quote Originally Posted by mc12345678 View Post
    Kippis!

    Yes, it appears there were issues with completing the upgrade. While you found a temporary fix and there is definitely a permanent solution, it seems like it may help you most for you to describe how you got to the current condition. For example, had zc_install been executed to update the database before logging into the admin, what was the process used to perform the upgrade, basically address as many of the aspects of the posting tips as possible. Use as few or many words as necessary to describe.
    Kippis! = Cheers! MC12345678

    I did the installation procedure normally and database upgrade went flawlessly except I had to add few table fields which are not related to missing file problem as stated above (missing /includes/functions/functions_general_shared.php file) . I uploaded completely latest Github 1.5.8 version to server and can confirm that on nginx + php 7.41 + Mariadb 10.4 ZC Log file has 0 errors now and only warnings are related to template missing language files which are caused lack of time & health on my part, nothing problems anymore related to ZC. I just must make new template much faster & try to get whole bunch old plugin functionalities working on at least php 7.4 and in near future on php 8

    So all good

 

 

Similar Threads

  1. v154 various things not working properly after upgrade
    By DarkAngel in forum General Questions
    Replies: 32
    Last Post: 26 Jun 2015, 12:33 PM
  2. Two problems after upgrade from 1.3.9c to d
    By justin2010 in forum Upgrading from 1.3.x to 1.3.9
    Replies: 4
    Last Post: 12 Jun 2010, 04:01 AM
  3. couple of problems after upgrade
    By allyouneedislove in forum Upgrading from 1.3.x to 1.3.9
    Replies: 1
    Last Post: 3 Feb 2009, 11:36 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