Jump to content
zonetown

[Contribution] QTpro - Quantity Tracking Professional

Recommended Posts

Hi, can some one tell me how to fix this error?

 

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in C:\wamp\www\admin\products_attributes.php on line 290

Share this post


Link to post
Share on other sites

Well today I looked at the code again and I found the errors and I corrected them.

 

I do have another question. On the stock report table in the prodects info page, how would I have it tell the stock when less than 10 or less are available, and have it say "more than 10 available" when there are more than 10 in stock. This is actually like what ebay does.

- Luc

 

This is what it looks like now:

http://www.jumbledfun.com/onstock.jpg

 

Hello,

 

I have the same error, can you tell me where is(are) the error(s) ?

 

Thank you.

Share this post


Link to post
Share on other sites

It's all fine now. I figured out how to do this my self. I just had to use an if statement.

- Luc

 

Could you please post the changes you made to correct the unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' error?

Share this post


Link to post
Share on other sites

The problem line in admin/products_attributes.php is:

$option_name = tep_db_query("select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . $options_values['products_options_id'] . "' and language_id = '" . $languages[$i]['id'] . "'");

 

And did not cause errors before QT Pro was installed.

Share this post


Link to post
Share on other sites

In the QT Pro 4.6.1 install instructions for the admin/product_attributes.php file there is a warning that says

 

Warning: Some people may find that some of the echo's are "bugged".

If it is, go into the old file, and find what should come after the corresponding echo's in the new file. Paste that code after the echo.

 

Which echos?

There are many in that file and some are form related.

Share this post


Link to post
Share on other sites

 

Could you please post the changes you made to correct the unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' error?

 

Please - I have the same error and clueless on how to resolve it.

Share this post


Link to post
Share on other sites

Hi All,

 

I found the root cause of the error - "unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' error?" on line 290.

 

Its solution is mentioned in the file - Manual_for_2.3.1.html, which has the step by step instructions. A bit of clarity is required, though.

 

For manual step 11.3, the section that mentions :

Find: <!-- options //-->

to <!-- options eof //--> Change all between to:

 

In the code given to be replaced, there are 4 unfinished "echo" statements (with no code immediately following the '). The statements are just displayed as follows:

 

echo '

 

The instruction in the manual states to add the code from your existing "admin/products_attributes.php" file to complete each of the corresponding echo statements. In my case, I was using the vanilla products_attributes.php which came default with the OSC 2.3.1 install. I have replaced the echo statements accordingly and the code works!

 

If you simply copy the code from step 11.3 into notepad, the unfinished echo ' statements are on Line 119, 138, 175, & 190.

 

The complete code for step 11.3 which worked for me is given below:

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

<!-- options //-->
<?php
 if ($action == 'delete_product_option') { // delete product option
   $options = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$HTTP_GET_VARS['option_id'] . "' and language_id = '" . (int)$languages_id . "'");
   $options_values = tep_db_fetch_array($options);
?>
		  <tr>
		    <td class="pageHeading"> <?php echo $options_values['products_options_name']; ?> </td>
		  </tr>
		  <tr>
		    <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
			    <td colspan="3"><?php echo tep_black_line(); ?></td>
			  </tr>
<?php
   $products = tep_db_query("select p.products_id, pd.products_name, pov.products_options_values_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pov.language_id = '" . (int)$languages_id . "' and pd.language_id = '" . (int)$languages_id . "' and pa.products_id = p.products_id and pa.options_id='" . (int)$HTTP_GET_VARS['option_id'] . "' and pov.products_options_values_id = pa.options_values_id order by pd.products_name");
   if (tep_db_num_rows($products)) {
?>
			  <tr class="dataTableHeadingRow">
			    <td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ID; ?> </td>
			    <td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT; ?> </td>
			    <td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_VALUE; ?> </td>
			  </tr>
			  <tr>
			    <td colspan="3"><?php echo tep_black_line(); ?></td>
			  </tr>
<?php
  $rows = 0;
  while ($products_values = tep_db_fetch_array($products)) {
    $rows++;
?>
			  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
			    <td align="center" class="smallText"> <?php echo $products_values['products_id']; ?> </td>
			    <td class="smallText"> <?php echo $products_values['products_name']; ?> </td>
			    <td class="smallText"> <?php echo $products_values['products_options_values_name']; ?> </td>
			  </tr>
<?php
  }
?>
			  <tr>
			    <td colspan="3"><?php echo tep_black_line(); ?></td>
			  </tr>
			  <tr>
			    <td colspan="3" class="main"><br><?php echo TEXT_WARNING_OF_DELETE; ?></td>
			  </tr>
			  <tr>
			    <td align="right" colspan="3" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a> </td>
			  </tr>
<?php
   } else {
?>
			  <tr>
			    <td class="main" colspan="3"><br><?php echo TEXT_OK_TO_DELETE; ?></td>
			  </tr>
			  <tr>
			    <td class="main" align="right" colspan="3"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_option&option_id=' . $HTTP_GET_VARS['option_id'] . '&' . $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_delete.gif', ' delete '); ?></a>   <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a> </td>
			  </tr>
<?php
   }
?>
		    </table></td>
		  </tr>
<?php
 } else {
?>
		  <tr>
		    <td colspan="3" class="pageHeading"> <?php echo HEADING_TITLE_OPT; ?> </td>
		  </tr>
		  <tr>
		    <td colspan="3" class="smallText" align="right">
<?php
   $options = "select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "' order by products_options_id";
   $options_split = new splitPageResults($option_page, MAX_ROW_LISTS_OPTIONS, $options, $options_query_numrows);
   echo $options_split->display_links($options_query_numrows, MAX_ROW_LISTS_OPTIONS, MAX_DISPLAY_PAGE_LINKS, $option_page, 'value_page=' . $value_page . '&attribute_page=' . $attribute_page, 'option_page');
?>
		    </td>
		  </tr>
		  <tr>
<?php
//++++ QT Pro: Begin Changed code
?>
		    <td colspan="4"><?php echo tep_black_line(); ?></td>
<?php
//++++ QT Pro: End Changed Code
?>
		  </tr>
		  <tr class="dataTableHeadingRow">
		    <td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_ID; ?> </td>
		    <td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_NAME; ?> </td>
<?php
//++++ QT Pro: Begin Changed code
?>
		    <td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_TRACK_STOCK; ?> </td>
<?php
//++++ QT Pro: End Changed Code
?>
		    <td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ACTION; ?> </td>
		  </tr>
		  <tr>
<?php
//++++ QT Pro: Begin Changed code
?>
		    <td colspan="4"><?php echo tep_black_line(); ?></td>
<?php
//++++ QT Pro: End Changed Code
?>
		  </tr>
<?php
   $next_id = 1;
   $rows = 0;
   $options = tep_db_query($options);
   while ($options_values = tep_db_fetch_array($options)) {
  $rows++;
?>
		  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
<?php
  if (($action == 'update_option') && ($HTTP_GET_VARS['option_id'] == $options_values['products_options_id'])) {
    echo '<form name="option" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_option_name&' . $page_info, 'NONSSL') . '" method="post">';
    $inputs = '';
    for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
	  $option_name = tep_db_query("select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . $options_values['products_options_id'] . "' and language_id = '" . $languages[$i]['id'] . "'");
	  $option_name = tep_db_fetch_array($option_name);
	  $inputs .= $languages[$i]['code'] . ': <input type="text" name="option_name[' . $languages[$i]['id'] . ']" size="20" value="' . $option_name['products_options_name'] . '"> <br>';
    }
?>
		    <td align="center" class="smallText"> <?php echo $options_values['products_options_id']; ?><input type="hidden" name="option_id" value="<?php echo $options_values['products_options_id']; ?>"> </td>
		    <td class="smallText"><?php echo $inputs; ?></td>
<?php
//++++ QT Pro: Begin Changed code
?>
		    <td align="center" class="smallText"><input type=checkbox name=track_stock <?php echo $options_values['products_options_track_stock']?"checked":""; ?>></td>
<?php
//++++ QT Pro: End Changed Code
?>
		    <td align="center" class="smallText"> <?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a> </td>
<?php
    echo '</form>' . "\n";
  } else {
?>
		    <td align="center" class="smallText"> <?php echo $options_values["products_options_id"]; ?> </td>
		    <td class="smallText"> <?php echo $options_values["products_options_name"]; ?> </td>
<?php
//++++ QT Pro: Begin Changed code
?>
		    <td align="center" class="smallText"> <?php echo $options_values['products_options_track_stock']?"Yes":"No"; ?></td>
<?php
//++++ QT Pro: End Changed Code
?>
		    <td align="center" class="smallText"> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_option&option_id=' . $options_values['products_options_id'] . '&' . $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_edit.gif', IMAGE_UPDATE); ?></a>  <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_product_option&option_id=' . $options_values['products_options_id'] . '&' . $page_info, 'NONSSL') , '">'; ?><?php echo tep_image_button('button_delete.gif', IMAGE_DELETE); ?></a> </td>
<?php
  }
?>
		  </tr>
<?php
  $max_options_id_query = tep_db_query("select max(products_options_id) + 1 as next_id from " . TABLE_PRODUCTS_OPTIONS);
  $max_options_id_values = tep_db_fetch_array($max_options_id_query);
  $next_id = $max_options_id_values['next_id'];
   }
?>
		  <tr>
<?php
//++++ QT Pro: Begin Changed code
?>
		    <td colspan="4"><?php echo tep_black_line(); ?></td>
<?php
//++++ QT Pro: End Changed Code
?>
		  </tr>
<?php
   if ($action != 'update_option') {
?>
		  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
<?php
  echo '<form name="options" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=add_product_options&' . $page_info, 'NONSSL') . '" method="post"><input type="hidden" name="products_options_id" value="' . $next_id . '">';
  $inputs = '';
  for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
    $inputs .= $languages[$i]['code'] . ': <input type="text" name="option_name[' . $languages[$i]['id'] . ']" size="20"> <br>';
  }
?>
		    <td align="center" class="smallText"> <?php echo $next_id; ?> </td>
		    <td class="smallText"><?php echo $inputs; ?></td>
<?php
//++++ QT Pro: Begin Changed code
?>
		    <td align="center" ><input type=checkbox name=track_stock></td>
		    <td align="left" class="smallText"> <?php echo tep_image_submit('button_insert.gif', IMAGE_INSERT); ?> </td>
<?php
//++++ QT Pro: End Changed Code
  echo '</form>'
?>
		  </tr>
		  <tr>
<?php
//++++ QT Pro: Begin Changed code
?>
		    <td colspan="4"><?php echo tep_black_line(); ?></td>
<?php
//++++ QT Pro: End Changed Code
?>
		  </tr>
<?php
   }
 }
?>
	    </table></td>
<!-- options eof //-->

 

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

 

Hope that helps solve your error too! Good luck.

 

SagarJ

Share this post


Link to post
Share on other sites

Hi All,

 

I found the root cause of the error - "unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' error?" on line 290.

 

Its solution is mentioned in the file - Manual_for_2.3.1.html, which has the step by step instructions. A bit of clarity is required, though.

 

For manual step 11.3, the section that mentions :

Find: <!-- options //-->

to <!-- options eof //--> Change all between to:

 

In the code given to be replaced, there are 4 unfinished "echo" statements (with no code immediately following the '). The statements are just displayed as follows:

 

echo '

 

The instruction in the manual states to add the code from your existing "admin/products_attributes.php" file to complete each of the corresponding echo statements. In my case, I was using the vanilla products_attributes.php which came default with the OSC 2.3.1 install. I have replaced the echo statements accordingly and the code works!

 

If you simply copy the code from step 11.3 into notepad, the unfinished echo ' statements are on Line 119, 138, 175, & 190.

 

The complete code for step 11.3 which worked for me is given below:

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

 

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

 

Hope that helps solve your error too! Good luck.

 

SagarJ

 

Awesome!

 

Thank you for clarifying that and my install works now! :)

Share this post


Link to post
Share on other sites

Just installed QTPro (4.6.1 on OSC 2.3.1) When I add an attribute, I get

 

1136 - Column count doesn't match value count at row 1

insert into products_attributes values (null, '30', '1', '1', '0', '+')

[TEP STOP]

 

What do I do?

Share this post


Link to post
Share on other sites

( can't edit my last post for some reason, put this in a new one instead: )

 

I found this line in products_attributes.php, guess this has something to do with it?

 

(Line 62)

tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values (null, '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . (float)tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "')");

 

Or this (Line 116):

	tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES . " set products_id = '" . (int)$products_id . "', options_id = '" . (int)$options_id . "', options_values_id = '" . (int)$values_id . "', options_values_price = '" . (float)tep_db_input($value_price) . "', price_prefix = '" . tep_db_input($price_prefix) . "' where products_attributes_id = '" . (int)$attribute_id . "'");

?

Edited by slugg0

Share this post


Link to post
Share on other sites

Anyone? Please!

-I'm completely stuck here.... sad.png

 

Did you verify that all your changes are correct AND that you did not remove needed code from any other add-ons when doing the install?

Share this post


Link to post
Share on other sites

Yes, unless I missed something twice... Anyways, there were som other problem too, since I then got another error.. mad.gif

Tried to restore from my previosly functioning state, but that caused yet another error... So I ended up with deleting my entire catalog and database and now, i'm trying to restore the entire site...

 

We'll see if it'll work next time.....

Share this post


Link to post
Share on other sites

Is there any way to auto generate baseline starting quantities for QT Pro stock quantities for all attributes for products?

 

I now have about 700 sick products and each product has multiple attributes with more than 6 choices per attribute so at least 12 stock quantities per product.

 

That's 8400 stock quantities i need to manually enter!!!! GAA IM BLINDED :)

Share this post


Link to post
Share on other sites

Oh wait

 

color - 8 choices

size - 6 choices

 

6 x 8 is 48

 

48 x 700 = 33600

 

So I only have to enter 33600 stock quantities manually and those products are not available but are on the site since customers cannot pick a size or quantity till the quantities are added so I have dead product on my site :(

Share this post


Link to post
Share on other sites

sorry if this has been covered but with 101 pages of discussion i got bored of looking

 

has anyone encountered problems with the attributes no longer appearing at the checkout_confirmation.php stage?

i havent got a huge amount of mods on my site, and QTPro is the only one i can see mentioned on any of the files used by the checkout process

shows item model and item name, price info etc

but attributes field is blank, i am in process of revertting files back to standard to see if i can identify on which one the problem is

Share this post


Link to post
Share on other sites

Is there any way to auto generate baseline starting quantities for QT Pro stock quantities for all attributes for products?

 

I now have about 700 sick products and each product has multiple attributes with more than 6 choices per attribute so at least 12 stock quantities per product.

 

That's 8400 stock quantities i need to manually enter!!!! GAA IM BLINDED smile.png

Velvet Pixel, I'm going through the same problem at the moment. The only way to deal with it is to write some hardcore PHP accessing the databases directly.

I'm writing up a PHP script to do this, not sure when I'll finish it - it has to fit between real work!

Thanks SagarJ for that revised products_attribute.php file - the state of the current contribution is crappy with this kind of work being required to get it going. The help file with it's 'echo '<NOTHING' code leaves alot to be desired quality wise - so much so I'd say unless you're au fait with PHP/MySQL I wouldn't both with it. Shame because it's a great mod.

At the same time, remember we are bolting on something osc wasn't at all designed for, so attributes stock handling with this package is always going to be tedious/difficult.

 

Note to people considering this mod (and those posting 'Help Please' in this thread) : you will in all likelihood require some PHP coding to get it going. If you're not up to it ie. all you know is how to parrot-like copy code, I seriously wouldn't bother with it till you've learnt coding. Slugg0 you might want to think about this before you waste a few weeks of frustration.

Edited by p2409

OSC User Definitions

"I can add modules to OSC" = I can search, cut and paste. But not well, or I wouldn't be here.

"I start my posting with 'works like a charm' = I'm letting you down gently, nothing works and I have no idea why

"I finish postings with "plzzzz....hlp" = My installation is buggered and I know I'm going to have to pay someone, but I really, really don't want to.

Share this post


Link to post
Share on other sites

Also guys don't forget to make the simple mod to /admin/functions/general.php to stop osc from breaking when you delete an empty category. You can leave the installation as is if you want, but remember you will need to only delete categories with at least one product in them for it to work (annoyance factor more than anything).

 

 

I've put it here if you ready to just go ahead with it:

Change

    //++++ QT Pro: Begin Changed code JOC
  qtpro_doctor_amputate_all_from_product($product_id);
   //++++ QT Pro: End Changed code

 

To

 

    //++++ QT Pro: Begin Changed code JOC
   if ($products_id!=null) qtpro_doctor_amputate_all_from_product($product_id);
   //++++ QT Pro: End Changed code

 

The QTPro for 2.3 addon page has this on it now.


OSC User Definitions

"I can add modules to OSC" = I can search, cut and paste. But not well, or I wouldn't be here.

"I start my posting with 'works like a charm' = I'm letting you down gently, nothing works and I have no idea why

"I finish postings with "plzzzz....hlp" = My installation is buggered and I know I'm going to have to pay someone, but I really, really don't want to.

Share this post


Link to post
Share on other sites

Also guys don't forget to make the simple mod to /admin/functions/general.php to stop osc from breaking when you delete an empty category. You can leave the installation as is if you want, but remember you will need to only delete categories with at least one product in them for it to work (annoyance factor more than anything).

 

 

I've put it here if you ready to just go ahead with it:

Change

	//++++ QT Pro: Begin Changed code JOC
  qtpro_doctor_amputate_all_from_product($product_id);
//++++ QT Pro: End Changed code

 

To

 

	//++++ QT Pro: Begin Changed code JOC
if ($products_id!=null) qtpro_doctor_amputate_all_from_product($product_id);
//++++ QT Pro: End Changed code

 

The QTPro for 2.3 addon page has this on it now.

 

 

The above if statement must be like this:

 

 if (tep_not_null($products_id)) {qtpro_doctor_amputate_all_from_product($product_id);}

 

Sara

Share this post


Link to post
Share on other sites

Help!!

 

Getting this error when trying to go to Admin>Catalog>Product Attributes

 

Fatal error: Cannot redeclare qtpro_products_attributes_string2array() (previously declared in /home/tgides5/public_html/adminrrr/includes/functions/qtpro_functions.php:19) in /home/tgides5/public_html/adminrrr/includes/functions/qtpro_functions.php on line 33

 

What am I doing wrong??

 

 

Got it, copied the wrong code!!!

 

Another question, where can I edit the message "The combination of options you have selected is currently out of stock. Please select another combination."

Edited by rrosenau

Share this post


Link to post
Share on other sites

In the catalog/includes/languages/english/product_info.php you will find these lines:

define('TEXT_OUT_OF_STOCK', 'Out of stock');

define('TEXT_OUT_OF_STOCK_MESSAGE', 'The combination of options you have selected is currently out of stock. Please select another combination.');

define('TEXT_SELECT_OPTIONS', 'You must select product options before adding this product to your cart.');

define('STOCK_LIST_IN_PI_TEXT_HEADING', 'Currently on stock:');

define('STOCK_LIST_IN_PI_TEXT_PRICE', 'Price');

define('STOCK_LIST_IN_PI_TEXT_STOCK', 'Qty.');

 

All of those belongs to QTPro.

Share this post


Link to post
Share on other sites

Has anyone sucessfully integrated this contribution with the Sppc addon.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

Anyone know how to change the foreground/background colours of the 'out of stock' warning message on the product_info page? I can't read it with my template mods.

Share this post


Link to post
Share on other sites

Hello there,

 

My big and maybe simple problem:

I can't find the Track Stock check box!? There is no such option...

QtPro Options appear everywhere in my Admin, just not in Attributes, where most needed.

 

Please help! What am I overlooking?

 

Thank you*

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×