Forums / General Questions / Input width size in Admin

Input width size in Admin

Results 1 to 20 of 22
21 Jun 2013, 19:04
#1
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Input width size in Admin

How do I change the input box size in admin area? Let say for Products Name.
21 Jun 2013, 23:11
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Input width size in Admin

For built-in fields like Products Name, change the field length in the database, by editing the products table in phpMyAdmin.
You will then need to go change all other tables which store a product name, else those will lose the extra characters when data is saved to them.
Tread carefully. Make database backups before changing anything. Test in an offline copy of your site before changing things on your live store.

WARNING: long product names will also affect layout on your storefront. Be very sure about what you're doing before taking it live.
22 Jun 2013, 00:05
#3
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Input width size in Admin

Dr. Byte - I do not want to change the actual Product Name character length. I want to change the box size in admin displaying the product name.

In fact, I have created 2 additional fields to the zen_Products table,
Field 1: varchar(32) utf8_general_ci Yes NULL
Field 2: varchar(96) utf8_general_ci Yes NULL

Even thought the in SQL table sizes are 32 and 96 for field 1 and 2, when in admin viewing the product detail, the input box displays 20 characters for both fields. I need to be able to expand the actual box size to view the entire text.

And as for the Product name field the box size shows only 45 characters, and you would not be able to see the entire 64 characters of the product name.

What area controls the display?
22 Jun 2013, 00:40
#4
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Posts:
587
Plugin Contributions:
1

Re: Input width size in Admin

Try line 138 of admin/includes/stylesheet.css
textarea {
width: 80%;
}

If you inspect the element of the products name entry box you see:
<input type="text" name="products_name[1]" value="You've Got Mail Linked" size="51" maxlength="64">

80% of 64(maxlength) gives you 51(size)
22 Jun 2013, 01:12
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Input width size in Admin

Kevin205:

Even thought the in SQL table sizes are 32 and 96 for field 1 and 2, when in admin viewing the product detail, the input box displays 20 characters for both fields.

If it is generating HTML for those input fields that forces it to 20 chars length, then that means your Zen Cart is unable to read the field sizes from MySQL, thus the field sizes are being set to default.
This means your MySQL isn't supplying the metadata about the tables' fields correctly.
22 Jun 2013, 01:13
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Input width size in Admin

strelitzia:

Try line 138 of admin/includes/stylesheet.css
textarea {
width: 80%;
}

If you inspect the element of the products name entry box you see:
<input type="text" name="...


Um, a selector named "textarea" doesn't refer to "INPUT" fields like: <input type="text"...>
22 Jun 2013, 01:14
#7
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Input width size in Admin

strelitzia:

Try line 138 of admin/includes/stylesheet.css
textarea {
width: 80%;
}

If you inspect the element of the products name entry box you see:
<input type="text" name="products_name[1]" value="You've Got Mail Linked" size="51" maxlength="64">

80% of 64(maxlength) gives you 51(size)


As I change the value of width: 80%; to width: 100%;, I still see size="51" maxlength="64"

Shouldn't I be looking input area also?
22 Jun 2013, 01:20
#8
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Posts:
587
Plugin Contributions:
1

Re: Input width size in Admin

DrByte:

Um, a selector named "textarea" doesn't refer to "INPUT" fields like: <input type="text"...>


Well isn't that just a spooky coincidence that 80% of the 64 character length is the length of the input box and that it happens to be the very next line in the css after checkbox,input,radio,select,textarea,file{ font-size:11px; }

I stand corrected :)
22 Jun 2013, 01:25
#9
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Input width size in Admin

DrByte:

If it is generating HTML for those input fields that forces it to 20 chars length, then that means your Zen Cart is unable to read the field sizes from MySQL, thus the field sizes are being set to default.
This means your MySQL isn't supplying the metadata about the tables' fields correctly.


DrByte - How and where could this be checked?
22 Jun 2013, 01:29
#10
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Input width size in Admin

DrByte:

If it is generating HTML for those input fields that forces it to 20 chars length, then that means your Zen Cart is unable to read the field sizes from MySQL, thus the field sizes are being set to default.
This means your MySQL isn't supplying the metadata about the tables' fields correctly.


In admin product area:
Products Name: Displays only 45 characters
Products Model: Displays only 30 characters
Or, select an existing image file from server, filename: Displays only 20 characters
22 Jun 2013, 01:42
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Input width size in Admin

Sorry, I missed where you changed topics. :)

You started out specifically asking about how to increase the size of Products Name. Then you changed it to be talking about completely NEW fields. So, that suggests that your problem is in your custom code.

Is it possible that your custom programming is missing the code that tells it how long to make the fields?

I just duplicated the products_model code, after creating fields f1 and f2 with size 32 and 64, and it displays fine:
            <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_model', htmlspecialchars(stripslashes($pInfo->products_model), ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_PRODUCTS, 'products_model')); ?></td>
            <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('f1', htmlspecialchars(stripslashes($pInfo->f1), ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_PRODUCTS, 'f1')); ?></td>
            <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('f2', htmlspecialchars(stripslashes($pInfo->f2), ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_PRODUCTS, 'f2')); ?></td>
22 Jun 2013, 01:52
#12
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Input width size in Admin

It is very much possible. I will give it try.
22 Jun 2013, 02:13
#13
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Input width size in Admin

Thank you DrByte.

I had it as
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '13') . ' ' . zen_draw_input_field('f1', $pInfo->f1, ''); ?></td>


so when I revised them to what you suggested, it expanded:
the 32 character field to 30 characters input box and
the 96 character field to 45 characters input box.


Also Product Name shows only 45 characters instead of 64? Following is the code:
[PHP]<?php
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
<tr>
<td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_NAME; ?></td>
<td class="main"><?php echo zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . zen_draw_input_field('products_name[' . $languages[$i]['id'] . ']', htmlspecialchars(isset($products_name[$languages[$i]['id']]) ? stripslashes($products_name[$languages[$i]['id']]) : zen_get_products_name($pInfo->products_id, $languages[$i]['id']), ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_PRODUCTS_DESCRIPTION, 'products_name')); ?></td>
</tr>
<?php
}
?>[/PHP]

It seems to limit them to a maximum of 45 characters!

Any way to view all characters?
22 Jun 2013, 02:18
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Input width size in Admin

Zen Cart is not limiting those fields. You'll see that the generated HTML is not doing the limiting.
The browser is probably to blame. Or maybe you have some CSS rules that are limiting the displayed size.
22 Jun 2013, 02:26
#15
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Input width size in Admin

I will look around and will let you know if I discover anything. Thank you.
03 Jul 2013, 19:10
#16
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Input width size in Admin

Another questions

I have created an additional field in the zen_products called products_ship_info with the following attributes:
Type: text
Collattion: utf8_general_ci
Null: Yes
Default: NULL

I can not get it to display properly in admin>Product Description. I am using the following in admin/includes/modules/product/collect_info.php :

[PHP]<?php
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
<tr>
<td class="main" valign="top"><?php echo 'Product Ship Info: ' ?></td>
<td colspan="2"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="main" width="25" valign="top"><?php echo zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>
<td class="main" width="100%"><?php echo zen_draw_textarea_field('products_ship_info[' . $languages[$i]['id'] . ']', 'soft', '100%', '30', htmlspecialchars((isset($products_ship_info[$languages[$i]['id']])) ? stripslashes($products_ship_info[$languages[$i]['id']]) : zen_get_products_ship_info($pInfo->products_id, $languages[$i]['id']), ENT_COMPAT, CHARSET, TRUE)); ?></td>
</tr>
</table></td>
</tr>
<?php
}
?>
[/PHP]

When I load this the page breaks after displaying Product Ship Info: and error log shows the following:
[PHP][03-Jul-2013 19:06:16 UTC] PHP Fatal error: Call to undefined function zen_get_products_ship_info() in path\Store\admin\includes\modules\product\collect_info.php on line 331[/PHP]

Line 331 is the beginning of the PHP code.
.
03 Jul 2013, 19:20
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Input width size in Admin

[COLOR=#007700]? stripslashes($products_ship_info[$languages[$i]['id']]) : [/COLOR][COLOR=#0000BB]zen_get_products_ship_info($pInfo->products_id, $languages[$i]['id']), ENT_COMPAT, CHARSET, TRUE))[/COLOR]
Why are you using [COLOR=#0000BB]zen_get_products_ship_info([/COLOR] as a function?
03 Jul 2013, 19:36
#18
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Input width size in Admin

No I am trying to show the field products_ship_info, there is no function involved.

I have added 3 other fields to the zen_products table, without any issues. The only difference here is products_ship_info field type here is text and the other 3 i added were varchar() type with different lengths.

I wanted the products_ship_info to be an expandable text field, not limited by the number of characters. That is why i followed the products_description method to display the data in admin.
03 Jul 2013, 19:47
#19
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Input width size in Admin

When I use:
[PHP]
<td class="main"><?php echo 'Product Ship Info: '; ?></td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_ship_info',
htmlspecialchars(stripslashes($pInfo->products_ship_info), ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_PRODUCTS, 'products_ship_info')); ?></td>[/PHP]

I get a 5 character input text box, but I need to display a text area under admin and finally in product_info_display.
03 Jul 2013, 20:06
#20
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Input width size in Admin

Fixed it. I replaced zen_draw_input_field by zen_draw_textarea_field

[PHP]<td class="main"><?php echo 'Product Ship Info: '; ?></td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_textarea_field('products_ship_info',
htmlspecialchars(stripslashes($pInfo->products_ship_info), ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_PRODUCTS, 'products_ship_info')); ?></td>[/PHP]

Thank you DrByte