Forums / All Other Contributions/Addons / Number of characters of Short Descriptions addon

Number of characters of Short Descriptions addon

Views: 1,407

Results 1 to 5 of 5
8 Sep 2011, 7:50 PM
#1
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
416
Plugin Contributions:
0

Number of characters of Short Descriptions addon

In the Short Descriptions mod here:

http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=271

the SQL patch instructs to add the following lines to the database:


INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('Display Product Short Descriptions', 'PRODUCT_LIST_SHORT_DESC', '3', 'Set to 0 to disable, set to 1-99 to enable.', 8, 11, now(), now(), NULL, NULL);

ALTER TABLE products_description ADD products_short_desc VARCHAR( 255 ) DEFAULT NULL AFTER products_description;
ALTER TABLE categories_description ADD categories_description_sub TEXT NOT NULL;

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('Product Info - Display Product Short Descriptions', 'PRODUCT_INFO_SHORT_DESC', '1', 'Show Product''s short Description<br />0= off<br />1= on', 18, 30, now(), now(), NULL, 'zen_cfg_select_drop_down(array(array(''id''=>''0'', ''text''=>''Off''), array(''id''=>''1'', ''text''=>''On'')),');

So now my questions is, how can I change the number of characters from 255 to for example 30000? I guess I need to reload the line:


ALTER TABLE products_description ADD products_short_desc VARCHAR( 255 ) DEFAULT NULL AFTER products_description;
ALTER TABLE categories_description ADD categories_description_sub TEXT NOT NULL;

but can I simply change it to:


ALTER TABLE products_description ADD products_short_desc VARCHAR( 30000 ) DEFAULT NULL AFTER products_description;
ALTER TABLE categories_description ADD categories_description_sub TEXT NOT NULL;

and submit it via Admin -> Tools -> Install SQL Patches ?

9 Sep 2011, 1:34 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Number of characters of Short Descriptions addon

Um, last time I checked, "30,000" characters was NOT a "short description".

If you insist it is, you'll have to change VARCHAR(255) to TEXT

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

9 Sep 2011, 2:44 AM
#3
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
416
Plugin Contributions:
0

Re: Number of characters of Short Descriptions addon

Hehe yes you are probably right, 30000 characters is not a short text.

I changed:

ALTER TABLE products_description ADD products_short_desc VARCHAR( 255 ) DEFAULT NULL AFTER products_description;

to

ALTER TABLE products_description ADD products_short_desc TEXT DEFAULT NULL AFTER products_description;

and used the SQL Query Executor to send it to the database, but got the error:

ERROR: Cannot ADD column products_short_desc because it already exists

Is there a way to replace or update the current statement without deleting the existing characters I already have in the database (I already have a lot of less than 255 character descriptions that I would like to avoid deleting)?
Could I use the REPLACE or UPDATE statement?

My SQL knowledge is pretty bad so any help is much appreciated.

9 Sep 2011, 3:05 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Number of characters of Short Descriptions addon

change ADD to CHANGE COLUMN and repeat the column name.

Or, within phpMyAdmin just edit the table structure and change the column type directly.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

9 Sep 2011, 3:48 AM
#5
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
416
Plugin Contributions:
0

Re: Number of characters of Short Descriptions addon

Thanks a lot! I changed the values in phpMyAdmin and now all of my 30000 character "short" description shows up. :bigups: