Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help with parseerror/t_string


michael_t

Recommended Posts

I go to bring up my admin and get:

Parse error: parse error, unexpected T_STRING in C:\Inetpub\vhosts\affordablecards.com\httpdocs\catalog\includes\configure.php on line 19

heres the config code:

?php

/*

 

$Id: configure.php,v 1.14 2003/07/09 01:15:48 hpdl Exp $

 

 

osCommerce, Open Source E-Commerce Solutions

 

http://www.oscommerce.com

 

 

Copyright © 2003 osCommerce

 

 

Released under the GNU General Public License

*/

 

//

Define the webserver and path parameters

// * DIR_FS_* = Filesystem directories

 

(local/physical)

// * DIR_WS_* = Webserver directories (virtual/URL)

 

define('HTTP_SERVER', 'http://www.affordablecards.com');'' eg, http://localhost - should

 

not be empty for productive servers

 

define('ENABLE_SSL', false); // secure webserver for checkout procedure?

 

define('HTTP_COOKIE_DOMAIN', 'www.affordablecards.com');

 

define('HTTP_COOKIE_PATH', 'http://affordablecards.com/catalog/');

 

define('DIR_WS_HTTP_CATALOG', 'www.affordablecards.com/catalog/');

 

define('DIR_WS_IMAGES', 'images/');

 

define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');

 

define('DIR_WS_INCLUDES', 'includes/');

 

define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');

 

define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');

 

define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

 

define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');

 

define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 

 

define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');

 

define('DIR_FS_CATALOG', dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']));

 

 

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

 

define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

//

define our database connection

 

define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive

 

servers

 

define('DB_SERVER_USERNAME', 'xxxxx');

 

define('DB_SERVER_PASSWORD', 'xxxx');

 

define('DB_DATABASE', 'inventory');

 

define('USE_PCONNECT', 'false'); // use persistent connections?

 

define('STORE_SESSIONS', 'mysql'); //'' for default handler or set to 'mysql'

?>

 

help :)

Link to comment
Share on other sites

when u post a thread containing code, it is best to put the code inbetween the code] and [/code] markers so we can tell what is what. compare this with what you had and you can see the changes

 

<?php
/*
$Id: configure.php,v 1.14 2003/07/09 01:15:48 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright ? 2003 osCommerce
Released under the GNU General Public License
*/

define('HTTP_SERVER', 'http://www.affordablecards.com');
define('ENABLE_SSL', false); // secure webserver for checkout procedure?
define('HTTP_COOKIE_DOMAIN', 'www.affordablecards.com');
define('HTTP_COOKIE_PATH', 'www.affordablecards.com/catalog/');
define('DIR_WS_HTTP_CATALOG', 'www.affordablecards.com/catalog/');
define('DIR_WS_IMAGES', 'images/');
define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
define('DIR_WS_INCLUDES', 'includes/');
define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
define('DIR_FS_CATALOG', dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']));
define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

// define our database connection

define('DB_SERVER', 'localhost');
define('DB_SERVER_USERNAME', 'xxxxx');
define('DB_SERVER_PASSWORD', 'xxxx');
define('DB_DATABASE', 'inventory');
define('USE_PCONNECT', 'false'); // use persistent connections?
define('STORE_SESSIONS', 'mysql'); //'' for default handler or set to 'mysql'
?>

Link to comment
Share on other sites

One thing I see is a missing comment tag and 2 unneeded single quotes

define('HTTP_SERVER', 'http://www.affordablecards.com');//'' eg, http://localhost - should not be empty for productive servers

if this doesn't fix it, post what your line 19 is, as your first post doesn't tell us.

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

Understood...

The point was that we couldn't tell from your post which line was #19 (the line causing the error)

 

Did adding the comment slashes (//) where I showed you fix the problem?

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

make sure there is no empty space at the top of the file, as when i used the code button it left an empty space.

 

also, rather than saying still broken paste the current error.

Link to comment
Share on other sites

actually you are missing more:

 

define('HTTP_COOKIE_PATH', '/catalog/');

define('HTTPS_COOKIE_PATH', '/catalog/');

define('DIR_WS_HTTP_CATALOG', '/catalog/');

define('DIR_WS_HTTPS_CATALOG', '/catalog/');

define('DIR_WS_IMAGES', '/catalog/images/');

define('DIR_WS_ICONS', '/catalog/images/icons/');

define('DIR_WS_INCLUDES', 'includes/');

define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');

 

 

open a generic copy of the configure.php file and then fill it in with parts from your current configure.php file.

 

where did you get the one you pasted? i didnt even read it all the way and then saw what is going on.

 

you will also need to fix your admin/includes/configure.php

Link to comment
Share on other sites

ok here is the current error:Parse error: parse error, unexpected T_STRING in C:\Inetpub\vhosts\affordablecards.com\httpdocs\catalog\includes\configure.php on line 19

here is my config file:

<?php
/*
 
$Id: configure.php,v 1.14 2003/07/09 01:15:48 hpdl Exp $

 
osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 
Copyright (c) 2003 osCommerce

 
Released under the GNU General Public License
*/

//
Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories 

(local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)

define('HTTP_SERVER', 'http://www.affordablecards.com');// eg, http://localhost - should 

not be empty for productive servers
 
define('HTTPS_SERVER', 'https://www.affordablecards.com');
 
define('ENABLE_SSL', false); // secure webserver for checkout procedure?
 
define('HTTP_COOKIE_DOMAIN', 'www.affordablecards.com');
  
define('HTTP_COOKIE_PATH', '/catalog/');
  
define('HTTPS_COOKIE_PATH', '/catalog/');
define('DIR_WS_HTTP_CATALOG', '/catalog/');
define('DIR_WS_HTTPS_CATALOG', '/catalog/');   
define('DIR_WS_IMAGES', '/catalog/images/');
 
define('DIR_WS_ICONS', DIR_WS_IMAGES . '/catalog/images/icons/');
 
define('DIR_WS_INCLUDES', 'includes/');
 
define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
 
define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
 
define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
 
define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
 
define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 
define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
 
define('DIR_FS_CATALOG', dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']));
 

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
 
define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

// 
define our database connection
 
define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive 

servers
 
define('DB_SERVER_USERNAME', 'xxxx');
 
define('DB_SERVER_PASSWORD', 'xxxx');
 
define('DB_DATABASE', 'inventory');
 
define('USE_PCONNECT', 'false'); // use persistent connections?
 
define('STORE_SESSIONS', 'mysql'); //'' for default handler or set to 'mysql'
?>

Link to comment
Share on other sites

please remove all extra spaces in the file. the current line 19 is:

 

(local/physical)

 

 

which is not a valid code, this needs to be:

 

//(local/physical)

 

please do not edit the file via the osCommerce file manager.

 

your editor must be changing things

 

also this:

 

not be empty for productive servers

 

needs a comment to be:

 

//not be empty for productive servers

 

so get rid of all the carriage returns and tighten things up so you can see where all the other errors are.

Link to comment
Share on other sites

<?php
/*
$Id: configure.php,v 1.14 2003/07/09 01:15:48 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)

// * DIR_WS_* = Webserver directories (virtual/URL)

define('HTTP_SERVER', 'http://www.affordablecards.com'); 
define('HTTPS_SERVER', 'https://www.affordablecards.com'); 
define('ENABLE_SSL', false); 
define('HTTP_COOKIE_DOMAIN', 'www.affordablecards.com');  
define('HTTPS_COOKIE_DOMAIN', 'www.affordablecards.com');
define('HTTP_COOKIE_PATH', '/catalog/');  
define('HTTPS_COOKIE_PATH', '/catalog/');
define('DIR_WS_HTTP_CATALOG', '/catalog/');
define('DIR_WS_HTTPS_CATALOG', '/catalog/');   
define('DIR_WS_IMAGES', '/catalog/images/'); 
define('DIR_WS_ICONS', DIR_WS_IMAGES . '/catalog/images/icons/'); 
define('DIR_WS_INCLUDES', 'includes/'); 
define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/'); 
define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/'); 
define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/'); 
define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/'); 
define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/'); 
define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/'); 
define('DIR_FS_CATALOG', dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']));
define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); 
define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

// define our database connection

define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers
define('DB_SERVER_USERNAME', 'xxxx');
define('DB_SERVER_PASSWORD', 'xxxx');
define('DB_DATABASE', 'inventory');
define('USE_PCONNECT', 'false'); // use persistent connections?
define('STORE_SESSIONS', 'mysql'); //'' for default handler or set to 'mysql'
?>

Link to comment
Share on other sites

These won't work...

define('DIR_WS_IMAGES', '/catalog/images/'); 
define('DIR_WS_ICONS', DIR_WS_IMAGES . '/catalog/images/icons/');

as you are defining more path levels than what exist. These two should read:

define('DIR_WS_IMAGES', 'images/'); 
define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');

I don't know if this is the complete problem, as the way your file is being shown in your posts does not allow us to see which line is actually line #19. If you would specify which line that is, it might help someone to help you.

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

define('HTTPS_SERVER', '');

 

 

define('HTTPS_COOKIE_DOMAIN', '');

 

Make sure that you edited this file in a programme such as NotePad or TextPad, basically any programme that does not include any hidden text formatting (such as WordPad), and that it was uploaded in ascii mode and not binary.

 

Vger

Link to comment
Share on other sites

Did Not want to start a new topic for the same thing... need help with a Parse error

 

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /catchusers3/2010987/admin/specials.php on line 197

 

here is the code... not sure what it is talking about... i was not even in here... lol

 

<?php

/*

$Id: specials.php,v 1.7 2002/11/19 01:48:08 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

define('NAVBAR_TITLE', 'Specials');

define('HEADING_TITLE', 'Get Them While They\'re Hot!');

?>

 

 

can some one help ??? totally lost with this stuff!!

 

thanks for any help givin

 

paula

Knowledge Base

 

In Perfect Love, And Perfect Trust. The Circle Is Open, But Never Broken!

Link to comment
Share on other sites

just a note here... i got the parse message when i was in admin and went to the special page under the catalog catagory..

 

not sure if that matters or not... but just wanted to let some one know just in case...

 

 

thanks again

 

paula

Knowledge Base

 

In Perfect Love, And Perfect Trust. The Circle Is Open, But Never Broken!

Link to comment
Share on other sites

post the 5 lines prior to and after line 197 from admin/specials.php

 

 

 

ok i went into the file manager and copied this...

 

<?php

/*

$Id: specials.php,v 1.49 2003/06/09 22:35:33 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SPECIALS);

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SPECIALS));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></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"><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 HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

$specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 

if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>

<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<?php

$row = 0;

$specials_query = tep_db_query($specials_split->sql_query);

while ($specials = tep_db_fetch_array($specials_query)) {

$row++;

 

echo ' <td align="center" width="33%" class="smallText"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $specials['products_image'], $specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . $specials['products_name'] . '</a><br><s>' . $currencies->display_price($specials['products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($specials['specials_new_products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</span></td>' . "n";

 

if ((($row / 3) == floor($row / 3))) {

?>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<?php

}

}

?>

</tr>

</table></td>

</tr>

<?php

if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

<tr>

<td><br><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>

<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table></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'); ?>

 

 

hope thats what your looking for... ???

 

but i was not in this file and i dont understand what happend?

 

 

signed lost in osc :'(

Knowledge Base

 

In Perfect Love, And Perfect Trust. The Circle Is Open, But Never Broken!

Link to comment
Share on other sites

dont use the file manager, download the file via ftp, then open with phpedit (free download, search the net) and edit, then go from there

 

 

 

huh?... lol... sorry... its not funny ... but then again it is...

 

guess i need to hire a program to fix what a hacker distroyed, and the huricanes did not help either... lol...

 

in a nut shell... everytime i fix one thing ... two more problems pop up... its a loosing game... :(

 

 

so i will go see if i can try to figure out what you mean. lol... i am new to all this php stuff... know a little html... but thats about it.

 

anyways... thanks for the help

 

paula

Knowledge Base

 

In Perfect Love, And Perfect Trust. The Circle Is Open, But Never Broken!

Link to comment
Share on other sites

search the internet for phpedit it is a free program which you can use to edit your files.

 

never edit the live site files, only leads to troubles.

 

always edit locally and preferable to install apache, mysql and php along with oscommerce on your local computer for development and testing prior to going to the internet.

Link to comment
Share on other sites

search the internet for phpedit it is a free program which you can use to edit your files.

 

never edit the live site files, only leads to troubles.

 

always edit locally and preferable to install apache, mysql and php along with oscommerce on your local computer for development and testing prior to going to the internet.

 

ok i used my program that comes with my website.. bravepages file editor can i use that...

 

this is what i got with it

 

<?php

/*

$Id: specials.php,v 1.41 2003/06/29 22:50:52 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 

if (tep_not_null($action)) {

switch ($action) {

case 'setflag':

tep_set_specials_status($HTTP_GET_VARS['id'], $HTTP_GET_VARS['flag']);

 

tep_redirect(tep_href_link(FILENAME_SPECIALS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'sID=' . $HTTP_GET_VARS['id'], 'NONSSL'));

break;

case 'insert':

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

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

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

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

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

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

 

if (substr($specials_price, -1) == '%') {

$new_special_insert_query = tep_db_query("select products_id, products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

$new_special_insert = tep_db_fetch_array($new_special_insert_query);

 

$products_price = $new_special_insert['products_price'];

$specials_price = ($products_price - (($specials_price / 100) * $products_price));

}

 

$expires_date = '';

if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year)) {

$expires_date = $year;

$expires_date .= (strlen($month) == 1) ? '0' . $month : $month;

$expires_date .= (strlen($day) == 1) ? '0' . $day : $day;

}

 

tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), '" . tep_db_input($expires_date) . "', '1')");

 

tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page']));

break;

case 'update':

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

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

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

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

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

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

 

if (substr($specials_price, -1) == '%') $specials_price = ($products_price - (($specials_price / 100) * $products_price));

 

$expires_date = '';

if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year)) {

$expires_date = $year;

$expires_date .= (strlen($month) == 1) ? '0' . $month : $month;

$expires_date .= (strlen($day) == 1) ? '0' . $day : $day;

}

 

tep_db_query("update " . TABLE_SPECIALS . " set specials_new_products_price = '" . tep_db_input($specials_price) . "', specials_last_modified = now(), expires_date = '" . tep_db_input($expires_date) . "' where specials_id = '" . (int)$specials_id . "'");

 

tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials_id));

break;

case 'deleteconfirm':

$specials_id = tep_db_prepare_input($HTTP_GET_VARS['sID']);

 

tep_db_query("delete from " . TABLE_SPECIALS . " where specials_id = '" . (int)$specials_id . "'");

 

tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page']));

break;

}

}

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<script language="javascript" src="includes/general.js"></script>

<?php

if ( ($action == 'new') || ($action == 'edit') ) {

?>

<link rel="stylesheet" type="text/css" href="includes/javascript/calendar.css">

<script language="JavaScript" src="includes/javascript/calendarcode.js"></script>

<?php

}

?>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">

<div id="popupcalendar" class="text"></div>

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<?php

if ( ($action == 'new') || ($action == 'edit') ) {

$form_action = 'insert';

if ( ($action == 'edit') && isset($HTTP_GET_VARS['sID']) ) {

$form_action = 'update';

 

$product_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, s.specials_new_products_price, s.expires_date from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id and s.specials_id = '" . (int)$HTTP_GET_VARS['sID'] . "'");

$product = tep_db_fetch_array($product_query);

 

$sInfo = new objectInfo($product);

} else {

$sInfo = new objectInfo(array());

 

// create an array of products on special, which will be excluded from the pull down menu of products

// (when creating a new product on special)

$specials_array = array();

$specials_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s where s.products_id = p.products_id");

while ($specials = tep_db_fetch_array($specials_query)) {

$specials_array[] = $specials['products_id'];

}

}

?>

<tr><form name="new_special" <?php echo 'action="' . tep_href_link(FILENAME_SPECIALS, tep_get_all_get_params(array('action', 'info', 'sID')) . 'action=' . $form_action, 'NONSSL') . '"'; ?> method="post"><?php if ($form_action == 'update') echo tep_draw_hidden_field('specials_id', $HTTP_GET_VARS['sID']); ?>

<td><br><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo TEXT_SPECIALS_PRODUCT; ?> </td>

<td class="main"><?php echo (isset($sInfo->products_name)) ? $sInfo->products_name . ' <small>(' . $currencies->format($sInfo->products_price) . ')</small>' : tep_draw_products_pull_down('products_id', 'style="font-size:10px"', $specials_array); echo tep_draw_hidden_field('products_price', (isset($sInfo->products_price) ? $sInfo->products_price : '')); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_SPECIALS_SPECIAL_PRICE; ?> </td>

<td class="main"><?php echo tep_draw_input_field('specials_price', (isset($sInfo->specials_new_products_price) ? $sInfo->specials_new_products_price : '')); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_SPECIALS_EXPIRES_DATE; ?> </td>

<td class="main"><?php echo tep_draw_input_field('day', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('month', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('year', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="java script:calClick();return false;" onmouseover="calSwapImg('BTN_date', 'img_Date_OVER',true);" onmouseout="calSwapImg('BTN_date', 'img_Date_UP',true);" onclick="calSwapImg('BTN_date', 'img_Date_DOWN');showCalendar('new_special','dteWhen','BTN_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_date"'); ?></a></td>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><br><?php echo TEXT_SPECIALS_PRICE_TIP; ?></td>

<td class="main" align="right" valign="top"><br><?php echo (($form_action == 'insert') ? tep_image_submit('button_insert.gif', IMAGE_INSERT) : tep_image_submit('button_update.gif', IMAGE_UPDATE)). '   <a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . (isset($HTTP_GET_VARS['sID']) ? '&sID=' . $HTTP_GET_VARS['sID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>

</tr>

</table></td>

</form></tr>

<?php

} else {

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRODUCTS_PRICE; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>

</tr>

<?php

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id order by pd.products_name";

$specials_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $specials_query_raw, $specials_query_numrows);

$specials_query = tep_db_query($specials_query_raw);

while ($specials = tep_db_fetch_array($specials_query)) {

if ((!isset($HTTP_GET_VARS['sID']) || (isset($HTTP_GET_VARS['sID']) && ($HTTP_GET_VARS['sID'] == $specials['specials_id']))) && !isset($sInfo)) {

$products_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$specials['products_id'] . "'");

$products = tep_db_fetch_array($products_query);

$sInfo_array = array_merge($specials, $products);

$sInfo = new objectInfo($sInfo_array);

}

 

if (isset($sInfo) && is_object($sInfo) && ($specials['specials_id'] == $sInfo->specials_id)) {

echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=edit') . ''">' . "n";

} else {

echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials['specials_id']) . ''">' . "n";

}

?>

<td class="dataTableContent"><?php echo $specials['products_name']; ?></td>

<td class="dataTableContent" align="right"><span class="oldPrice"><?php echo $currencies->format($specials['products_price']); ?></span> <span class="specialPrice"><?php echo $currencies->format($specials['specials_new_products_price']); ?></span></td>

<td class="dataTableContent" align="right">

<?php

if ($specials['status'] == '1') {

echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '  <a href="' . tep_href_link(FILENAME_SPECIALS, 'action=setflag&flag=0&id=' . $specials['specials_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';

} else {

echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'action=setflag&flag=1&id=' . $specials['specials_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>  ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);

}

?></td>

<td class="dataTableContent" align="right"><?php if (isset($sInfo) && is_object($sInfo) && ($specials['specials_id'] == $sInfo->specials_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials['specials_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>

</tr>

<?php

}

?>

<tr>

<td colspan="4"><table border="0" width="100%" cellpadding="0"cellspacing="2">

<tr>

<td class="smallText" valign="top"><?php echo $specials_split->display_count($specials_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>

<td class="smallText" align="right"><?php echo $specials_split->display_links($specials_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>

</tr>

<?php

if (empty($action)) {

?>

<tr>

<td colspan="2" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&action=new') . '">' . tep_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . '</a>'; ?></td>

</tr>

<?php

}

?>

</table></td>

</tr>

</table></td>

<?php

$heading = array();

$contents = array();

 

switch ($action) {

case 'delete':

$heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SPECIALS . '</b>');

 

$contents = array('form' => tep_draw_form('specials', FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=deleteconfirm'));

$contents[] = array('text' => TEXT_INFO_DELETE_INTRO);

$contents[] = array('text' => '<br><b>' . $sInfo->products_name . '</b>');

$contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');

break;

default:

if (is_object($sInfo)) {

$heading[] = array('text' => '<b>' . $sInfo->products_name . '</b>');

 

$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');

$contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . tep_date_short($sInfo->specials_date_added));

$contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . tep_date_short($sInfo->specials_last_modified));

$contents[] = array('align' => 'center', 'text' => '<br>' . tep_info_image($sInfo->products_image, $sInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT));

$contents[] = array('text' => '<br>' . TEXT_INFO_ORIGINAL_PRICE . ' ' . $currencies->format($sInfo->products_price));

$contents[] = array('text' => '' . TEXT_INFO_NEW_PRICE . ' ' . $currencies->format($sInfo->specials_new_products_price));

$contents[] = array('text' => '' . TEXT_INFO_PERCENTAGE . ' ' . number_format(100 - (($sInfo->specials_new_products_price / $sInfo->products_price) * 100)) . '%');

 

$contents[] = array('text' => '<br>' . TEXT_INFO_EXPIRES_DATE . ' <b>' . tep_date_short($sInfo->expires_date) . '</b>');

$contents[] = array('text' => '' . TEXT_INFO_STATUS_CHANGE . ' ' . tep_date_short($sInfo->date_status_change));

}

break;

}

if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {

echo ' <td width="25%" valign="top">' . "n";

 

$box = new box;

echo $box->infoBox($heading, $contents);

 

echo ' </td>' . "n";

}

}

?>

</tr>

</table></td>

</tr>

</table></td>

<!-- body_text_eof //-->

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

:blink:

Knowledge Base

 

In Perfect Love, And Perfect Trust. The Circle Is Open, But Never Broken!

Link to comment
Share on other sites

when you place code, enclose it between the

 and the

and then try to limit it to the area in question. without line #'s not many will look at the code especialy long programs.

Link to comment
Share on other sites

it didnt let me do the ending code, so this is an example:

your lines 146 to 160, from the copy i just made

 

?>
<tr><form name="new_special" <?php echo 'action="' . tep_href_link(FILENAME_SPECIALS, tep_get_all_get_params(array('action', 'info', 'sID')) . 'action=' . $form_action, 'NONSSL') . '"'; ?> method="post"><?php if ($form_action == 'update') echo tep_draw_hidden_field('specials_id', $HTTP_GET_VARS['sID']); ?>
<td><br><table border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><?php echo TEXT_SPECIALS_PRODUCT; ?> </td>
<td class="main"><?php echo (isset($sInfo->products_name)) ? $sInfo->products_name . ' <small>(' . $currencies->format($sInfo->products_price) . ')</small>' : tep_draw_products_pull_down('products_id', 'style="font-size:10px"', $specials_array); echo tep_draw_hidden_field('products_price', (isset($sInfo->products_price) ? $sInfo->products_price : '')); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_SPECIALS_SPECIAL_PRICE; ?> </td>
<td class="main"><?php echo tep_draw_input_field('specials_price', (isset($sInfo->specials_new_products_price) ? $sInfo->specials_new_products_price : '')); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_SPECIALS_EXPIRES_DATE; ?> </td>
<td class="main"><?php echo tep_draw_input_field('day', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('month', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('year', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="javascript:calClick();return false;" onmouseover="calSwapImg('BTN_date', 'img_Date_OVER',true);" onmouseout="calSwapImg('BTN_date', 'img_Date_UP',true);" onclick="calSwapImg('BTN_date', 'img_Date_DOWN');showCalendar('new_special','dteWhen','BTN_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_date"'); ?></a></td>
</tr>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...