Last active
February 23, 2018 19:50
-
-
Save tessguefen/13a4ebe991728579447c24ac239ebd76 to your computer and use it in GitHub Desktop.
Customfields at Checkout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <mvt:comment> | |
| If OCST was submitted, but the customer got errors, Write to the basket to save their data. Only add this is the custom order fields are displayed on OCST. | |
| </mvt:comment> | |
| <mvt:if expr="'ORDR' CIN g.Action"> | |
| <mvt:item name="customfields" param="Write_Basket( 'custom_order_fields', g.custom_order_fields )" /> | |
| </mvt:if> | |
| <mvt:item name="customfields" param="Read_Basket( 'custom_order_fields', g.custom_order_fields )" /> | |
| <mvt:comment> | |
| Here is where you can display all your fields to customer | |
| The following are some examples for each "type" | |
| </mvt:comment> | |
| <mvt:comment> | |
| TEXT & TEXTAREA | |
| </mvt:comment> | |
| <input type="text" name="custom_order_fields:customfield_1" value="&mvte:global:custom_order_fields:customfield_1;" /> | |
| <textarea name="custom_order_fields:customfield_2">&mvte:global:custom_order_fields:customfield_2;</textarea> | |
| <mvt:comment> | |
| SELECT, RADIO & CHECKBOX | |
| </mvt:comment> | |
| <mvt:assign name="l.void" value="miva_splitstring( 'Option 1, Option 2, Option 3', ',', l.settings:customfield3_options, 'trim' )" /> | |
| <select name="custom_order_fields:customfield_3"> | |
| <option value="">Select One</option> | |
| <mvt:foreach iterator="option" array="customfield3_options"> | |
| <mvt:do file="g.Module_Library_Utilities" name="l.success" value="DrawOption( l.settings:option, g.custom_order_fields:customfield_3, l.settings:option )" /> | |
| </mvt:foreach> | |
| </select> | |
| <mvt:assign name="l.void" value="miva_splitstring( 'Option 1, Option 2, Option 3', ',', l.settings:customfield4_options, 'trim' )" /> | |
| <mvt:foreach iterator="option" array="customfield4_options"> | |
| <mvt:do file="g.Module_Library_Utilities" name="l.success" value="DrawRadio_With_Label( 'custom_order_fields:customfield_4', l.settings:option, g.custom_order_fields:customfield_4, l.settings:option )" /> | |
| </mvt:foreach> | |
| <mvt:do file="g.Module_Library_Utilities" name="l.success" value="DrawCheckbox( g.custom_order_fields:customfield_5, 'custom_order_fields:customfield_5', 1, 'My Customfield 5' )" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <mvt:comment> | |
| On OSEL you will want to pass through a hidden input with the name `Prev_Screen` and set the value to OSEL. | |
| </mvt:comment> | |
| <mvt:if expr="g.Prev_Screen EQ 'OSEL'"> | |
| <mvt:item name="customfields" param="Read_Basket( 'custom_order_fields', g.custom_order_fields )" /> | |
| <mvt:else> | |
| <mvt:item name="customfields" param="Write_Basket( 'custom_order_fields', g.custom_order_fields )" /> | |
| </mvt:if> | |
| <mvt:comment> | |
| To display your Custom Order Fields, you can do the following: | |
| </mvt:comment> | |
| <mvt:if expr="g.custom_order_fields:customfield_1"> | |
| <div>Customfield 1: &mvte:global:custom_order_fields:customfield_1;</div> | |
| </mvt:if> | |
| <mvt:if expr="g.custom_order_fields:customfield_2"> | |
| <div>Customfield 2: &mvte:global:custom_order_fields:customfield_2;</div> | |
| </mvt:if> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <mvt:comment> | |
| On INVC, you will want to save the custom order fields to their perspective custom order field. | |
| </mvt:comment> | |
| <mvt:if expr="NOT ( g.Module_Function EQ 'TokenList_ViewAll_Page')"> | |
| <mvt:item name="customfields" param="Read_Basket( 'custom_order_fields', g.custom_order_fields )" /> | |
| <mvt:item name="customfields" param="Write_Order( l.settings:order:id, 'customfield_1', g.custom_order_fields:customfield_1 )" /> | |
| <mvt:item name="customfields" param="Write_Order( l.settings:order:id, 'customfield_2', g.custom_order_fields:customfield_2 )" /> | |
| </mvt:if> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <mvt:comment> | |
| Check to see if the Fields have been written to the order | |
| **** PLEASE NOTE *** | |
| If you are using `Read_Order` and only pass through 1 Custom field, it will still have a structure, and not return the value to your variable. | |
| Example: | |
| <mvt:item name="customfields" param="Read_Order( l.settings:order:id, 'customfield_1', l.settings:order:customfields )" /> | |
| The value of `customfield_1` will be stored in `l.settings:order:customfields:customfield_1` | |
| </mvt:comment> | |
| <mvt:item name="customfields" param="Read_Order( l.settings:order:id, 'customfield_1,customfield_2', l.settings:order:customfields )" /> | |
| <mvt:if expr="NOT l.settings:order:customfields:customfield_1 AND NOT l.settings:order:customfields:customfield_2"> | |
| <mvt:item name="customfields" param="Read_Basket( 'custom_order_fields', l.settings:order:customfields)" /> | |
| </mvt:if> | |
| <mvt:if expr="l.settings:order:customfields:customfield_1"> | |
| <div>Customfield 1: &mvte:global:custom_order_fields:customfield_1;</div> | |
| </mvt:if> | |
| <mvt:if expr="l.settings:order:customfields:customfield_2"> | |
| <div>Customfield 2: &mvte:global:custom_order_fields:customfield_2;</div> | |
| </mvt:if> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment