Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Gone Missing! Help Needed.


aiyou

Recommended Posts

Hello.

 

I experieced a catastrophic database issue. After recovering from the most recent backup (which wasn't all that recent), I've lost the ability to add Product Options and Product Values from Admin -->Product Attributes menu.

 

I used to have Product Attributes, Product Options, and Product Values available...now, its just Product Attributes.

 

I have the feeling that it is somehow related to the following in /admin/product_attributes.php

 if (tep_not_null($action)) {
   $page_info = '';
   if (isset($HTTP_GET_VARS['option_page'])) $page_info .= 'option_page=' . $HTTP_GET_VARS['option_page'] . '&';
   if (isset($HTTP_GET_VARS['value_page'])) $page_info .= 'value_page=' . $HTTP_GET_VARS['value_page'] . '&';
   if (isset($HTTP_GET_VARS['attribute_page'])) $page_info .= 'attribute_page=' . $HTTP_GET_VARS['attribute_page'] . '&';
   if (tep_not_null($page_info)) {
     $page_info = substr($page_info, 0, -1);
   }

 

I'm guessing that (isset($HTTP_GET_VARS['attribute_page'])) is equal to TRUE, hence it is displayed. How do I get 'option_page' and 'value_page' set?

 

I've tried searching, but haven't found the right combination of search criteria yet....I'll keep trying, but any help in the meantime would be GREATLY appreciated.

 

Thanks in advance

Link to comment
Share on other sites

I think I found the issue...

 

While most of the SQL statements within product_attributes.php are written with variables for the table names, there are a few that use explicit references.

 

As a part of my database disaster/database recovery efforts, I renamed my tables so they are no longer standard, stock OSC names. While I updated the various php config files (i.e. /admin/includes/database_tables.php) with the new table names, I did not do a thorough code scan for explicit table references.

 

Lesson learned...back to coding the fix.

Link to comment
Share on other sites

For anyone following along, and who has considered using table names other than those created by the stock install....at least one change needed in /admin/products_attributes.php (and after making the necessary updates to /admin/includes/database_tables.php and other references.....)

 

I'll also add that I inherited the code when I acquired the business, and I'm still learning my way around (as one can clearly see with my documented issue :-) ), so I have no idea if this is a standard query, or if this was modified as the result of some contrib.

 

Replace:

 
$values = tep_db_query("SELECT products_options_values.products_options_values_id,
  			  products_options_values.products_options_values_name,
      			  products_options.products_options_id,
  			  products_options.products_options_name,
  			  products_options_values_to_products_options.products_options_id,
  			  products_options_values_to_products_options.products_options_values_id
  		     FROM products_options_values,
  			 products_options,
  			 products_options_values_to_products_options
  		    WHERE products_options_values.products_options_values_id = products_options_values_to_products_options.products_options_values_id AND
products_options.products_options_id = products_options_values_to_products_options.products_options_id
 		    ORDER BY products_options.products_options_name, products_options_values.products_options_values_name") or die(mysql_error());

 

With:

	
$values = tep_db_query("SELECT 	pov.products_options_values_id,
			pov.products_options_values_name,
			po.products_options_id,
			po.products_options_name,
			pov2po.products_options_id,
			pov2po.products_options_values_id
	      FROM " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, "
		 . TABLE_PRODUCTS_OPTIONS . " po, "
		 . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " pov2po 
	      WHERE pov.products_options_values_id = pov2po.products_options_values_id AND
		 po.products_options_id = pov2po.products_options_id
	      ORDER BY po.products_options_name, pov.products_options_values_name")
	      OR die(mysql_error());

 

I hope this provides useful for at least someone out there

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...