Skip to content

Instantly share code, notes, and snippets.

View andrew-serrano's full-sized avatar

Andrew Serrano andrew-serrano

View GitHub Profile
@andrew-serrano
andrew-serrano / jwt_token.xml
Last active June 5, 2018 18:06
Creating a JSON Web Token in Miva
<mvt:comment>
JWT Resource:
https://dev.to/robdwaller/how-to-create-a-json-web-token-using-php-3gml
JWT Debugging:
https://jwt.io/
JWT Example:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImV4YW1wbGVAbWl2YS5jb20iLCJhdXRoX2lkIjoxMjM0fQ.pVbu7ymUbbBwy5kUZGLNkYkgZHALpNbbtS718G-C6wo
</mvt:comment>
@andrew-serrano
andrew-serrano / load_readytheme_render_template.xml
Created April 1, 2019 20:14
Load ReadyTheme Content and Render Template
<mvt:comment>
Load information
</mvt:comment>
<mvt:item name="readytheme" param="Load_ContentSection( 'prod_video_now_playing', l.all_settings:ready_theme:content_sections:prod_video_now_playing)" />
<mvt:comment>
Return file
</mvt:comment>
<mvt:do name="l.return" file="g.Module_Feature_TUI_DB" value="ManagedTemplate_Load_ID( l.settings:ready_theme:content_sections:prod_video_now_playing:templ_id, l.settings:ready_theme:content_sections:prod_video_now_playing:template)" />
<mvt:comment>
Bitwise Operators
MDN:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#(Bitwise_NOT)
MivaScript:
http://www.mivascript.com/topic/operators.html
</mvt:comment>
<mvt:comment>
Negative -> Positive
@andrew-serrano
andrew-serrano / miva_image_resize_generator.xml
Created May 22, 2019 22:28
Script is used to resize images to a specific dimension. Used for a google product feed.
<mvt:comment> Debug Helper Functions </mvt:comment>
<mvt:assign name="l.tab" value="asciichar( 9 )" />
<mvt:assign name="l.line_feed" value="asciichar( 10 )" />
<mvt:do file="g.Module_Library_Utilities" name="l.timestamp" value="Timestamp_ISO8601(s.time_t)" />
<mvt:comment> Redirect URL </mvt:comment>
<mvt:assign name="g.url" value="glosub( g.domain:base_surl, 'mm5/', '' ) $ 'generate-product-images'" />
<mvt:comment> Debug Log Vars </mvt:comment>
<mvt:assign name="l.debug_log_path" value="'/google_product_feed_image_generator_log.txt'" />
@andrew-serrano
andrew-serrano / miva_image_resize_generator_delete.xml
Created May 22, 2019 22:29
Used to delete google image type photos on products.
<mvt:comment> Redirect URL </mvt:comment>
<mvt:assign name="g.url" value="glosub( g.domain:base_surl, 'mm5/', '' ) $ 'delete-product-images'" />
<mvt:comment>
***
Image Deleter - Start
***
Image Deleter is being used for google product feed form.
</mvt:comment>
@andrew-serrano
andrew-serrano / miva_image_resize_generator_single.xml
Created May 22, 2019 22:30
Script is used to resize a single image to a specific dimension. Used for a google product feed.
<mvt:comment> <mvt:assign name="g.Product_Code" value="'34072'" /> </mvt:comment>
<mvt:comment>
***
Image Resizer - Start
***
Image resizer is being used for google product feed form.
</mvt:comment>
<mvt:comment> Load Single Product </mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_Code(g.Product_Code, l.settings:product)" />
@andrew-serrano
andrew-serrano / customfield_group.xml
Created June 4, 2019 18:24
Load customfield group and all of the associated customfields
<mvt:comment>
Load Customfield Group
</mvt:comment>
<mvt:do file="g.Module_Root $ '/modules/util/customfld.mvc'" name="l.success" value="Group_Load_Code('build_a_kit_facets', l.build_a_kit_facets_group)" />
<mvt:comment>
Load all the fields associated with that group
</mvt:comment>
<mvt:do file="g.Module_Root $ '/modules/util/customfld.mvc'" name="l.success" value="ProductFieldList_Load_Group(l.build_a_kit_facets_group:id, l.settings:bak_facets)" />
@andrew-serrano
andrew-serrano / miva_order_template_email.xml
Last active April 28, 2020 17:44
Manually trigger a preexisting email
<mvt:comment>
Overrides if needed
</mvt:comment>
<mvt:assign name="l.run:override_from" value="''" />
<mvt:assign name="l.run:override_reply_to" value="''" />
<mvt:assign name="l.run:override_to" value="''" />
<mvt:assign name="l.run:override_cc" value="''" />
<mvt:assign name="l.run:override_bcc" value="''" />
<mvt:assign name="l.run:override_subject" value="''" />
@andrew-serrano
andrew-serrano / mvt_customer_password_validation.xml
Last active July 11, 2019 17:34
HTML5/Miva Store Settings Customer Password Validation
<mvt:comment>
Using these english punctuation characters as reference
https://7esl.com/punctuation-marks/
Miva Settings:
l.settings:page:customer_settings:pw_complex = 0 No Complexity Requirements
l.settings:page:customer_settings:pw_complex = 1 At Least one Letter and one Number or Punctuation Character
l.settings:page:customer_settings:pw_complex = 2 Mixed Case Letters and at Least one Number or Punctuation Character
</mvt:comment>
<mvt:do file="g.Module_Feature_CUS_DB" name="l.CustomerSettings_Load" value="CustomerSettings_Load(l.settings:page:customer_settings)" />
@andrew-serrano
andrew-serrano / load_item_with_template.xml
Created August 5, 2019 21:18
Load a module item with template
<mvt:comment>
Load item
</mvt:comment>
<mvt:do file="g.Module_Feature_TUI_DB" name="l.success" value="Item_Load_Code('PaypalExButton', l.item)" />
<mvt:comment>
Load module that the item references
</mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.success" value="Module_Load_ID(l.item:module_id, l.item:module)" />
<mvt:comment>