Zen Cart Logo
Forums / Bug Reports / [DONE v1.3.9] Inch marks in Attribute Option Values

[DONE v1.3.9] Inch marks in Attribute Option Values

Locked

Views: 1,068

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
4 Nov 2009, 12:47 AM
#1
stride_r avatar

stride_r

Zen Follower

Join Date:
Aug 2008
Posts:
115
Plugin Contributions:
0

[DONE v1.3.9] Inch marks in Attribute Option Values

My client sells flowers pots. Since a given pot style comes in many different sizes, they needed to have inch marks in their attribute option values.

Sample Attribute Name: Pot Size
Sample option value might be: 6" dia. X 3 5/8" deep

Zen cart doesn't seem to have an issue with creating or working with an attribute option value like this ...except when you go to edit it later. The inch marks are not being encoded properly on the form display causing the html to break and anything after the first inch mark gets truncated in the value text box.

However, it appears that this can be easily fixed by finding, around line 727 (for v1.3.8), in admin/options_values_manager.php the following:

$inputs .= $languages[$i]['code'] . ': <input type="text" name="value_name[' . $languages[$i]['id'] . ']" ' . zen_set_field_length(TABLE_PRODUCTS_OPTIONS_VALUES, 'products_options_values_name', 25) . ' value="' . $value_name->fields['products_options_values_name'] . '"> <br />';

and changing to:

$inputs .= $languages[$i]['code'] . ': <input type="text" name="value_name[' . $languages[$i]['id'] . ']" ' . zen_set_field_length(TABLE_PRODUCTS_OPTIONS_VALUES, 'products_options_values_name', 25) . ' value="' . htmlspecialchars($value_name->fields['products_options_values_name']) . '"> <br />';

Be sure to backup this file or save a copy as this file is in admin and there is no custom template file for these core files.

4 Nov 2009, 5:11 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [DONE v1.3.9] Inch marks in Attribute Option Values

I actually used zen_output_string in the file options_values_manager.php

          $inputs .= $languages[$i]['code'] . ': <input type="text" name="value_name[' . $languages[$i]['id'] . ']" ' . zen_set_field_length(TABLE_PRODUCTS_OPTIONS_VALUES, 'products_options_values_name', 25) . ' value="' . zen_output_string($value_name->fields['products_options_values_name']) . '"> <br />';

and also in the options_names_manager.php but fixed the comments as well, around 616:

          $inputs .= $languages[$i]['code'] . ': <input type="text" name="option_name[' . $languages[$i]['id'] . ']" ' . zen_set_field_length(TABLE_PRODUCTS_OPTIONS, 'products_options_name', 20) . ' value="' . zen_output_string($option_name->fields['products_options_name']) . '">' . TEXT_SORT . '<input type="text" name="products_options_sort_order[' . $languages[$i]['id'] . ']" size="3" value="' . $option_name->fields['products_options_sort_order'] . '"> <br />';

and around 618:

                   ' ' . TEXT_OPTION_VALUE_COMMENTS . '<input type="text" name="products_options_comment[' . $languages[$i]['id'] . ']" size="50" value="' . zen_output_string($option_name->fields['products_options_comment']) . '">' .

moving to Bug Reports ...

4 Nov 2009, 10:42 PM
#3
stride_r avatar

stride_r

Zen Follower

Join Date:
Aug 2008
Posts:
115
Plugin Contributions:
0

Re: [DONE v1.3.9] Inch marks in Attribute Option Values

Thanks Linda!

Hey, while we're on the topic of zen functions .... is there a good "reference" to all the available built in zen functions? I'm thinking of a Zen Cart equivalent to: w3schools.com/php/

I know there's the Wiki ... but I've not seen a searchable or organized list of those to which we can refer or tap into. It would be an invaluable resource.

4 Nov 2009, 11:57 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [DONE v1.3.9] Inch marks in Attribute Option Values

Not really ...

One thing you can always do is build a test file or add a test to an existing file to try out various functions ...

One thing you can try is the Tools ... Developers Tool Kit ... where you can type in anything you might be searching for ...

Example, I want to do something with the products_description field ...

While you will get a lot of results, type in the bottom input box:
products_description

A zillion references will appear and help you find different files that address that field ... those may lead you to something you are looking for ...

Or type in a table name such as:
TABLE_PRODUCTS

and a zillion references to that table will show ... these may lead you to examples of SQL statements that can help you address that table ...

It would be nice to have a guide to every file, function etc. for Zen Cart, but often searching the Forum or the WIKI or the Tutorials/FAQs can help you ...

Or, there is the old fashion, Forum post for "How the heck do I do this?" ... :smile: