Jump to content

Product Attribute Character Length


Guest mattmoo

Recommended Posts

Guest mattmoo

Some of my product options attributes are quite long (text length) and although I am able to type the full option in "product attributes" when it views in the store the end part of each attribute is missing. Is there a way I can increase the character length that will display in the drop down list?

Thanks in advance!

Link to comment
Share on other sites

  • 1 year later...

There appears to be no HTML coding limit to the amount of text you can enter into the form's <input> text box. And there may be a style applied to the Product View page's Options selectors that would limit its width.

However, when the CC4 database is built during installation, the name of the option (managed in Table 1) is stored in the database _options_top having a column width of 30. The option's attribute (or value, managed in Table 2) is in the _options_mid and has a similar column width.

Unless the MySQL database is set to strict mode (and it can't as there are way too many other query situations that would fault on a strict mode database), the database simply truncates everything past the 30th character.

To get relief, you would have to get at your database directly and issue the necessary ALTER command.

Link to comment
Share on other sites

As Brian mentions, the max length of the string is set to 30 chars in the database. Anything after the 30th character is dropped. You can try an ALTER statement to change the length.

Backup your database first! (Maintenance > Backup in admin menu)

Under the Maintenance tab in your admin menu, click the Database link. Just above the table you will see a line that looks *something* like this...

MySQL 5.1.56-community-log running on localhost as YOUR_DB_NAME@localhost »

Click the >> at the end of that line, then in the box that next appears paste in the following. You can change the number (from 40), to the value of your longest option attribute if need be.

ALTER TABLE `CubeCart_options_mid` CHANGE `value_name` `value_name` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT \'\'

Click 'Execute SQL Queries'

Your existing attributes will still only be 30 chars long max because of the 'dropped' characters. You will have to go back into Product Options and add the rest......only hope you don't have many :)

Hope that helps

Lee

Link to comment
Share on other sites

What is indicating a limit? So CubeCart permits the admin to submit a custom SQL command statement to the database (which I didn't know about - thanks leeofaccy), I would hope that it takes the statement and makes sure tables have the prefix assigned. Did you include your table prefix in the statement? (Are the backslashes necessary?)

Also, recall I mentioned a similar limit in the _options_top table for option name.

Link to comment
Share on other sites

Guest dawng22

I submitted the SQL command just as Lee suggested through CubeCart admin and even tried editing and adding a new product option attribute, but when you go back to the website's drop-down it's still missing/dropping letters off the end.

Afterwards, I went into the MySQL and saw that the value was still set at a limit of 30.

Am I doing something wrong?

Link to comment
Share on other sites

When you executed the query, did you get a statement appear above the box, something like this?...

ALTER TABLE `CubeCart_options_mid` CHANGE `value_name` `value_name` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''

3 row(s) affected

Link to comment
Share on other sites

Guest dawng22

This is what I got:

ALTER TABLE `CubeCart_options_mid` CHANGE `value_name` `value_name` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''

459 row(s) affected

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.

Guest
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...