Forums / Upgrading to 1.5.x / 1.3.8 to 1.5.1 -- extra manufacturing fields and category fields not saving...

1.3.8 to 1.5.1 -- extra manufacturing fields and category fields not saving...

Views: 1,573

Results 1 to 2 of 2
10 Sep 2013, 7:15 PM
#1
branninggroup avatar

branninggroup

New Zenner

Join Date:
Apr 2008
Posts:
3
Plugin Contributions:
2

1.3.8 to 1.5.1 -- extra manufacturing fields and category fields not saving...

We are updating a heavily modified version of zencart 1.3.8 to 1.5.1. We have managed to get all the modules and plugins working again, with the exception of a few extra fields in the manufacturers_info table and categories_description table...

We have edited the following of the 1.5.1 manufacturers page:

$manufacturers_url_array = $_POST['manufacturers_url'];
          $language_id = $languages[$i]['id'];
          $sql_data_array = array('manufacturers_url' => zen_db_prepare_input($manufacturers_url_array),
		  							'manufacturers_description'	=>	zen_db_prepare_input($_POST['manufacturers_description']),
		  							'manufacturers_products_description'	=>	zen_db_prepare_input($_POST['manufacturers_products_description'])
									);
          if ($action == 'insert') {
           $insert_sql_data = array('manufacturers_id' => $manufacturers_id,
                                     'languages_id' => $language_id);
            $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
            zen_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array);
          } elseif ($action == 'save') {
            zen_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array, 'update', "manufacturers_id = '" . (int)$manufacturers_id . "' and languages_id = '" . (int)$language_id . "'");
          }

The original fields are saving correctly, and the data from the DB is being put into the new field text area's correctly, but we cannot change the new fields at all. We have changed a few area's to get this working, so if you need another snippet of code let me know. The information is being passed from the form via POST correctly (with the above var names etc)

10 Sep 2013, 9:09 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: 1.3.8 to 1.5.1 -- extra manufacturing fields and category fields not saving...

The code snippet you posted is originally inside a loop for multiple languages, but you didn't include the loop part in your snippet.

In the case of languages, there are sub-elements added for each language, even if you've only got 1 language on the site.

So, you're missing some code:

          $sql_data_array = array('manufacturers_url' => zen_db_prepare_input($manufacturers_url_array[B][$language_id][/B]));

And, your subsequent custom fields have no [$language_id] element selected either, thus suggesting that you might be hacking out multiple-language support in some but not all places. ie ... you're probably also not accommodating that properly later in the file where it loops thru languages to output the input fields.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.