Zen Cart Logo
Forums / Bug Reports / 2nd language problem with new and update product

2nd language problem with new and update product

Locked

Views: 1,937

Results 1 to 1 of 1
This thread is locked. New replies are disabled.
2 Aug 2006, 12:19 PM
#1
donnerkul avatar

donnerkul

New Zenner

Join Date:
Aug 2006
Posts:
10
Plugin Contributions:
0

2nd language problem with new and update product

I use Zen Cart 1.3.0.2 and I today I entered into two language mode. Using the admin add or update product feature caused some problems, when fields like manuafcture Products URL: where empty. In that case the second language field was populated with the word Array. The same thing happend to description and to filename. It took me quite a while before I found out that the value posted was seen by php as a 1-Dimension-Array with only 1 value. So assigning it directly to a text-variable cause the problem.

I found a solution which is right now doing the job, but as I am not realy a php maniac, there might be a better and more standard solution:

Here is my solution for /shop/admin/include/modules/update_product.php using an if is_array
(around line 80)

      ///////////////////////////////////////////////////////
      //// 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((is_array($_POST['products_description'][$language_id]) ? $_POST['products_description'][$language_id][0] : $_POST['products_description'][$language_id])),
		      //$_POST['products_description'][$language_id]),
			      'products_url' => zen_db_prepare_input(is_array($_POST['products_url'][$language_id]) ? $_POST['products_url'][$language_id][0] : $_POST['products_url'][$language_id]));

      

Any comment and more: any better solution is very welcome....