Skip to content

Commit

Permalink
dynamic form
Browse files Browse the repository at this point in the history
  • Loading branch information
sarangpatel committed Jun 23, 2016
1 parent e862ff5 commit a17018b
Show file tree
Hide file tree
Showing 79 changed files with 6,015 additions and 0 deletions.
99 changes: 99 additions & 0 deletions dynamic_form_project/_Read Me First.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
DYNAMIC FORM FOR SHOPPING CART

Plugin needs to generate a form that will be automatically inserted below <!-- Dynamically-generated form --> in this file: storefront/view/default/template/blocks/language.tpl

Example of form output:

<form action="" method="post" enctype="multipart/form-data" name="frmdata" onsubmit="return checkData(this)">
<select name="lang" id="lang" style="width:150px; font-size :10pt; font-family:Arial, Helvetica, sans-serif; text-transform: uppercase;">
<option value='ar' data-image="extensions/smart_translator/msdropdown/images/msdropdown/icons/blank.gif" data-imagecss="flag ar-lg" data-title="&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;">&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;</option>
<option value='cn' data-image="extensions/smart_translator/msdropdown/images/msdropdown/icons/blank.gif" data-imagecss="flag cn" data-title="&#27721;&#35821;/&#28450;&#35486;">&#27721;&#35821;/&#28450;&#35486;</option>
<option value='de' data-image="extensions/smart_translator/msdropdown/images/msdropdown/icons/blank.gif" data-imagecss="flag de" data-title="Deutsch">Deutsch</option>
<option value='el' data-image="extensions/smart_translator/msdropdown/images/msdropdown/icons/blank.gif" data-imagecss="flag gr" data-title="&#949;&#955;&#955;&#951;&#957;&#953;&#954;&#940;">&#949;&#955;&#955;&#951;&#957;&#953;&#954;&#940;</option>
<option value='en' data-image="extensions/smart_translator/msdropdown/images/msdropdown/icons/blank.gif" data-imagecss="flag us" data-title="English" selected="selected">English</option>
<option value='es' data-image="extensions/smart_translator/msdropdown/images/msdropdown/icons/blank.gif" data-imagecss="flag es" data-title="Espa&#241;ol">Espa&#241;ol</option>
<option value='fr' data-image="extensions/smart_translator/msdropdown/images/msdropdown/icons/blank.gif" data-imagecss="flag fr" data-title="Fran&#231;ais">Fran&#231;ais</option>
<option value='it' data-image="extensions/smart_translator/msdropdown/images/msdropdown/icons/blank.gif" data-imagecss="flag it" data-title="Italiano">Italiano</option>
<option value='pt' data-image="extensions/smart_translator/msdropdown/images/msdropdown/icons/blank.gif" data-imagecss="flag br" data-title="Portugu&#234;s">Portugu&#234;s</option>
<option value='ro' data-image="extensions/smart_translator/msdropdown/images/msdropdown/icons/blank.gif" data-imagecss="flag ro" data-title="Rom&#226;n&#259;">Romanian</option>
<option value='ru' data-image="extensions/smart_translator/msdropdown/images/msdropdown/icons/blank.gif" data-imagecss="flag ru" data-title="&#1088;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;">&#1088;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;</option>
<option value='tr' data-image="extensions/smart_translator/msdropdown/images/msdropdown/icons/blank.gif" data-imagecss="flag tr" data-title="T&#252;rk&#231;e">T&#252;rk&#231;e</option>
</select>
</form>

The form data is generated by the user when they fill out a form at msdropdown/examples/submitdata.php

PLEASE NOTE: To simulate data entry, upload this to your server and go to dynamic_form_project/interace.html

Below is an example of a text output that shows English as the source language, and French, Portuguese and Spanish as the target languages. An image screenshot of the output is available at image/preview4.jpg.

Array
(
[lang_1] => en
[flag_1] => us
[lang_name_1] => English
[lang_2] => Array
(
[0] => fr
[1] => pt
[2] => es
)

[flag_2] => Array
(
[0] => fr
[1] => br
[2] => es
)

[lang_name_2] => Array
(
[0] => Fran�ais
[1] => Portugu�s
[2] => Espa�ol
)

[send] => Submit
)

VERY IMPORTANT: For some reason, jquery is not outputting the language names in html characters and this needs to be fixed. For example, it shows Fran�ais instead of Fran&#231;ais. This needs to be fixed since it will be a problem when the browser renders the page view.
For the three language names above, the correct output should be:

[0] => Fran&#231;ais
[1] => Portugu&#234;s
[2] => Espa&#241;ol

NOTES:

lang_1, flag_1 and lang_name_1 refer to the source language, i.e. the language translating from.

lang_2, flag_2 and lang_name_2 refer to the target language(s), i.e. the language(s) translating to.

option value refers to lang_1 or lang_2 abbreviation. Examples: en (English), pt (Portugu�s), es (Espa�ol)

data-title refers to the name of the language in the language. Example: Espa�ol (Spanish)

data-imagecss refers to flag_1 or flag_2. It consists of the word "flag" followed by a space plus the country flag abbreviation. Examples: flag us

data-image has the same value for all languages.

The menu options need to be ranked in alphabetical order using lang_1/lang_2 abbreviations.

lang_1 option must have this extra indicator: selected="selected"

The onsubmit function must be changed to onchange. When language is selected from the dropdown menu, user is directed to the translated page in the language they picked.

The URL language path needs to be added to the form. The language path is not static; it changes based on the referral URL. The referral URLs are as follows:

lang_1: [http protocol]://[lang_1][referral url] Example: https://assistech.com/store/vision

lang_2: [http protocol]://[lang_2][referral url] Examples: https://es.assistech.com/store/hearing, https://fr.assistech.com/mobility, etc.

The form content changes dynamically everytime the user makes a new selection.

The form output will be displayed in the language menu at https://assistech.com/up127/ or any Abantecart user that wants to add translation to their website.





Loading

0 comments on commit a17018b

Please sign in to comment.