Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /admin/categories.php


jamesblackburn

Recommended Posts

Posted

Hi guys,

 

I am upgrading my site to 2.2rca2 and am also wanting to add the Module "product specifications".

 

I am getting an error in my admin/categories.php file as follows:

 

unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /admin/categories.php

 

// Get parent_id for subcategories if search
     if (isset($HTTP_GET_VARS['search'])) $cPath= $categories['parent_id'];

     if ((!isset($HTTP_GET_VARS['cID']) && !isset($HTTP_GET_VARS['pID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $categories['categories_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
       $category_childs = array('childs_count' => tep_childs_in_category_count($categories['categories_id']));
       $category_products = array('products_count' => tep_products_in_category_count($categories['categories_id']));

       $cInfo_array = array_merge($categories, $category_childs, $category_products);
       $cInfo = new objectInfo($cInfo_array);
     }

     if (isset($cInfo) && is_object($cInfo) && ($categories['categories_id'] == $cInfo->categories_id) ) {
       echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . '\'">' . "\n";
     } else {
       echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories['categories_id']) . '\'">' . "\n";
     }
?>
               <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . '">' . tep_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . '</a> <b>' . $categories['categories_name'] . '</b>'; ?></td>
               <td class="dataTableContent" align="center"> </td>
               <td class="dataTableContent" align="right"><?php if (isset($cInfo) && is_object($cInfo) && ($categories['categories_id'] == $cInfo->categories_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories['categories_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
             </tr>
<?php
   }

   $products_count = 0;
   if (isset($HTTP_GET_VARS['search'])) {
     $products_query = tep_db_query("select p.products_ship_price, p.products_id, pd.products_name, pd.products_dim_note, p.products_quantity, p.products_ext_h, p.products_ext_w, p.products_ext_d, p.products_int_h, p.products_int_w, p.products_int_d, p.products_litres, p.products_image, p.products_image_2, p.products_image_3, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status,  p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like
  '%" . tep_db_input($search) . "%' order by pd.products_name");
   } else {
     $products_query = tep_db_query("select p.products_ship_price, p.products_id, pd.products_name, pd.products_dim_note, p.products_quantity, p.products_ext_h, p.products_ext_w, p.products_ext_d, p.products_int_h, p.products_int_w, p.products_int_d, p.products_litres, p.products_image, p.products_image_2, p.products_image_3, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name");
   }
   while ($products = tep_db_fetch_array($products_query)) {
     $products_count++;
     $rows++;

 

It creates an error_log on this line:

 

echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . '\'">' . "\n";

 

Hope you guys can help me on this one.

 

Thanks

 

 

James

Posted

Is that a cut and paste of the error message, or did you type it in? It doesn't seem to quite match the line (echo ' <tr...) with a lot of blanks between the opening ' and the <tr. The code, otherwise, looks fine (and matches vanilla osC). Are you showing us the wrong file? Is this the unmodified categories.php, or definitely post-mod installation? Please check. The file name and line number in the error_log match up with this file and line? If this is not the correct version of the file, be sure to check the immediately preceding lines -- sometimes an error there (missing ; or { or ' especially) can trip an error in the following line, which by itself is perfectly valid.

Posted

Is that a cut and paste of the error message, or did you type it in? It doesn't seem to quite match the line (echo ' <tr...) with a lot of blanks between the opening ' and the <tr. The code, otherwise, looks fine (and matches vanilla osC). Are you showing us the wrong file? Is this the unmodified categories.php, or definitely post-mod installation? Please check. The file name and line number in the error_log match up with this file and line? If this is not the correct version of the file, be sure to check the immediately preceding lines -- sometimes an error there (missing ; or { or ' especially) can trip an error in the following line, which by itself is perfectly valid.

 

Hi MrPhil,

 

Thank you for the reply. It is definately the right code and it matches with the file name and line number.

 

[07-Jul-2010 14:56:33] PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /admin/categories.php on line 1405

 

If you want me to paste anymore code let me know failing that I have no clue why it is doing this as it matches Vanilla osC like you say.

 

 

Thanks in advance

 

 

James

Posted

Are you sure you've got the correct line 1405? Are you handling the file in a good editor that knows how to count lines? I'm wondering if maybe the line 1405 is someplace other than the line you listed (it's line 798 in vanilla osC). I've looked at everything you listed and nothing jumps out at me as an error. I don't want you to paste in the entire file, but I do note that my vanilla copy of admin/categories.php is only 1035 lines long, so your mod must have added quite a bit of code. Please double check that you've got the right file (and it's the one actually being run) and recheck line 1405, using a text editor that counts lines for you (it's too easy to slip up counting manually).

Posted

Are you sure you've got the correct line 1405? Are you handling the file in a good editor that knows how to count lines? I'm wondering if maybe the line 1405 is someplace other than the line you listed (it's line 798 in vanilla osC). I've looked at everything you listed and nothing jumps out at me as an error. I don't want you to paste in the entire file, but I do note that my vanilla copy of admin/categories.php is only 1035 lines long, so your mod must have added quite a bit of code. Please double check that you've got the right file (and it's the one actually being run) and recheck line 1405, using a text editor that counts lines for you (it's too easy to slip up counting manually).

 

 

Hi, I am using Dreamweaver and it showed a correct line number for another error I fixed so I am positive that it is the right line number.

 

Sounds like I have a massive problem here!

 

I have done several mods to the categories.php file to suit my needs, I would say only the most popular ones though.

 

Where from here do you think?

Posted

Dreamweaver is a very bad choice to use for PHP code editing. Does the line 1405 it gives you make sense? Have you confirmed that there are at least that many lines in the file (perhaps using Notepad, or your hosting service file editor)? I just have to wonder where line 1405 really is, in your file. I would strongly suggest that you switch to ViM or Notepad++ for your editing needs. I just can't see anything wrong on the line you showed, and neighboring lines.

Posted

Dreamweaver is a very bad choice to use for PHP code editing. Does the line 1405 it gives you make sense? Have you confirmed that there are at least that many lines in the file (perhaps using Notepad, or your hosting service file editor)? I just have to wonder where line 1405 really is, in your file. I would strongly suggest that you switch to ViM or Notepad++ for your editing needs. I just can't see anything wrong on the line you showed, and neighboring lines.

 

 

Hi,

 

I am completely baffled as I download Notepad++ and the same line is 1405 so its definately correct.

 

My file has 1665 lines in it.

 

Starting to pull teeth out now as this is getting silly!

 

Thanks for you advice so far and your time.

 

 

James

Posted

Well, if you're confident that what you gave as line 1405 is correct, I just don't know what to say. It appears to be correct code several lines before and after. The only thing I can suggest is to put the file into a PHP- and HTML-aware editor that color codes keywords, strings, etc. (ViM does this; I don't know about Notepad++). Take a careful look around the vicinity of line 1405 and see if anything looks amiss -- say, what should be keywords are part of a continuous string, or something odd like that. I did this with the chunk of code you posted, and it didn't reveal anything odd, but maybe there's something wrong just upstream of it? Sorry.

Archived

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

×
×
  • Create New...