Jump to content
chris23

[CONTRIBUTION] Subcategory textboxes

Recommended Posts

OK, found it

 

In the file mentioned in my post above look for line 89:

 

<script language="javascript" type="text/javascript" src="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_ADMIN; ?>tiny_mce/tiny_mce.js"></script>

 

change into:

 

<script language="javascript" type="text/javascript">

 

Then at line 98 completly remove:

<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "table,advhr,advimage,advlink,emotions,preview,flash,print,contextmenu",
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
theme_advanced_buttons2_add : "separator,preview,separator,forecolor,backcolor",
theme_advanced_buttons2_add_before: "cut,copy,paste,separator",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "emotions,flash,advhr,separator,print",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|on
mouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
external_link_list_url : "example_data/example_link_list.js",
external_image_list_url : "example_data/example_image_list.js",
flash_external_list_url : "example_data/example_flash_list.js"
});
</script>

 

Could be that I'm wrong or missing something, but it works for me. :-"

 

;)


Norman in 't Veldt

 

Moderator

osCommerce The Netherlands

Share this post


Link to post
Share on other sites
There is a little problem in your catalog\admin\products_extra_category.php!

 

I think you use TinyMCE and there are sort of leftovers of this program in the file mentioned.

I use TinyMCE as well and when adding the code I get twice the TinyMCE edittor :huh:

 

Norman,

 

Well spotted! Yes I use TinyMCE with this contribution and have been removing this code from my version of catalog\admin\products_extra_category.php each time I create a new package for uploading. Competely forgot this time :blush:

 

Will uploaded a fix to the contribution area.

 

Apologies for causing problems!

 

Regards

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
Norman,

 

Well spotted! Yes I use TinyMCE with this contribution and have been removing this code from my version of catalog\admin\products_extra_category.php each time I create a new package for uploading. Competely forgot this time :blush:

 

Will uploaded a fix to the contribution area.

 

Apologies for causing problems!

 

Regards

 

Chris

 

No problem!

 

I'm happy that you made this contribution as the others where not what I needed, this one is.

Installation/upgrade took less then 5 min (besides the TinyMCE issue).

 

Thanks again!


Norman in 't Veldt

 

Moderator

osCommerce The Netherlands

Share this post


Link to post
Share on other sites

Hi Chris!

 

I think, it's a great contribution, but i've a little problem with the 2.0 Version:

 

I get an error in /admin/products_extra_category.php, when i try to use:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-8, 8' at line 1

 

select extra_cat_info.categories_id, categories_description, categories_name from extra_cat_info LEFT JOIN categories_description USING (categories_id) where extra_cat_info.language_id=categories_description.language_id and extra_cat_info.language_id=2 limit -8, 8

 

Do you know where my mistake could be?

 

Thanx!

 

Kind regards,

Daniel

Share this post


Link to post
Share on other sites
I get an error in /admin/products_extra_category.php, when i try to use:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-8, 8' at line 1

select extra_cat_info.categories_id, categories_description, categories_name from extra_cat_info LEFT JOIN categories_description USING (categories_id) where extra_cat_info.language_id=categories_description.language_id and extra_cat_info.language_id=2 limit -8, 8

 

Hi Daniel,

 

Sounds like a similar issue to Post #18

Can you please confirm that you ran the installation sql and have the extra_cat_info table then et me know your results?

 

Cheers

 

Chris

Edited by chris23

Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites

Hi Chris!

 

Yes the table extra_cat_info is there. The file was imported correctly, no mistakes.

 

But i don't know, why there is the 1064!?

 

Daniel

Share this post


Link to post
Share on other sites
Hi Chris!

 

I think, it's a great contribution, but i've a little problem with the 2.0 Version:

 

I get an error in /admin/products_extra_category.php, when i try to use:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-8, 8' at line 1

 

select extra_cat_info.categories_id, categories_description, categories_name from extra_cat_info LEFT JOIN categories_description USING (categories_id) where extra_cat_info.language_id=categories_description.language_id and extra_cat_info.language_id=2 limit -8, 8

 

Do you know where my mistake could be?

 

Thanx!

 

Kind regards,

Daniel

 

Search the forum for the LIMIT error, this is the issue, not the 1064!

 

Edit: I'm in a good mood ;)

 

Limit

 

Line 67 in catalog/includes/classes/split_page_results.php must be changed from:

$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;

to:

$this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page;

 

Line 38 in catalog/admin/includes/classes/split_page_results.php must be changed from:

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

to:

$sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;


Norman in 't Veldt

 

Moderator

osCommerce The Netherlands

Share this post


Link to post
Share on other sites
Limit

 

Line 67 in catalog/includes/classes/split_page_results.php must be changed from:

$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;

to:

$this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page;

 

Line 38 in catalog/admin/includes/classes/split_page_results.php must be changed from:

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

to:

$sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;

 

Well done again Norman - pleased I refreshed the forum page before replying. You've got the answer bang on.

 

It's a MySQL version issue. Earlier versions of MySQL (incorrectly) allowed a negative offset to LIMIT clauses - later versions do not.

 

The reason some people are getting an issue is if they're using a 2.2MS version before 051113

 

This LIMIT issue is not isolated to this contribution but causes havoc if you install oSC on MySQL 5 without upgrading

 

Details can be found at:

 

http://forums.oscommerce.com/index.php?showtopic=180289

 

As MySQL 5 is becoming more popular, I recommend everyone patches their install to prevent this issue from occurring in future

 

Cheers

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
As MySQL 5 is becoming more popular, I recommend everyone patches their install to prevent this issue from occurring in future

 

Cheers

 

Chris

 

That's why I'm rebuilding my shop on the latest osCommerce timestamp to make sure I've got it covered.

Stupid thing is that some know bugs are still in this latest release like the shopping-cart-bug and the currency-bug.

But we're drifting of ;)

 

Just to let everybody know that Chris is going on holliday for 2 weeks from 7 december on and I'll be monitoring this topic in case someone has issues with this great contribution (can't think of one, but you never know).

 

Enjoy your holliday Chris!


Norman in 't Veldt

 

Moderator

osCommerce The Netherlands

Share this post


Link to post
Share on other sites
Just to let everybody know that Chris is going on holliday for 2 weeks from 7 december on and I'll be monitoring this topic in case someone has issues with this great contribution (can't think of one, but you never know).

 

Thanks for covering for me Norman - hope you don't get many issues. I'm sure everyone is in good hands :thumbsup:

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites

What does this error message mean?

 

1054 - Unknown column 'extra_cat_info.categories_id' in 'where clause'

 

select categories_description.categories_id, categories_name from categories left join categories_description using (categories_id) left join extra_cat_info on extra_cat_info.categories_id = categories_description.categories_id where extra_cat_info.categories_id is null and parent_id !=0 and categories_description.language_id=1

 

[TEP STOP]

Share this post


Link to post
Share on other sites
What does this error message mean?

 

1054 - Unknown column 'extra_cat_info.categories_id' in 'where clause'

 

select categories_description.categories_id, categories_name from categories left join categories_description using (categories_id) left join extra_cat_info on extra_cat_info.categories_id = categories_description.categories_id where extra_cat_info.categories_id is null and parent_id !=0 and categories_description.language_id=1

 

[TEP STOP]

 

Hi,

 

It means MySQL can't find the column categories.id in table extra_cat_info

 

Did you have any problems when you ran the .sql file during installation?

 

Also, please let me know the exact MySQL version you are running - phpMyAdmin will give you this information.

 

Thanks,

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
Hi Chris,

 

does this work together with Easy Populate?

 

Thanks

 

Hi Matthias,

 

I've not used this Easy Popluate myself with this contribution and only have a basic working knowledge of EP.

 

Provided the EP import / export doesn't change the categories_id (it shouldn't!) , I can't see a problem.

 

Anyone else installed this combination successfully? If so, please post your results.

 

I would say, BACKUP, have a go then post your experiences here.

 

HTH

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
Hi Matthias,

 

I've not used this Easy Popluate myself with this contribution and only have a basic working knowledge of EP.

 

Provided the EP import / export doesn't change the categories_id (it shouldn't!) , I can't see a problem.

 

Anyone else installed this combination successfully? If so, please post your results.

 

I would say, BACKUP, have a go then post your experiences here.

 

HTH

 

Chris

 

I have EP 2.76d and this very nice and this VERY useful contribution running together with not problems at all.

 

Doesn't seem to be any conflicts whatsoever.


No Good Deed EVER Goes Unpunished

Share this post


Link to post
Share on other sites

Hi,

 

I have a little, possible problem, with this contrib.

 

When I set it up to display the text in the product info area, it places the text above the product list, which is fine, but, when I set it up to display in a main category, it displays the text BELOW the list of items.

 

I don't know if I did something wrong, or this is the way it's supposed to be, but, I'd like to know if there is a way to have the text display at the top of a main category.

 

Thanks in advance


No Good Deed EVER Goes Unpunished

Share this post


Link to post
Share on other sites
Hi,

 

I have a little, possible problem, with this contrib.

 

When I set it up to display the text in the product info area, it places the text above the product list, which is fine, but, when I set it up to display in a main category, it displays the text BELOW the list of items.

 

I don't know if I did something wrong, or this is the way it's supposed to be, but, I'd like to know if there is a way to have the text display at the top of a main category.

 

Thanks in advance

 

Hi Richard,

 

First off - thanks for confirming that this contribution works with EP.

 

As to your issue, the textbox should appear above all product listings, whether on a main or subcategory or on the product listing page.

 

The position of the main category textbox is determined by the position of:

 

<?php if (DISPLAY_CATS_ON_MAIN == 'true'){
	include(DIR_WS_MODULES . FILENAME_CAT_TEXTBOX_MODULE); // added for Subcategory textboxes
}
?>

 

within catalog/index.php

 

Please double check where you have added this code. If you still have a problem and want to send me your index.php to check, pls PM me for my email address.

 

Kind regards,

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
Hi Richard,

 

First off - thanks for confirming that this contribution works with EP.

 

As to your issue, the textbox should appear above all product listings, whether on a main or subcategory or on the product listing page.

 

The position of the main category textbox is determined by the position of:

 

<?php if (DISPLAY_CATS_ON_MAIN == 'true'){
	include(DIR_WS_MODULES . FILENAME_CAT_TEXTBOX_MODULE); // added for Subcategory textboxes
}
?>

 

within catalog/index.php

 

Please double check where you have added this code. If you still have a problem and want to send me your index.php to check, pls PM me for my email address.

 

Kind regards,

 

Chris

 

Hi Chris,

 

Thanks for the quick reply.

 

Yes, I have the two pieces of code in catalog/index.php. I even had the snippet around line 71 after the indicated code.

 

I also have the snippet of code after the the indicated code around line 282.

 

Too bad it was supposed to be BEFORE the code, as it clearly states in the instructions which, obviously, at 2 in the morning, I just assumes said AFTER.

 

So, basically, the problem seems to be that I CAN'T READ!!!! LMAO

 

Sorry for to have bothered you for my lack of attention to detail.

 

No problem about letting you know about EP, I try and help out when I can.

 

You will also be happy to know that it works right with More Pics 6, which shares catalog/product_info.php with it, but you have to insert the code for that file a little lower down in the file to accommodate the More Pic added code in that area in step 10.

 

It fits nicely right here;

 

// EOF: More Pics 6
//BEGINNING OF CATEGORY TEXTBOX MOD	
?>
php
//  category textbox mod
if (DISPLAY_EXTRA_CATEGORIES == 'true' && DISPLAY_CATS_ON_PROD_LISTING == 'true'){
if ($product_check['total'] >= 1) {
// now get textbox description for this *product* and display
$query = tep_db_query("select categories_description from " . TABLE_EXTRA_CATEGORIES . " left join " . TABLE_PRODUCTS_TO_CATEGORIES . " using (categories_id) where " . TABLE_PRODUCTS_TO_CATEGORIES .".products_id=" . (int)$HTTP_GET_VARS['products_id'] . " and " . TABLE_EXTRA_CATEGORIES .".language_id = '" . (int)$languages_id . "'");
while($category_info_text = tep_db_fetch_array($query)){
if(!empty($category_info_text['categories_description'])){ // prevent output where description not set for particular language
   echo ("<tr><td colspan=\"2\"><div class=\"cat_info_box\">".$category_info_text['categories_description']."</div></td></tr>");
  }
}
 }
}
?>  
//END OF CATEGORY TEXTBOX MOD

<tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
		<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="main">
<?php 
// BOF: More Pics 6	ADDED to if statement:  && MOPICS_GROUP_WITH_PARENT == 'false'
if (tep_not_null($product_info['products_image']) && MOPICS_GROUP_WITH_PARENT == 'false') {
?>

 

between two chunks of More Pic 6 code.

 

Hope this helps someone.

 

Richard

Edited by Druid6900

No Good Deed EVER Goes Unpunished

Share this post


Link to post
Share on other sites

Thanks Richard,

 

You're right to point out that the position of the catalog/index.php, catalog/product_info.php code will vary according to the contributions you have installed.

 

As the textbox contribution simply includes a table row and contained <div> to the relevant page, it's pretty much up to you where you install the textbox in your page flow. Just because I have the contribution installation place the textbox at the top (where I assumed most users would want it), there's nothing stopping you placing it somewhere else in the flow.

 

Glad you got yours sorted :)

 

Cheers

 

Chris

Edited by chris23

Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites

I hope that someone can help with a problem with my installation of subcategory textboxes. When I click "Subcategory textbox" under "Catalog", I get the error message:

 

Subcategory textbox

 

Subcategory ID Subcategory Name ContentsDISPLAY_TRUNC_CHAR Action

1054 - Unknown column 'extra_cat_info.language_id' in 'where clause'

 

select count(*) as total from extra_cat_info LEFT JOIN categories_description USING (categories_id) where extra_cat_info.language_id=categories_description.language_id and extra_cat_info.language_id=1

 

[TEP STOP]

 

A perhaps irrelevant aside: "Subcategory text preview length" and "Display Subcategory textboxes" appear twice under "My Store."

 

subcategory_textboxes.sql ran without error. I can't readily identify the version of MySQL, but it's GoDaddy's current version.

 

Any help will be greatly appreciated.

 

Steve :'(

Share this post


Link to post
Share on other sites
Subcategory textbox

 

Subcategory ID Subcategory Name ContentsDISPLAY_TRUNC_CHAR Action

1054 - Unknown column 'extra_cat_info.language_id' in 'where clause'

 

select count(*) as total from extra_cat_info LEFT JOIN categories_description USING (categories_id) where extra_cat_info.language_id=categories_description.language_id and extra_cat_info.language_id=1

 

[TEP STOP]

 

A perhaps irrelevant aside: "Subcategory text preview length" and "Display Subcategory textboxes" appear twice under "My Store."

 

subcategory_textboxes.sql ran without error. I can't readily identify the version of MySQL, but it's GoDaddy's current version.

 

Hi Steve,

 

Sorry you're having problems. You seem to have a right little collection of issues!

 

First off, can you confirm you're using the latest v2.0? It *looks* as though you are but if so, you shouldn't have "Subcategory text preview length" and "Display Subcategory textboxes" under "My Store". As of v2, these options come under "Configuration" -> "Textboxes" and you should have just one of each.

 

DISPLAY_TRUNC_CHAR is a constant defined in admin/includes/languages/products_extra_category.php. As you have "Subcategory ID Subcategory Name Contents & Action" from the same file, I can't see why you don't have this constant. Please check your admin/includes/languages/products_extra_category.php for:

 

define('DISPLAY_TRUNC_CHAR',' [first %s chars only]');

 

The SQL error code is being generated by osCommerce's results splitting function. It's saying it can't find the language_id column in the table extra_cat_info. Pls use phpMyAdmin to confirm you have the language_id field within the table extra_cat_info.

 

The more I think about this, it could be that you ran the v1 sql file on a v2 installation. Could this have happened (unlikely I know)? It would explain the 1054 SQL error and the location of "Subcategory text preview length" and "Display Subcategory textboxes"

 

Cheers

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites

Hi Chris,

 

Thanks for the reply. Let me attempt to provide more information.

 

 

Please check your admin/includes/languages/products_extra_category.php for:

 

define('DISPLAY_TRUNC_CHAR',' [first %s chars only]');

 

'DISPLAY_TRUNC_CHAR' does not appear in the file.

 

Pls use phpMyAdmin to confirm you have the language_id field within the table extra_cat_info.

 

The table extra_cat_info contains fields categories_id and categories_description, and no others.

 

The more I think about this, it could be that you ran the v1 sql file on a v2 installation. Could this have happened (unlikely I know)? It would explain the 1054 SQL error and the location of "Subcategory text preview length" and "Display Subcategory textboxes"

 

It's entirely possible, Chris. I have certainly done more stupid things in my life. Seriously, I did have both versions of the sql file downloaded, and it's possible that I ran the wrong one. :-"

 

Again, many thanks!

 

Cheers,

Steve

Share this post


Link to post
Share on other sites

Hi Steve.

 

It does look like you ran the v1 sql and have a v1 copy of admin/includes/languages/products_extra_category.php

 

You may be quicker restoring from your backup and re-trying from scratch using v2.

 

If you'd rather try fixing what you have, I could post some fix instructions but YMMV! Let me know ...

 

Cheers

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites

Hi Chris,

 

For several reasons, including my own education, I'd like to try fixing what I have. Any guidance or direction is appreciated.

 

Thanks again,

Steve

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

×