Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Extra pages-info box w/ admin - Error: Page title required


itsjust

Recommended Posts

Looking for some help to solve this problem in Extra pages-info box w/ admin

 

When creating a new page or updating an old in the admin, this Error appears: Error: Page title required.

This is a new error. It worked before, and I have made no changes. It also works fine on my localhost version, on my own pc.

 

I can get the error to disapear and report "Success: The page has been updated." by changing (in admin/page_manager.php)

if (empty($$title_field_name)) {
	  $messageStack->add(ERROR_PAGE_TITLE_REQUIRED, 'error');

to

if (empty($_POST[$title_field_name])) {
	  $messageStack->add(ERROR_PAGE_TITLE_REQUIRED, 'error');

But that just reveals that the problem is bigger, because the only thing saved in the new page is the sort order number. The title or the text is not saved.

 

I imagine that the problem is to be found somewere here

$title_field_name='pages_title_'.$languages[$i]['id'];

	if (empty($$title_field_name)) {
	  $messageStack->add(ERROR_PAGE_TITLE_REQUIRED, 'error');


	  $page_error = true;
	}
}
	if (empty($pages_html_text)) {

	}


	if ($page_error == false) {




if ($action == 'insert') {

  if($page_type == "1" || $page_type == "2")  {
 $selectquery=tep_db_query("select count(*) as count from ". TABLE_PAGES ." where page_type=\"$page_type\"");
 $exists = tep_db_fetch_array($selectquery);

	if($exists['count'] >= 1)  {
	   $updateall=tep_db_query("update ". TABLE_PAGES ." set page_type=\"3\" where page_type=\"$page_type\"");
	}

  }
}


if ($action == 'update') {

  if($page_type == "1" || $page_type == "2")  {
 $selectquery=tep_db_query("select count(*) as count from ". TABLE_PAGES ." where page_type=\"$page_type\" and pages_id != \"(int)$pages_id\"");
 $exists = tep_db_fetch_array($selectquery);

	if($exists['count'] >= 1)  {
	   $updateall=tep_db_query("update ". TABLE_PAGES ." set page_type=\"3\" where page_type=\"$page_type\"");
	}

  }
}




for ($i=0, $n=sizeof($languages); $i<$n; $i++) {


$pages_titlem='pages_title_'.$languages[$i]['id'];
$pages_html_textm='pages_html_text_'.$languages[$i]['id'];
$intorextm='intorext_'.$languages[$i]['id'];
$externallinkm='externallink_'.$languages[$i]['id'];
$link_targetm='link_target_'.$languages[$i]['id'];
$language_idm='language_id_'.$languages[$i]['id'];



	  $sql_data_array_pages = array('sort_order' => $sort_order,
									'status' => '1',
									'page_type'   => $page_type);

	  $sql_data_array_pages_description = array('pages_title' => $$pages_titlem,
												'pages_html_text' => $$pages_html_textm,
												'intorext'   => $$intorextm,
												'externallink' => $$externallinkm,
												'link_target' => $$link_targetm);



	 if ($action == 'insert') {

$bID="";


	 if ($i == 0)  {

		tep_db_perform(TABLE_PAGES, $sql_data_array_pages);

		$pages_id = tep_db_insert_id();

	 }

		$pageid_merge= array('pages_id' => $pages_id,
							 'language_id' => $languages[$i]['id']);

		$sql_data_array_pages_desc = array_merge($sql_data_array_pages_description, $pageid_merge);

		tep_db_perform(TABLE_PAGES_DESCRIPTION, $sql_data_array_pages_desc);

		$messageStack->add_session(SUCCESS_PAGE_INSERTED, 'success');


	  } elseif ($action == 'update') {


	  if ($i == 0)  {
		tep_db_perform(TABLE_PAGES, $sql_data_array_pages, 'update', "pages_id = '" . (int)$pages_id . "'");
	  }


	  $selectexists=tep_db_query("select count( * ) as `countrecords` from `".TABLE_PAGES_DESCRIPTION."` where pages_id='" . (int)$pages_id . "' and language_id='".$languages[$i]['id']."'");
	  $recordexists = tep_db_fetch_array($selectexists);



	  if($recordexists['countrecords'] >= 1 )  {
	  tep_db_perform(TABLE_PAGES_DESCRIPTION, $sql_data_array_pages_description, 'update', "pages_id = '" . (int)$pages_id . "' and language_id='".$languages[$i]['id']."'");
	  }
	  else  {

			$pageid_merge= array('pages_id' => $pages_id,
		   'language_id' => $languages[$i]['id']);

	  $sql_data_array_pages_desc = array_merge($sql_data_array_pages_description, $pageid_merge);
	  tep_db_perform(TABLE_PAGES_DESCRIPTION, $sql_data_array_pages_desc);
	  }


	   $messageStack->add_session(SUCCESS_PAGE_UPDATED, 'success');

	  }

}

 

hoping for some help

 

Chris

Edited by Jan Zonjee
Link to comment
Share on other sites

:)Solution to "Error: Page title required." problem

 

I hope the fight is over now

First change

if (empty($$title_field_name)) {
	  $messageStack->add(ERROR_PAGE_TITLE_REQUIRED, 'error');

to

if (empty($_POST[$title_field_name])) {
	  $messageStack->add(ERROR_PAGE_TITLE_REQUIRED, 'error');

Then change

$sql_data_array_pages = array('sort_order' => $sort_order,
									'status' => '1',
									'page_type'   => $page_type);

	  $sql_data_array_pages_description = array('pages_title' => $$pages_titlem,
												'pages_html_text' => $$pages_html_textm,
												'intorext'   => $$intorextm,
												'externallink' => $$externallinkm,
												'link_target' => $$link_targetm);

to

$sql_data_array_pages = array('sort_order' => $_POST[sort_order],
									'status' => '1',
									'page_type'   => $_POST[page_type]);

	  $sql_data_array_pages_description = array('pages_title' => $_POST[$pages_titlem],
												'pages_html_text' => $_POST[$pages_html_textm],
												'intorext'   => $_POST[$intorextm],
												'externallink' => $_POST[$externallinkm],
												'link_target' => $_POST[$link_targetm]);

The trick was to get the $_POST tag in there where it was needed

 

--------------------

Moske Nogavice

http://www.momara.si

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...