Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Is it ok to modify the "custom field" tables in the MySQL db?
i’m currently building some sort of microwebshop using paypal shopping cart. the products are available in combinations of colors and size. (example: “black / L”, “black XL”, “white L”, “white XL”) for paypal i need to generate a dropdown where you can choose your combination. i need a code snippet like this:
<code>
<option value=“Black / M”>Black / M<option value=“Black / L”>Black / L<option value=“White / XL”>White / XL</select>
</code>
because i couldnt think of a better way to generate this codesnippet, i decided to name one custom field something like “code snippet” where you have to paste it in. most of the time, 255 characters won’t be sufficient though, so i thought about changing the table in the MySQL to “text”. would that be ok, also in regards to future textpattern updates?
and the other question would be: can someone think of a better way to handle the color/size combinations?
Offline
Re: Is it ok to modify the "custom field" tables in the MySQL db?
If you want to use the custom field, you could give them an alias in the admin/prefs/advanced tab. Renaming the SQL column could lead to problems.
However, if you need more/bigger one, you could simply just add your columns in the table, or in another table (another would be safer with future TXP updates).
Offline
Re: Is it ok to modify the "custom field" tables in the MySQL db?
sorry i guess i wasn’t clear enough: my question was if it would be ok to change the mysql table for that specific custom field from <code>varchar(255)</code> to <code>text</code> to be able to input more than 255 characters…
Offline
Re: Is it ok to modify the "custom field" tables in the MySQL db?
Question asked a lot, I never see a dev answering it but I may have missed it. The long answer is “is there is no PHP handling based on the 255 bytes limitation, yes, if there are, no”. The short answer is I don’t really know.
Offline
Re: Is it ok to modify the "custom field" tables in the MySQL db?
ok, thanks for the quick reply, jeremie. how would i “simply” add more custom fields in another table? is that documentated somewhere or could you explain it to me? that might be a nice workaround for my problem…
Offline
Re: Is it ok to modify the "custom field" tables in the MySQL db?
Create a simple SQL table. Three column: name, article_id and content. And SELECT/INSERT what you need from them with PHP, a write a plugin that does it. If you have some PHP knowledge it shouldn’t be a problem.
Offline
Re: Is it ok to modify the "custom field" tables in the MySQL db?
> sthmtc wrote:
> i’m currently building some sort of microwebshop using paypal shopping cart. the products are available in combinations of colors and size. (example: “black / L”, “black XL”, “white L”, “white XL”) for paypal i need to generate a dropdown where you can choose your combination. i need a code snippet like this:
<code>
<option value=“Black / M”>Black / M<option value=“Black / L”>Black / L<option value=“White / XL”>White / XL</select>
</code>
because i couldnt think of a better way to generate this codesnippet, i decided to name one custom field something like “code snippet” where you have to paste it in. most of the time, 255 characters won’t be sufficient though, so i thought about changing the table in the MySQL to “text”. would that be ok, also in regards to future textpattern updates?
and the other question would be: can someone think of a better way to handle the color/size combinations?
Can’t you have the snippet above in a form with something like
<code><txp:if_custom_field name=“snippet”><option value=“Black / M”>Black / M<option value=“Black / L”>Black / L<option value=“White / XL”>White / XL</select></txp:if_custom_field></code>
All the admin needs to do is write anything in the custom field and the snippet will appear
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Is it ok to modify the "custom field" tables in the MySQL db?
I am running a site with the custom fields running as text (instead of VARCHAR) with no problems whatsoever.
Offline
#9 2006-02-23 02:26:18
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Is it ok to modify the "custom field" tables in the MySQL db?
As far as PHP is concerned I don’t believe Textpattern cares one way or another what the column type is. So, you shouldn’t get any errors, but you may have to be careful when upgrading Textpattern, if the custom field columns get adjusted.
Offline