Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] Subcategory textboxes


chris23

Recommended Posts

Support for "Subcategory textboxes" contribution

 

This contribution will allow you to add a text information box to the top of a subcategory page.

 

This allows you to give general information about a product range, rather than duplicating information within the product page.

 

See enclosed screeshot.jpg for an example of its use.

 

This contribution is based in part on the excellent and simple contribution "Sub Category Description on Selected Categories":

 

http://www.oscommerce.com/community/contributions,4608

 

Whilst this offered the functionality required by a recent client, the client wanted to support multiple subcategories and didn't like the idea of editing the index.php source file to add / amend entries.

 

This contribution builds on "Sub Category Description on Selected Categories":

 

1. Textbox descriptions stored in database table.

2. Full admin control to allow adding / editing / deleting textbox contents.

3. Ability to switch off textboxes globally - allows you to add your copy before going 'live'

4. Ability to customise amount of textbox text previewed on the admin page.

5. Protection against overwriting existing textbox contents.

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

Link to comment
Share on other sites

  • Replies 269
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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

Link to comment
Share on other sites

Great contribution!

 

Installed it in 5 min, works like a charm!

 

Wished it was multilingual :'(

 

But h?, we all need somthing to wish for, right?

 

:lol:

 

It will do for now, thanks again! :thumbsup:

Norman in 't Veldt

 

Moderator

osCommerce The Netherlands

Link to comment
Share on other sites

Wished it was multilingual :'(

 

Pleased you like the contribution! I've rewritten to v1.1 which now includes full multi-lingual support for both the admin and store side.

 

Enjoy! :D

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

Link to comment
Share on other sites

The screenshot looks nice so lets try..

:'(

Whats wrong??

 

Fout

SQL-query:

 

--

-- Table structure for table `extra_cat_info`

--

CREATE TABLE `extra_cat_info` (

`categories_id` int( 11 ) NOT NULL ,

`categories_description` text NOT NULL ,

`language_id` int( 11 ) NOT NULL default '1',

PRIMARY KEY ( `categories_id` , `language_id` )

) ENGINE = MYISAM INSERT INTO configuration

VALUES (

NULL , 'Subcategory text preview length', 'CAT_TEXT_PREVIEW', '150', 'Set length of subcategory text to be displayed in preview field.<br>Set to something huge (50000) to view all text', 1, 100, NULL , '2006-11-03 14:40:05', NULL , NULL

);

 

MySQL retourneerde: Documentatie

#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 'INSERT INTO configuration VALUES (NULL, 'Subcategory text previ

 

A hint for a DB noob ? :blush:

Link to comment
Share on other sites

Quick question?

 

Quick answer - yes and no!

 

The original idea of the contribution was to have an additional text box above the subcategory product listing.

 

1. If you want a text box to appear on a main category that doesn't have nested subcats then yes, all that is required is a trivial change after installation.

 

2. If, however, you want a text box on a main category that has subcats (ie on the page where you have the subcategory list), then this will require a more substantial hack.

 

For case 1) after installation, edit admin/product_extra_category.php

 

FIND:

 

$categories_query = tep_db_query("select " . TABLE_CATEGORIES_DESCRIPTION . ".categories_id, categories_name from " . TABLE_CATEGORIES . " left join " . TABLE_CATEGORIES_DESCRIPTION . " using (categories_id) left join " . TABLE_EXTRA_CATEGORIES . " on ". TABLE_EXTRA_CATEGORIES . ".categories_id = ". TABLE_CATEGORIES_DESCRIPTION . ".categories_id where " . TABLE_EXTRA_CATEGORIES .".categories_id is null and parent_id !=0 and " . TABLE_CATEGORIES_DESCRIPTION  . ".language_id=".$languages_id);

 

and replace with:

 

$categories_query = tep_db_query("select " . TABLE_CATEGORIES_DESCRIPTION . ".categories_id, categories_name from " . TABLE_CATEGORIES . " left join " . TABLE_CATEGORIES_DESCRIPTION . " using (categories_id) left join " . TABLE_EXTRA_CATEGORIES . " on ". TABLE_EXTRA_CATEGORIES . ".categories_id = ". TABLE_CATEGORIES_DESCRIPTION . ".categories_id where " . TABLE_EXTRA_CATEGORIES .".categories_id is null and " . TABLE_CATEGORIES_DESCRIPTION  . ".language_id=".$languages_id);

 

If you want case 2) , let me know!

 

I suggest installing v1.1 multi-lingual even if you have no need for language support as it has a few extra features / fixes.

 

HTH

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

Link to comment
Share on other sites

The screenshot looks nice so lets try..

:'(

Whats wrong??

A hint for a DB noob ? :blush:

 

Many apologies - theres a syntax error in subcategory_textboxes.sql.

 

I've missed a ; off the end of ENGINE = MYISAM

 

Please change

CREATE TABLE `extra_cat_info` (
 `categories_id` int(11) NOT NULL,
 `categories_description` text NOT NULL,
 `language_id` int(11) NOT NULL default '1',
 PRIMARY KEY  (`categories_id`,`language_id`)
) ENGINE=MyISAM

 

to:

 

CREATE TABLE `extra_cat_info` (
 `categories_id` int(11) NOT NULL,
 `categories_description` text NOT NULL,
 `language_id` int(11) NOT NULL default '1',
 PRIMARY KEY  (`categories_id`,`language_id`)
) ENGINE=MyISAM;

 

and retry.

 

Will upload a corrected version to contributions area

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

Link to comment
Share on other sites

Chris, do you want de dutch translations?

(Still working at it)

 

Hi Evert,

 

That would be great - you could either upload your language file to the contributions area, or if you prefer, I'll PM you my e-mail address so you can send it over when finished. I can then bundle it into my next upload.

 

Many thanks

 

BTW - a strong coffee fixes all bugs ;)

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

Link to comment
Share on other sites

I've been looking to add an extra text box field to the to the product.info.php page? Do you think this can be adapted for that?

 

Hi Abdul,

 

If you're looking to have the subcategory textbox that appears at the top of the product listing appear on every product page within the subcategory, then yes:

 

After installation of the contribution:

 

Edit product_info.php:-

 

FIND (around line 85)

 

if (tep_not_null($product_info['products_model'])) {
  $products_name = $product_info['products_name'] . '<br /><br /><span class="smallTextOR">Our code: ' . $product_info['products_model'] . '</span>';
} else {
  $products_name = $product_info['products_name'];
}
?>

 

immediately AFTER add:

 

<?php
//  category textbox mod
if (DISPLAY_EXTRA_CATEGORIES == 'true'){
// 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($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>");
  }
}
 }
?>

 

Done!

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

Link to comment
Share on other sites

Hello chris,

 

Great contribution - It works very good. :)

 

It's possible to make a Addition for Main Categories?

 

Regards Anton

 

Hi Anton,

 

I'm currently working on an updated version as a result of feedback on the forum about having boxes on main categories and product pages.

 

The new version will have optional configuration options for main category boxes (for both categories with and without nested subcategories) and also to have the textbox cascade down to the product_info page for products within a category having a textbox.

 

I'll post here as soon as I've finished (just install and upgrade instructions left to do so shouldn't be too long!)

 

Glad you like the contribution.

 

Regards

 

Chris

 

HTH

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

Link to comment
Share on other sites

Hi I've installed this contribution but when I go into the admin and select the textbox page all I get is this error message

 

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 '-20, 20' at line 1

 

select extra_cat_info.categories_id, categories_description, categories_name from extra_cat_info LEFT JOIN categories_description USING (categories_id) limit -20, 20

 

any ideas?

 

many thanks!

Link to comment
Share on other sites

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 '-20, 20' at line 1

 

select extra_cat_info.categories_id, categories_description, categories_name from extra_cat_info LEFT JOIN categories_description USING (categories_id) limit -20, 20

 

Hi Karen,

 

Sorry you're having problems . Could you let me know a couple of thing?

 

1) Which version of the contribution you've installed

 

2) Confirm that you ran the supplied subcategory_textboxes.sql - if you did, please check your database, via phpMyAdmin, that you have a new table, extra_cat_info

 

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

Link to comment
Share on other sites

New version released [v2.0]

 

What's new?

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

 

As a result of feedback on the support forum, I've rewritten the contribution to:

 

1. Display Subcategory textbox on product listing page [ Default = false ] . Displays the subcategory textbox at the top of the contained product's information page.

 

2. Display textboxes on MAIN categories [ Default = false ] . Enabling this option allows support for textboxes on main categories (both with or without nested subcategories). Enabling this option has two effects:

 

i) enables display of textboxes on main categories and

ii) allows main categories to be selected from the pull down menu within the "Add subcategory" option.

 

You could say that enabling this option renames the contribution "Category textboxes"!

 

Other changes:

 

1. Moved the configuration options from "My Store" to their own configuration group - "Textboxes". The new installation sql file will find your next available configuration group (regardless of installed modules) and configure the new options automatically.

 

2. Moved the required index.php code to an include module to allow for easier upgrading / reduce code duplication.

 

Full upgrade instructions also supplied for those using v1.x multilingual

 

Enjoy :D

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

Link to comment
Share on other sites

What an absolutely excellent contribution!

 

A client asked me about this feature last week and I told him I would look into it.

 

He is delighted with the addition.

 

A very important addition. Worked first time (not all do).

 

Thanks so much.

Link to comment
Share on other sites

There is a little problem in your catalog\admin\products_extra_category.php!

 

I think you use TintMCE 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 in 't Veldt

 

Moderator

osCommerce The Netherlands

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...