Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help - V2.3.1 Cannot insert new Option Values in production environment


DirkTromp

Recommended Posts

L.S.

 

I migrated a new V2.3.1 shop from my MAC development environment to a Linux operational environment.

Code and database succesfully brought accross.

 

I have Product Option features with Product Attribute Clone tool integrated in the code.

 

On my MAC I can add new "Option Values" in the Admin/Product Atttributes section.

In the operational environment I cannot do this. The "Insert" button (and therefore the "form" action has no effect). I cannot add new option/value pairs.

Removal or editing in the same sub-pane works!

Otherwise all editing, addition or removal works in the other 2 panes.

 

Can anyone help me trace or solve this issue?

(Although I have come a long way in integrating add-ons, customising and adpating the code, I am not yet fully conversant in osC or all of PHP/MySQL)

 

P.S. I have recompared the code transported from the MAC to production. Files are identical.

Link to comment
Share on other sites

So you are working on a MAC to do this? You tested it on a PC?

 

Is it using AJAX?

 

Hi Kym (sorry i misspelled your name earlier),

 

I don't think this portion is using AJAX but I am not sure. Does the admin section use Ajax to POST and GET data? I thought tese were pure PHP calls using the in-built "tep_" functions?

 

Development side -> On the MAC is works just fine. Client is on MAC ans so is the Server (MAMP).

 

Production side -> On a hosted Linux server. Clients both from Windows7 or form the MAC, irrespective of browsers, all give the same result.

I cannot get the Options Values pane in the admin/product attributes to "insert" new values.

I can "delete" or "edit" existing entries.

 

I have just added wireshark to both my MAC and my Windows PC and traced the HTTP calls to the servers. On both systems (on the MAC to the local MAMP server, and on the Windows client to the remote Linux hosted server) both give the same POST traces. I can see the packets with the data going to the server.

 

For some reason it looks like the packet is not being processed on the Linux Hosted (operational server) and therefore not being inserted into the database. It is being processed on the MAC MAMP development server (local).

Link to comment
Share on other sites

I don't know the speicifc Add On you talked about. But I was just thinking back to a problem we once had with product attributes maintained on the product page in Admin (LInux server). The client always used MACs and I think once they had a lot of attributes they started getting a browser related problem. This was why I was asking. I was thinking it was an environmental more than code problem.

 

Is there anything showing in your Admin error_log?

Link to comment
Share on other sites

If there is one it would be in the admin folder in a file called error_log

 

Haven't seen it and can't find it.

The only place I have seen an error log an which had entries on the local MAC instalation was in my catalog/includes/.. directory.

This hasn't had any additional entries since I moved everything accross to the production Linux server.

Link to comment
Share on other sites

It maybe that no admin errors have been generated. The file is only created on an error. They are handy to view. And they are created in any folder an error can be triggered. Main one is directly under public_html and it is a good idea to have a look at it now and again to see what errors are occuring. If you never have one turn out it is unusual (even 404 will generate an entry unless the site handles it itself) you might want to ask your hosting about it.

 

Back to your issue, I am at a loss.

 

Which Add On did you use for this clone feature?

Link to comment
Share on other sites

It maybe that no admin errors have been generated. The file is only created on an error. They are handy to view. And they are created in any folder an error can be triggered. Main one is directly under public_html and it is a good idea to have a look at it now and again to see what errors are occuring. If you never have one turn out it is unusual (even 404 will generate an entry unless the site handles it itself) you might want to ask your hosting about it.

 

Back to your issue, I am at a loss.

 

Which Add On did you use for this clone feature?

Kym,

 

You did get me thinking though about the error_log. Will investigate it further tomorrow morning(our time). On the MAC I am seeing errors and these should be logging on the production side too since it is the exact same code. No major issues but they do need solving to maintain stablity, Perhaps I am missing a reference to the error file in my configuration somewhere?

 

I will post again tomorrow including the exact name of the add-on. Someone in the Netherlands suggests I may have a PHP version incompatibility. Will investigate that also.

 

Thanks so far for your suggestions.

Link to comment
Share on other sites

Kym,

 

I found the log on the server but no meaningfull meassages in there.

It is very strange because I have traced it right into the product_attributes.php file.

The data from screen is getting into the part (based on a switch/case) construction, after which it is supposed to be written into the database. This last step is not happening on the Linux wheras it is on the MAC.

 

The version on the Linux is php5.1.x

Version on MAC is php5.2.x

 

I have the add-on: Product Attributes - Option Type Feature installed

 

This add-on has ammended some of the code but the php code for the SQL addition has remained the same. There are merely some tests to check if the data type is "text" or "textarea"

 

      
       case 'add_product_option_values':
       $value_name_array = $HTTP_POST_VARS['value_name'];
       $value_id = tep_db_prepare_input($HTTP_POST_VARS['value_id']);
       $option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']);
	echo $action;
	print_r ($value_name_array);
	echo "value_id = ".$value_id."\n";
	echo "option_id = ".$option_id."\n";
	//break;

       // BOF PBOR Product Type Option
       $options = tep_db_query("select products_options_type from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$option_id . "' and language_id = '" . (int)$languages[0]['id'] . "'");

       $option_values = tep_db_fetch_array($options);
	print_r ($options);
	//break;
       $text_option_type = (PRODUCTS_OPTIONS_TYPE_TEXT == (int)$option_values['products_options_type'] || PRODUCTS_OPTIONS_TYPE_TEXTAREA == (int)$option_values['products_options_type']);
       for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
         $value_name = tep_db_prepare_input($value_name_array[$languages[$i]['id']]);
	  print_r ($value_name);
	  break;
         //tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int)$value_id . "', '" . (int)$languages[$i]['id'] . "', '" . tep_db_input($value_name) . "')");
         if($text_option_type){
           //TEXT type options share one product_options_values entry (id(0), languageid, name(TEXT)), this entry is added by installation and needs not be added again here
         } else {
           tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int)$value_id . "', '" . (int)$languages[$i]['id'] . "', '" . tep_db_input($value_name) . "')");
         }
       }

       if(!$text_option_type){
         tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " (products_options_id, products_options_values_id) values ('" . (int)$option_id . "', '" . (int)$value_id . "')");
       }
// EOF PBOR Product Type Option

       tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
       break;

The original tep_db_query has been commented out. There are some additional print_r and echo statements in there that I used to trace how far we were getting into this code.

 

I have als added data to the db manually and the product_attributes.php page and code pick this up seemlessly and display it on screen. I can then perform the operations "edit" and "delete" on this data.

 

Conclusion: Something in the code is not opertaing correctly i Linux whereas it is on the MAC and it pertains to inserting the data into the database.

 

Hope someone has an idea about how I can solve that.

 

It is a server thing so you can ask your hosting to set it up so you can see your domain's errors.

 

What version of php are you using?

Link to comment
Share on other sites

So with your debug code, where does it get up to? print_r ($value_name)?

 

 

You could ask them to upgrade php on your server but that might take it to 5.3 (?) now.

 

What about mySQL versions?

Link to comment
Share on other sites

I get to print_r ($options) just before the "for" loop.

Somehow I can't get the code to break inside the for loop.

 

The mySQL on my MAC is: 5.1.44

The mySQL on the Linux is: 5.0.77

 

I have not yet investigated the upgrade. Don't yet see how that will help?

 

So with your debug code, where does it get up to? print_r ($value_name)?

 

 

You could ask them to upgrade php on your server but that might take it to 5.3 (?) now.

 

What about mySQL versions?

Link to comment
Share on other sites

  • 3 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...