Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Error when trying to edit a product


Hani1188

Recommended Posts

Hello all, I've been stuck on this error for almost a month. I tried many avenues to fix it but, unsuccessful. What is hapening is I am able to create a product in any category no problem. But if I go back and try to edit the created product, I get this message. I did all sorts or reasearch online and tried everything I could possiblly find can someone please help me?

 

I am running oscommerce 2.3.1 MySQL 5.5.23-55

PHP Version 5.2.17

 

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'p, products_description pd where p.products_id = '33' and p.products_id = pd.pro' at line 1

 

select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.products_ship_sep, p.manufacturers_id products p, products_description pd where p.products_id = '33' and p.products_id = pd.products_id and pd.language_id = '1'

 

[TEP STOP]

Link to comment
Share on other sites

Looks like you tried to install an addon and messed up. You are missing the from clause in that query.

 

Did you back your file up first?

 

Go back over the install instructions and try again.

Link to comment
Share on other sites

Find this code:

p.manufacturers_id products p, products_description

and change it to:

p.manufacturers_id from products p, products_description

Link to comment
Share on other sites

@@marrrecki

 

Thank you so much for the reply.. I searched for the above code but I could not find it. I assume is would be in index.php or categories.php. I looked could not find an exact match. Can you point me in the right direction please?

Link to comment
Share on other sites

@@bktrain

Check the file where the error comes up, categories.php.

 

Look around line 400 or so for $product_query,

 

 

Hey thats for the tip, but still can't located that. I should mention that I have yym installed as well.. but no problems with that..

 

	   $product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	    $product = tep_db_fetch_array($product_query);
	    tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "',  now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
	    $dup_products_id = tep_db_insert_id();

  // year make model
$q = mysql_query("select * from products_ymm where products_id=$products_id");
if (mysql_num_rows($q) > 0){
while ($r = mysql_fetch_assoc($q)){

 mysql_query("insert into products_ymm set products_id=$dup_products_id , products_car_make = '".$r['products_car_make']."', products_car_model = '".$r['products_car_model']."', products_car_year_bof = '".$r['products_car_year_bof']."', products_car_year_eof = '".$r['products_car_year_eof']."' ");

}

}
	    $description_query = tep_db_query("select language_id, products_name, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");
	    while ($description = tep_db_fetch_array($description_query)) {
		  tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')");
	    }
	    $product_images_query = tep_db_query("select image, htmlcontent, sort_order from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$products_id . "'");
	    while ($product_images = tep_db_fetch_array($product_images_query)) {
		  tep_db_query("insert into " . TABLE_PRODUCTS_IMAGES . " (products_id, image, htmlcontent, sort_order) values ('" . (int)$dup_products_id . "', '" . tep_db_input($product_images['image']) . "', '" . tep_db_input($product_images['htmlcontent']) . "', '" . tep_db_input($product_images['sort_order']) . "')");
	    }
	    tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");
	    $products_id = $dup_products_id;
	  }
	  if (USE_CACHE == 'true') {
	    tep_reset_cache_block('categories');
	    tep_reset_cache_block('also_purchased');
	  }
    }
    tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id));
    break;
   }
 }
// check if the catalog image directory exists
 if (is_dir(DIR_FS_CATALOG_IMAGES)) {
   if (!tep_is_writable(DIR_FS_CATALOG_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');
 } else {
   $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');
 }
 require(DIR_WS_INCLUDES . 'template_top.php');
 if ($action == 'new_product') {
   $parameters = array('products_name' => '',
				   'products_description' => '',
				   'products_url' => '',
				   'products_id' => '',
				   'products_quantity' => '',
				   'products_model' => '',
				   'products_image' => '',
				   'products_larger_images' => array(),
				   'products_price' => '',
				   'products_weight' => '',
				   'products_date_added' => '',
				   'products_last_modified' => '',
				   'products_date_available' => '',
				   'products_status' => '',
				   'products_ship_sep' => '',
				   'manufacturers_id' => '');
   $pInfo = new objectInfo($parameters);
   if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {
  $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.products_ship_sep, p.manufacturers_id " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
  $product = tep_db_fetch_array($product_query);
  $pInfo->objectInfo($product);
  $product_images_query = tep_db_query("select id, image, htmlcontent, sort_order from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product['products_id'] . "' order by sort_order");
  while ($product_images = tep_db_fetch_array($product_images_query)) {
    $pInfo->products_larger_images[] = array('id' => $product_images['id'],
											 'image' => $product_images['image'],
											 'htmlcontent' => $product_images['htmlcontent'],
											 'sort_order' => $product_images['sort_order']);
  }
   }
   $manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE));
   $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
   while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
  $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
								 'text' => $manufacturers['manufacturers_name']);
   }
   $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));
   $tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title");
   while ($tax_class = tep_db_fetch_array($tax_class_query)) {
  $tax_class_array[] = array('id' => $tax_class['tax_class_id'],
							 'text' => $tax_class['tax_class_title']);
   }


Link to comment
Share on other sites

Archived

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

×
×
  • Create New...