Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

support ticket


100asa

Recommended Posts

I've installed this contribution:

http://www.oscommerce.com/community/contributions,3085

and I want to have support ticket for product too.

I've modify this page (from another contribution) like this:

<?php
/*
 $Id: ask_a_question.php,v 1.42 2003/06/11 17:35:01 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce
<td><?php echo tep_draw_hidden_field('to_email_address', STORE_OWNER_EMAIL_ADDRESS) . ' <span class="inputRequirement">' . '</span>'; ?><?php echo tep_draw_hidden_field('to_name', STORE_OWNER) . ' <span class="inputRequirement">' . '</span>'; ?></td>
 Released under the GNU General Public License
*/
 require('includes/application_top.php');
if (!tep_session_is_registered('customer_id') && (ALLOW_GUEST_TO_TELL_A_FRIEND == 'false')) {
$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }
?>
<?php 
$the_manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p  where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id"); 
$the_manufacturers = tep_db_fetch_array($the_manufacturer_query); 
?> 
<?php
 $valid_product = false;
 if (isset($HTTP_GET_VARS['products_id'])) {
$product_info_query = tep_db_query("select pd.products_name, p.products_model,  p.products_image, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
if (tep_db_num_rows($product_info_query)) {
  $valid_product = true;
  $product_info = tep_db_fetch_array($product_info_query);
}
 }
/*  if ($valid_product == false) {
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
 }
*/

//inzio cambio
 if (!tep_session_is_registered('customer_id') && $HTTP_GET_VARS['login']=="yes") {
$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }


 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_TICKET_CREATE);
 $ticket_departments = array();
 $ticket_department_array = array();
 $ticket_department_query = tep_db_query("select ticket_department_id, ticket_department_name from " . TABLE_TICKET_DEPARTMENT . " where ticket_language_id = '" . $languages_id . "'");
 while ($ticket_department = tep_db_fetch_array($ticket_department_query)) {
$ticket_departments[] = array('id' => $ticket_department['ticket_department_id'],
						   'text' => $ticket_department['ticket_department_name']);
$ticket_department_array[$ticket_department['ticket_department_id']] = $ticket_department['ticket_department_name'];
 }
 $ticket_prioritys = array();
 $ticket_priority_array = array();
 $ticket_priority_query = tep_db_query("select ticket_priority_id, ticket_priority_name from " . TABLE_TICKET_PRIORITY . " where ticket_language_id = '" . $languages_id . "'");
 while ($ticket_priority = tep_db_fetch_array($ticket_priority_query)) {
$ticket_prioritys[] = array('id' => $ticket_priority['ticket_priority_id'],
						   'text' => $ticket_priority['ticket_priority_name']);
$ticket_priority_array[$ticket_priority['ticket_priority_id']] = $ticket_priority['ticket_priority_name'];
 }

 $email = tep_db_prepare_input(trim($HTTP_POST_VARS['email']));
 $name = tep_db_prepare_input($HTTP_POST_VARS['name']);
 $subject = tep_db_prepare_input($HTTP_POST_VARS['subject']);
 $enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
$prodotto = tep_db_prepare_input($HTTP_POST_VARS['prodotto']);
$produttore = tep_db_prepare_input($HTTP_POST_VARS['produttore']);
 $department = tep_db_prepare_input($HTTP_POST_VARS['department']);
 $priority = tep_db_prepare_input($HTTP_POST_VARS['priority']);
 $ticket_customers_orders_id = tep_db_prepare_input($HTTP_POST_VARS['ticket_customers_orders_id']);


// Customer is logged in:  
 if (tep_session_is_registered('customer_id')) {
$customer_query = tep_db_query("select?customers_firstname, customers_lastname,?customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");
$customer = tep_db_fetch_array($customer_query);
 }

// Form was submitted
 $error = false;
 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
 // Check Name length
if (!tep_session_is_registered('customer_id') && isset($name) && strlen($name) < TICKET_ENTRIES_MIN_LENGTH ) {
	$error = true;
	$error_name = true;
  }

// Check Subject length
if (isset($subject) && strlen($subject) < TICKET_ENTRIES_MIN_LENGTH ) {
	$error = true;
	$error_subject = true;
  }
 // Check Message length
if (isset($enquiry) && strlen($enquiry) < TICKET_ENTRIES_MIN_LENGTH ) {
	$error = true;
	$error_enquiry = true;
  }
 // Check Email for non logged in Customers
if (!tep_session_is_registered('customer_id') && !tep_validate_email($email)) {
  $error = true;
  $error_email = true;
} 

if ($error == false) {
  $ticket_customers_id = '';
// Get the customers_id
  if (tep_session_is_registered('customer_id')) {
	$ticket_customers_id = $customer_id;
  } else {
	$customerid_query = tep_db_query("select customers_id from " . TABLE_CUSTOMERS . " where customers_email_address='" . tep_db_input($email) . "'");
	if ($customerid = tep_db_fetch_array($customerid_query)) $ticket_customers_id = $customerid['customers_id'];
  }
  // generate LInkID
  $time = mktime();
  $ticket_link_id = '';
  for ($x=3;$x<10;$x++) {
	$ticket_link_id .= substr($time,$x,1) . tep_create_random_value(1, $type = 'chars');
  }

  $sql_data_array = array('ticket_link_id' => $ticket_link_id,
					  'ticket_customers_id' => $ticket_customers_id,
					  'ticket_customers_orders_id' => $ticket_customers_orders_id,
					  'ticket_customers_email' => $email,
					  'ticket_customers_name' => $name,
					  'ticket_subject' => $subject,
					  'ticket_status_id' => '1',
					  'ticket_department_id' => $department,
					  'ticket_priority_id' => $priority,
					  'ticket_login_required' => TICKET_CUSTOMER_LOGIN_REQUIREMENT_DEFAULT,
					  'ticket_date_last_modified' => 'now()',
					  'ticket_date_last_customer_modified' => 'now()',
												'produttore'=> $the_manufacturers,
												'prodotto'=> $product_info,
					  'ticket_date_created' => 'now()');
  tep_db_perform(TABLE_TICKET_TICKET, $sql_data_array);
  $insert_id = tep_db_insert_id();

  $sql_data_array = array('ticket_id' => $insert_id,
					  'ticket_status_id' => '1',
					  'ticket_priority_id' => $priority,
					  'ticket_department_id' => $department,
					  'ticket_date_modified' => 'now()',
					  'ticket_customer_notified' => '1',
					  'ticket_edited_by' => $name,
												'produttore'=> $the_manufacturers,
												'prodotto'=> $product_info,
					  'ticket_comments' => $enquiry);
  tep_db_perform(TABLE_TICKET_STATUS_HISTORY, $sql_data_array); 
// Email  Customer doesn't get the Message cause he should use the web
  $ticket_email_subject = TICKET_EMAIL_SUBJECT . $subject;
  $ticket_email_message = TICKET_EMAIL_MESAGE_HEADER . "\n\n" . tep_href_link(FILENAME_TICKET_VIEW, 'tlid=' . $ticket_link_id, 'NONSSL',false,false) . "\n\n" . TICKET_EMAIL_TICKET_NR . " " . $ticket_link_id . "\n" . TICKET_EMAIL_MESAGE_FOOTER;
  tep_mail($name, $email, $ticket_email_subject, nl2br($ticket_email_message), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
// send emails to other people
  if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
   $ticket_email_message = TICKET_EMAIL_MESAGE_HEADER . "\n\n" . tep_href_link(FILENAME_TICKET_VIEW, 'tlid=' . $ticket_link_id) . "\n\n" . $product_info['products_name'] . "\n\n" . TICKET_EMAIL_MESAGE_FOOTER . "\n\n" . $enquiry;
   tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, $ticket_email_subject,nl2br($ticket_email_message), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }
  tep_redirect(tep_href_link(FILENAME_TICKET_CREATE, 'action=success&tlid=' . $ticket_link_id ));
}
 }


 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_TICKET_CREATE));
//fine cambio


?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta name="robots" content="index,follow">
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?> - <?php echo NAVBAR_TITLE; ?> su  <?php echo $the_manufacturers['manufacturers_name']; ?> <?php echo $product_info['products_name']; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top">
<table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><?php //echo tep_draw_form('email_friend', tep_href_link(FILENAME_ASK_QUESTION, 'action=process&products_id=' . $HTTP_GET_VARS['products_id'])); ?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td>
	<table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo sprintf($the_manufacturers['manufacturers_name']); ?> <?php echo $product_info['products_name'] ?>  <br><font size="2"> (<?php echo $product_info['products_model'] ?>)</font></td>
		<td class="pageHeading" align="center"><?php echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<!-- inizio cambio -->

<?php
 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td rowspan=4 class="main"><?php //echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', HEADING_TITLE, '0', '0', 'align="left"') ?></td>
		<td class="main"><?php echo TEXT_SUCCESS; ?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo TEXT_YOUR_TICKET_ID . ' ' . $HTTP_GET_VARS['tlid']; ?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo TEXT_CHECK_YOUR_TICKET . '<br><a href="' . tep_href_link(FILENAME_TICKET_VIEW, 'tlid=' . $HTTP_GET_VARS['tlid'], 'NONSSL',false,false) . '">' . tep_href_link(FILENAME_TICKET_VIEW, 'tlid=' . $HTTP_GET_VARS['tlid'], 'NONSSL',false,false) . '</a>'; ?></td>
	  </tr>
	  <tr>
		<td valign ="bottom" align="right"><br><a href="<?php echo tep_href_link(FILENAME_DEFAULT); ?>"><?php echo tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></a></td>
	  </tr>
	</table></td>
  </tr>
<?php
 } else {
?>
  <tr>
	<td><?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_TICKET_CREATE, 'action=send')); ?><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td width="150" class="main"><?php echo ENTRY_NAME; ?> </td>
		<td class="main">
<?php
if (tep_session_is_registered('customer_id')) {
  echo tep_draw_hidden_field('name',$customer['customers_firstname'] . ' ' . $customer['customers_lastname']) . $customer['customers_firstname'] . ' ' . $customer['customers_lastname']; 
} else {
  echo tep_draw_input_field('name', ($error ? $name : $first_name)); if ($error_name) echo ENTRY_ERROR_NO_NAME;
}
?>
		</td>
		<td class="main" align="left" width="100%" valign="top" rowspan="2">
<?php
  if (!tep_session_is_registered('customer_id')) {
 echo  sprintf(TEXT_LOGIN, tep_href_link(FILENAME_TICKET_CREATE, 'login=yes', 'SSL'), tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL')); 
  }
?>
		 </td>
	  </tr>
	  <tr>
		<td class="main"><?php echo ENTRY_EMAIL; ?> </td>
		<td class="main">
<?php
if (tep_session_is_registered('customer_id')) {
  echo tep_draw_hidden_field('email',$customer['customers_email_address']) . $customer['customers_email_address']; 
} else {
  echo tep_draw_input_field('email', ($error ? $email : $email_address)); if ($error_email) echo ENTRY_EMAIL_ADDRESS_CHECK_ERROR; 
}
?>
		</td>
	  </tr>
<?php
if (TICKET_SHOW_CUSTOMERS_SUBJECT == 'true') {   
?>
	  <tr>
		<td class="main"><?php echo ENTRY_SUBJECT; ?> </td>
		<td class="main"><?php  echo tep_draw_input_field('subject', ($error ? $subject : $subject)); if ($error_subject) echo ENTRY_ERROR_NO_SUBJECT; ?></td>
		<td> </td>
	  </tr>
<?php
}
if (TICKET_SHOW_CUSTOMERS_ORDER_IDS == 'true' && tep_session_is_registered('customer_id')) {	 
  $customers_orders_query = tep_db_query("select orders_id, date_purchased from " . TABLE_ORDERS . " where customers_id?= '" . tep_db_input($customer_id) . "'");
  if (isset($HTTP_GET_VARS['ticket_order_id'])) $ticket_preselected_order_id = $HTTP_GET_VARS['ticket_order_id'];
  $orders_array[] = array('id' => '', 'text' => ' -- ' );
  while ($customers_orders = tep_db_fetch_array($customers_orders_query)) {
	$orders_array[] = array('id' => $customers_orders['orders_id'], 'text' => $customers_orders['orders_id'] . "  (" . tep_date_short($customers_orders['date_purchased']) . ")" );
  }

?>
	  <tr>
		<td class="main"><?php echo ENTRY_ORDER; ?> </td>
		<td class="main"><?php echo  tep_draw_pull_down_menu('ticket_customers_orders_id', $orders_array,$ticket_preselected_order_id); ?></td>
		<td> </td>
	  </tr>

<?php
}
if (TICKET_CATALOG_USE_DEPARTMENT == 'true') {	 
?>
	  <tr>
		<td class="main"><?php echo ENTRY_DEPARTMENT; ?> </td>
		<td class="main"><?php echo tep_draw_pull_down_menu('department', $ticket_departments, ($department ? $department : TICKET_DEFAULT_DEPARTMENT_ID) ); ?></td>
		<td> </td>
	  </tr>
<?php
} else {
	?>
	 <tr>
		<td class="main"><?php echo ENTRY_DEPARTMENT; ?> </td>
		<td class="main"><?php echo tep_draw_pull_down_menu('department', $ticket_departments, ($department ? $department : TICKET_DEFAULT_DEPARTMENT_ID) ); ?></td>
		<td> </td>
	  </tr>
				<?php
//  echo tep_draw_hidden_field('department', TICKET_DEFAULT_DEPARTMENT_ID);
}
 if (TICKET_CATALOG_USE_PRIORITY == 'true') {   
?>
	  <tr>
		<td class="main"><?php echo ENTRY_PRIORITY; ?> </td>
		<td class="main"><?php echo tep_draw_pull_down_menu('priority', $ticket_prioritys, ($priority ? $priority : TICKET_DEFAULT_PRIORITY_ID) ); ?></td>
		<td> </td>
	  </tr>
<?php
} else {
	?>
	<tr>
		<td class="main"><?php echo ENTRY_PRIORITY; ?> </td>
		<td class="main"><?php echo tep_draw_pull_down_menu('priority', $ticket_prioritys, ($priority ? $priority : TICKET_DEFAULT_PRIORITY_ID) ); ?></td>
		<td> </td>
	  </tr>
				<?php
 // echo tep_draw_hidden_field('priority', TICKET_DEFAULT_PRIORITY_ID);
}
?>
	  <tr>
		<td colspan=3 class="main"><?php echo ENTRY_ENQUIRY; ?></td>
	  </tr>
	  <tr>
		<td colspan=3><?php echo tep_draw_textarea_field('enquiry', 'soft', 50, 15, $enquiry); ?><br><?php if ($error_enquiry) echo ENTRY_ERROR_NO_ENQUIRY; ?></td>
	  </tr>
	  <tr>
		<td colspan=3 class="main" align="right"><br><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
	  </tr>
				<?php echo tep_draw_hidden_field($the_manufacturers['manufacturers_name'])  ?>
									<?php echo tep_draw_hidden_field($product_info['products_name']) ?>
	</table></form></td>
  </tr>
<?php
 }
?>
</table></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>


<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

but I don't receive admin emails with name of product or manufacturer.

 

Where is the error?

Thank you for any support.

Skype: centoasa

Skype: remigioruberto

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...