Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Get a syntax error when I try to add products to my catalog


Adamanto75

Recommended Posts

Hello Everyone,

 

My browser gives me this error when I try to access my catalog through my admin

 

Parse error: syntax error, unexpected T_CASE in /hermes/web08/b2492/moo.oursacredgardencom/oursacredgarden.com/admin/categories.php on line 435

 

And this is the code on lines 431 - 435

 

break;

case 'copy_to_confirm':

if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['categories_id'])) {

$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

$categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

 

All though when I open the code in dreamweaver it tells me that there is a syntax error on line 485 and this is the code there

 

(lines 485 - 496)

 

 

case 'promote':

 

if (isset($HTTP_GET_VARS['pID'])) {

 

$products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);

 

require(DIR_WS_FUNCTIONS . 'SocialRunnerConnector.php');

 

SrBroadcast($products_id);

 

}

 

I installed a bunch of add-ons so I'm not exactly sure which one might of did this. But I'm thinking it may be the social runner add on I just added, because that is the only one that messes with the categories.php code.

 

Any info on this problem would be greatly appreciated Thanks in Advance.

 

Adamanto75

Link to comment
Share on other sites

Always post at least 10 lines either side of the reported error line.

When you do that, always point out which line is the error line.

Enclose all code in <> forum code tags.

 

Oh ok thanks for the advice here it is corrected

 

Lines 430 - 446 (Error is on line 435) Where it says "$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);"

 

    tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));
    break;
  case 'copy_to_confirm':
    if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['categories_id'])) {
	  $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
	  $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
	  if ($HTTP_POST_VARS['copy_as'] == 'link') {
	    if ($categories_id != $current_category_id) {
		  $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$categories_id . "'");
		  $check = tep_db_fetch_array($check_query);
		  if ($check['total'] < '1') {
		    tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$categories_id . "')");
		  }
	    } else {
		  $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');
	    }

 

 

Lines 471 - 502 (Dreamweaver says the syntax error is on line 485) Where it says case: 'promote'

 

	    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;
   }
 }
case 'promote':
		    if (isset($HTTP_GET_VARS['pID'])) {
			    $products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);
			    require(DIR_WS_FUNCTIONS . 'SocialRunnerConnector.php');
			    SrBroadcast($products_id);
		    }
		    tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath ));
		    break;

 

I hope this is easier to understand if I did anything wrong please let me know and any advice thank you in advance

 

Adamanto75

Link to comment
Share on other sites

The error says that PHP ran into a case keyword outside of an enclosing switch. The usual cause of this is an extra } somewhere just ahead of the case in question, that ended the switch too early. Check that all {} pairs are balanced back up to the previous case.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...