Forums / General Questions / Parse error: syntax error, unexpected $end Error when loading cart

Parse error: syntax error, unexpected $end Error when loading cart

Locked

Started by maperr55 on 26 Jul 2009, 10:19 PM · Views: 8,923

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
26 Jul 2009, 10:19 PM
#1
maperr55 avatar

maperr55

Zen Follower

Join Date:
Aug 2007
Location:
Manitou Beach, Michigan
Posts:
357
Plugin Contributions:
0

Parse error: syntax error, unexpected $end Error when loading cart

Hi,
I am getting an error when I try to load my cart.
Parse error: syntax error, unexpected $end in /hsphere/local/home/pcccompu/pcccomputer.com/pccmedia/includes/modules/meta_tags.php on line 154.

here is a copy of that file:

<?php
/**
 * meta_tags module
 *
 * @package modules
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license [url]http://www.zen-cart.com/license/2_0.txt[/url] GNU Public License V2.0
 * @version $Id: meta_tags.php 4960 2006-11-20 01:46:46Z drbyte $
 */
if (!defined('IS_ADMIN_FLAG')) {
  die('Illegal Access');
}
// This should be first line of the script:
$zco_notifier->notify('NOTIFY_MODULE_START_META_TAGS');


/////////////////////////////////////////////////////////
// Moved to /includes/languages/english/meta_tags.php
//
// Define Primary Section Output
//  define('PRIMARY_SECTION', ' : ');

// Define Secondary Section Output
//  define('SECONDARY_SECTION', ' - ');

// Define Tertiary Section Output
//  define('TERTIARY_SECTION', ', ');

//
/////////////////////////////////////////////////////////

// Add tertiary section to site tagline
if (strlen(SITE_TAGLINE) > 1) {
  define('TAGLINE', TERTIARY_SECTION . SITE_TAGLINE);
} else {
  define('TAGLINE', '');
}

$review_on = "";
$keywords_string_metatags = "";
$meta_tags_over_ride = false;
if (!defined('METATAGS_DIVIDER')) define('METATAGS_DIVIDER', ' ');

// Get all top category names for use with web site keywords
//$sql = "select cd.categories_name from " . TABLE_CATEGORIES . " c, " . //TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = ".CATEGORIES_ROOT." and //c.categories_id = cd.categories_id and cd.language_id='" . (int)$_SESSION['languages_id'] . "' //and c.categories_status=1";
//$keywords_metatags = $db->Execute(cat_filter($sql));
//$keywords_metatags = $db->Execute($sql);
//while (!$keywords_metatags->EOF) {
 // $keywords_string_metatags .= $keywords_metatags->fields['categories_name'] . //METATAGS_DIVIDER;
 // $keywords_metatags->MoveNext();
//}
define('KEYWORDS', str_replace('"','',zen_clean_html($keywords_string_metatags) . CUSTOM_KEYWORDS));

// Get different meta tag values depending on main_page values
switch ($_GET['main_page']) {
  case 'advanced_search':
  case 'account_edit':
  case 'account_history':
  case 'account_history_info':
  case 'account_newsletters':
  case 'account_notifications':
  case 'account_password':
  case 'address_book':
  define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE . TAGLINE);
  define('META_TAG_DESCRIPTION', TITLE . PRIMARY_SECTION . NAVBAR_TITLE_1 . SECONDARY_SECTION . KEYWORDS);
  define('META_TAG_KEYWORDS', KEYWORDS . METATAGS_DIVIDER . NAVBAR_TITLE_1);
  break;

  case 'address_book_process':
  define('META_TAG_TITLE', NAVBAR_TITLE_ADD_ENTRY . PRIMARY_SECTION . TITLE . TAGLINE);
  define('META_TAG_DESCRIPTION', TITLE . PRIMARY_SECTION . NAVBAR_TITLE_ADD_ENTRY . SECONDARY_SECTION . KEYWORDS);
  define('META_TAG_KEYWORDS', KEYWORDS . METATAGS_DIVIDER . NAVBAR_TITLE_ADD_ENTRY);
  break;

  case 'advanced_search_result':
  case 'password_forgotten':
  define('META_TAG_TITLE', NAVBAR_TITLE_2 . PRIMARY_SECTION . TITLE . TAGLINE);
  define('META_TAG_DESCRIPTION', TITLE . PRIMARY_SECTION . NAVBAR_TITLE_2 . SECONDARY_SECTION . KEYWORDS);
  define('META_TAG_KEYWORDS', KEYWORDS . METATAGS_DIVIDER . NAVBAR_TITLE_2);
  break;

  case 'checkout_confirmation':
  case 'checkout_payment':
  case 'checkout_payment_address':
  case 'checkout_shipping':
  case 'checkout_success':
  case 'create_account_success':
  define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE . TAGLINE);
  define('META_TAG_DESCRIPTION', TITLE . PRIMARY_SECTION . HEADING_TITLE . SECONDARY_SECTION . KEYWORDS);
  define('META_TAG_KEYWORDS', KEYWORDS . METATAGS_DIVIDER . HEADING_TITLE);
  break;

  case 'index':
  // bof: categories meta tags
  // run custom categories meta tags
  $sql = "select * from " . TABLE_METATAGS_CATEGORIES_DESCRIPTION . " mcd where mcd.categories_id = '" . (int)$current_category_id . "' and mcd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
  $category_metatags = $db->Execute(cat_filter($sql));
  if (!$category_metatags->EOF) {
    define('META_TAG_TITLE', str_replace('"','',$category_metatags->fields['metatags_title']));
    define('META_TAG_DESCRIPTION', str_replace('"','',$category_metatags->fields['metatags_description']));
    define('META_TAG_KEYWORDS', str_replace('"','',$category_metatags->fields['metatags_keywords']));
  } else {
    // build categories meta tags
    // eof: categories meta tags
    if ($category_depth == 'nested') {
      $sql = "select cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' and c.categories_status=1";
     $category_metatags = $db->Execute(cat_filter($sql));
      if ($category_metatags->EOF) {
        $meta_tags_over_ride = true;
      } else {
        define('META_TAG_TITLE', str_replace('"','',$category_metatags->fields['categories_name'] . PRIMARY_SECTION . TITLE . TAGLINE));
        define('META_TAG_DESCRIPTION', str_replace('"','',TITLE . PRIMARY_SECTION . $category_metatags->fields['categories_name'] . SECONDARY_SECTION . KEYWORDS));
        define('META_TAG_KEYWORDS', str_replace('"','',KEYWORDS . METATAGS_DIVIDER . $category_metatags->fields['categories_name']));
      } // EOF
    } elseif ($category_depth == 'products') {
      if (isset($_GET['manufacturers_id']) || ((isset($_GET['filter_id']) && $_GET['filter_id'] > 0) && isset($_GET['cPath'])) ) {
        if ((isset($_GET['filter_id']) && isset($_GET['cPath'])) ) {
          $include_manufacturers_id = $_GET['filter_id'];
        } else {
          $include_manufacturers_id = $_GET['manufacturers_id'];
        }
        $sql = "select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$include_manufacturers_id . "'";
        $manufacturer_metatags = $db->Execute($sql);
        if ($manufacturer_metatags->EOF) {
          $meta_tags_over_ride = true;
        } else {
          define('META_TAG_TITLE', str_replace('"','',$manufacturer_metatags->fields['manufacturers_name'] . PRIMARY_SECTION . TITLE . TAGLINE));
          define('META_TAG_DESCRIPTION', str_replace('"','',TITLE . PRIMARY_SECTION . $manufacturer_metatags->fields['manufacturers_name'] . SECONDARY_SECTION . KEYWORDS));
          define('META_TAG_KEYWORDS', str_replace('"','', $manufacturer_metatags->fields['manufacturers_name'] . METATAGS_DIVIDER . KEYWORDS));
        } // EOF
      } else {
        $sql = "select cd.categories_name from " . TABLE_CATEGORIES . ' c, ' . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' and c.categories_status=1";
        $category_metatags = $db->Execute($sql);
        if ($category_metatags->EOF) {
          $meta_tags_over_ride = true;
        } else {
          define('META_TAG_TITLE', str_replace('"','',$category_metatags->fields['categories_name'] . PRIMARY_SECTION . TITLE . TAGLINE));
          define('META_TAG_DESCRIPTION', str_replace('"','',TITLE . PRIMARY_SECTION . $category_metatags->fields['categories_name'] . SECONDARY_SECTION . KEYWORDS));
          define('META_TAG_KEYWORDS', str_replace('"','',KEYWORDS . METATAGS_DIVIDER . $category_metatags->fields['categories_name']));
        } // EOF
      }
    } else {
      if (isset($_GET['manufacturers_id'])) {
        $sql = "select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "'";
        $manufacturer_metatags = $db->Execute($sql);
        if ($manufacturer_metatags->EOF) {
          define('META_TAG_TITLE', TITLE . TAGLINE);
          define('META_TAG_DESCRIPTION', TITLE . PRIMARY_SECTION . str_replace(array("'",'"'),'',strip_tags(HEADING_TITLE)) . SECONDARY_SECTION . KEYWORDS);
          define('META_TAG_KEYWORDS', KEYWORDS . METATAGS_DIVIDER . str_replace(array("'",'"'),'',strip_tags(HEADING_TITLE)));
        } else {
          define('META_TAG_TITLE', str_replace('"','', $manufacturer_metatags->fields['manufacturers_name'] . PRIMARY_SECTION . TITLE . TAGLINE));

++++++ The line above is where the error is reported yet I can't see what is wrong with it. ++++
HELP

27 Jul 2009, 8:33 PM
#2
tony_sar avatar

tony_sar

Totally Zenned

Join Date:
Jul 2006
Location:
Montreal, Canada
Posts:
2,276
Plugin Contributions:
0

Re: Parse error: syntax error, unexpected $end Error when loading cart

on my zencart that is not Line 154 . if so , then you are missing end statements ..
after
define('META_TAG_TITLE', str_replace('"','', $manufacturer_metatags->fields['manufacturers_name'] . PRIMARY_SECTION . TITLE . TAGLINE));

you should have

}
}

followed by rest of the code starting with else statement

30 Aug 2009, 6:33 PM
#3
musicgeek avatar

musicgeek

New Zenner

Join Date:
Aug 2009
Posts:
2
Plugin Contributions:
0

Re: Parse error: syntax error, unexpected $end Error when loading cart

Hi,

RE: Parse error: syntax error, unexpected $end in......./includes/languages/english.php on line 446

I am another newbie and need some help with this. I've read many of the Q&A and can't seem to solve my issue. I just loaded my Zencart and have been using the classic template and have been trying to change the sidebars. In my attempt to change the
"more information" sidebar's pages to specific words.
I went into the language/english.php and downloaded it to Dreamweaver and changed the names, saved it and when I finished uploaded the file back to my language folder.

I tried to view my site I got an error. (I noticed that my english.php ended in mid sentence at line 447--- (I must have deleated it accidentally) ----- after realizing that I didn't back up my file I loaded ZENCART to another domain name and went to the same folder and copied the exact file and loaded it to my current zencart's languages folder to replace the english.php file.

It worked! My site was active. I'm not sure why. But then....

I tried to go to the admin page and I got this error;

Parse error: syntax error, unexpected $end in......../includes/languages/english.php on line 446

When I go to the english.php file there is no words on line 446. I checked the code above and below and it all looks good. If anybody could help me out I'd appreciate it.
Here are the facts:

(I just loaded this cart and started working on it last Friday: I think it's the latest version....) see below:

<?php /** * @package languageDefines * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: english.php 5454 2006-12-29 20:10:17Z drbyte $ */ // FOLLOWING WERE moved to meta_tags.php //define('TITLE', 'Zen Cart!'); //define('SITE_TAGLINE', 'The Art of E-commerce'); //define('CUSTOM_KEYWORDS', 'ecommerce, open source, shop, online shopping'); // END: moved to meta_tags.php
30 Aug 2009, 7:29 PM
#4
musicgeek avatar

musicgeek

New Zenner

Join Date:
Aug 2009
Posts:
2
Plugin Contributions:
0

Re: Parse error: syntax error, unexpected $end Error when loading cart

Hey musigeek here again with more info for the above post....
Here is the code. Somehow it didn't get posted on my last one....
(this is from line 400-510)

[code]
define('ENTRY_FIRST_NAME_TEXT', '*');

define('ENTRY_LAST_NAME', 'Last Name:');

define('ENTRY_LAST_NAME_ERROR', 'Is your last name correct? Our system requires a minimum of ' . ENTRY_LAST_NAME_MIN_LENGTH . ' characters. Please try again.');

define('ENTRY_LAST_NAME_TEXT', '*');

define('ENTRY_DATE_OF_BIRTH', 'Date of Birth:');

define('ENTRY_DATE_OF_BIRTH_ERROR', 'Is your birth date correct? Our system requires the date in this format: MM/DD/YYYY (eg 05/21/1970)');

define('ENTRY_DATE_OF_BIRTH_TEXT', '* (eg. 05/21/1970)');

define('ENTRY_EMAIL_ADDRESS', 'Email Address:');

define('ENTRY_EMAIL_ADDRESS_ERROR', 'Is your email address correct? It should contain at least ' . ENTRY_EMAIL_ADDRESS_MIN_LENGTH . ' characters. Please try again.');

define('ENTRY_EMAIL_ADDRESS_CHECK_ERROR', 'Sorry, my system does not understand your email address. Please try again.');

define('ENTRY_EMAIL_ADDRESS_ERROR_EXISTS', 'Our system already has a record of that email address - please try logging in with that email address. If you do not use that address any longer you can correct it in the My Account area.');

define('ENTRY_EMAIL_ADDRESS_TEXT', '*');

define('ENTRY_NICK', 'Forum Nick Name:');

define('ENTRY_NICK_TEXT', '*'); // note to display beside nickname input field

define('ENTRY_NICK_DUPLICATE_ERROR', 'That Nick Name is already being used. Please try another.');

define('ENTRY_NICK_LENGTH_ERROR', 'Please try again. Your Nick Name must contain at least ' . ENTRY_NICK_MIN_LENGTH . ' characters.');

define('ENTRY_STREET_ADDRESS', 'Street Address:');

define('ENTRY_STREET_ADDRESS_ERROR', 'Your Street Address must contain a minimum of ' . ENTRY_STREET_ADDRESS_MIN_LENGTH . ' characters.');

define('ENTRY_STREET_ADDRESS_TEXT', '*');

define('ENTRY_SUBURB', 'Address Line 2:');

define('ENTRY_SUBURB_ERROR', '');

define('ENTRY_SUBURB_TEXT', '');

define('ENTRY_POST_CODE', 'Post/Zip Code:');

define('ENTRY_POST_CODE_ERROR', 'Your Post/ZIP Code must contain a minimum of ' . ENTRY_POSTCODE_MIN_LENGTH . ' characters.');

define('ENTRY_POST_CODE_TEXT', '*');

define('ENTRY_CITY', 'City:');

define('ENTRY_CUSTOMERS_REFERRAL', 'Referral Code:');

define('ENTRY_CITY_ERROR', 'Your City must contain a minimum of ' . ENTRY_CITY_MIN_LENGTH . ' characters.');

define('ENTRY_CITY_TEXT', '*');

define('ENTRY_STATE', 'State/Province:');

define('ENTRY_STATE_ERROR', 'Your State must contain a minimum of ' . ENTRY_STATE_MIN_LENGTH . ' characters.');

define('ENTRY_STATE_ERROR_SELECT', 'Please select a state from the States pull down menu.');

define('ENTRY_STATE_TEXT', '*');

define('JS_STATE_SELECT', '-- Please Choose --');

define('ENTRY_COUNTRY', 'Country:');

define('ENTRY_COUNTRY_ERROR', 'You must select a country from the Countries pull down menu.');

define('ENTRY_COUNTRY_TEXT', '*');

define('ENTRY_TELEPHONE_NUMBER', 'Telephone:');

define('ENTRY_TELEPHONE_NUMBER_ERROR', 'Your Telephone Number must contain a minimum of ' . ENTRY_TELEPHONE_MIN_LENGTH . ' characters.');

define('ENTRY_TELEPHONE_NUMBER_TEXT', '*');

define('ENTRY_FAX_NUMBER', 'Fax Number:');

define('ENTRY_FAX_NUMBER_ERROR', '');

define('ENTRY_FAX_NUMBER_TEXT', '');

define('ENTRY_NEWSLETTER', 'Subscribe to Our Newsletter.');

define('ENTRY_NEWSLETTER_TEXT', '');

define('ENTRY_NEWSLETTER_YES', 'Subscribed');

define('ENTRY_NEWSLETTER_NO', 'Unsubscribed');

define('ENTRY_NEWSLETTER_ERROR', '');

define('ENTRY_PASSWORD', 'Password:');
[code]

line 445-447 are these:
[code]
define('ENTRY_POST_CODE', 'Post/Zip Code:');

define('ENTRY_POST_CODE_ERROR', 'Your Post/ZIP Code must contain a minimum of ' . ENTRY_POSTCODE_MIN_LENGTH . ' characters.');

30 Aug 2009, 8:26 PM
#5
chuck avatar

chuck

Totally Zenned

Join Date:
Jul 2005
Posts:
255
Plugin Contributions:
0

Re: Parse error: syntax error, unexpected $end Error when loading cart

unexpected $end -- that usually means the file is incomplete or you've created a syntax error by introducing mismatched braces like { and }