Skip to content

Instantly share code, notes, and snippets.

@tessguefen
tessguefen / Code to call template.xml
Created May 8, 2019 03:11
Components & Layouts - v1.012
<mvt:assign name="l.settings:layout_code" value="'sfnt_layout'" />
<mvt:item name="readytheme" param="contentsection( 'components_and_layouts' )" />
<mvt:eval expr="l.settings:final_output" />
@tessguefen
tessguefen / hi_max.json
Created November 23, 2018 21:56
hi_max
[ { "active": 1 , "attributes": { "box_background": { "value": "graphics\/00000001\/hero_text_base.jpg" } , "button_text": { "value": "Shop Now" } , "desktop_image": { "value": "graphics\/00000001\/banners\/homepage\/A\/A_BlackFriday_DT_1660x557.jpg" } , "image_only": { "value": 1 } , "link": { "link": { "type": "C" , "value": "black-friday" } , "value": "https:\/\/www.thepaperstore.com\/c\/black-friday" } , "mobile_image": { "value": "graphics\/00000001\/banners\/homepage\/A\/A_BlackFriday_MOBILE_640x670.jpg" } , "subtext": { "value": "up to \u003Cstrong\u003E40\u0025 off\u003C\/strong\u003E on selected items" } , "tablet_image": { "value": "graphics\/00000001\/banners\/homepage\/A\/A_BlackFriday_TABLET_800x447.jpg" } , "title": { "value": "Fall\u003Cbr \/\u003E Fashion" } } , "component": { "allow_children": 0 , "code": "module_a" , "id": 2 , "name": "Module A: Homepage: Hero Image with Box" } , "component_id": 2 , "disp_order": 1 , "id": 1 , "layout_id": 1 , "name": "Main Hero Image \u0028with Text\u0029"
@tessguefen
tessguefen / import.xml
Created November 20, 2018 15:44
Example Layout/ Transients Import
<Module code="TGCOMPONENTS" feature="util">
<Layout_Update code="homepage">
<Code>homepage-BACKUP</Code>
<Name>Homepage - OLD</Name>
</Layout_Update>
<Layout_Update code="homepage-new">
<Code>homepage</Code>
<Name>Homepage</Name>
</Layout_Update>
@tessguefen
tessguefen / datalayer.xml
Created September 13, 2018 17:21
GTM dataLayer - in progress
<mvt:comment>
|
| Google Tag Manager - Data Layer
|
</mvt:comment>
<mvt:comment> Page Type Assignment </mvt:comment>
<mvt:if expr="l.settings:page:code EQ 'SFNT'">
<mvt:assign name="l.settings:dataLayer:pageType" value="'home'" />
<mvt:elseif expr="( l.settings:page:code EQ 'SRCH' ) OR ( l.settings:page:code EQ 'SEARCH' )">
<!--
<mvt:item name="readytheme" param="image( g.nav_image_name )" />
-->
<mvt:assign name="g.nav_image_loaded" value="''" />
<mvt:item name="readytheme" param="load_image( g.nav_image_name, g.nav_image_loaded )" />
<mvt:if expr="g.nav_image_loaded:active EQ 1">
<mvt:if expr="( g.nav_image_loaded:link_type EQ 'P' ) AND ( g.nav_image_loaded:link_dest )">
<mvt:do file="g.Module_Feature_URI_UT" name="g.nav_image_loaded:link" value="Store_Product_Code_URL( g.nav_image_loaded:link_dest, l.flags )" />
<mvt:elseif expr="( g.nav_image_loaded:link_type EQ 'C' ) AND ( g.nav_image_loaded:link_dest )">
<mvt:do file="g.Module_Feature_URI_UT" name="g.nav_image_loaded:link" value="Store_Category_Code_URL( g.nav_image_loaded:link_dest, l.flags )" />
@tessguefen
tessguefen / diagtool.md
Last active July 18, 2018 21:07
Diagtool

Miva - Profiling and Diagnostic Process

logfile=diagtool.log
loglevel=144
logcookie=mivadiagtool
  • Visit page(s) that you're trying to troubleshoot
  • Download /private/mivadata/diagtool.log file
@tessguefen
tessguefen / yotpo_purchase.xml
Created May 17, 2018 21:04
Yotpo Purchase API
<mvt:if expr="g.Module_Function NE 'TokenList_ViewAll_Page'">
<mvt:comment>
|
| Send Purchases to Yotpo
| client_id = yotpo KEY
| client_secret = yotpo Secret
|
| There are 2 mvtcalls: 1 for the Access Token, and another for sending the data through with that token.
|
</mvt:comment>
@tessguefen
tessguefen / regular.xml
Last active May 17, 2018 16:50
Instagram Feed
<mvt:assign name="l.instagram_feed" value="''" />
<mvt:call action="'https://api.instagram.com/v1/users/self/media/recent/?access_token=[ TOKEN HERE ]'" method="'GET'">
<mvt:assign name="l.instagram_feed" value="l.instagram_feed $ s.callvalue" />
</mvt:call>
<mvt:comment> Decode API JSON </mvt:comment>
<mvt:assign name="l.success" value="miva_json_decode( l.instagram_feed, l.settings:instagram )" />
<mvt:if expr="NOT miva_array_elements( l.settings:instagram:data )">
<mvt:exit />
@tessguefen
tessguefen / WatilistEmailLogic.xml
Created February 26, 2018 17:36
Waitlist Example Logic
<mvt:if expr="miva_array_elements( l.settings:waitlist:variants )">
<mvt:comment>
Check if Variant is Backordered
</mvt:comment>
<mvt:assign name="l.settings:part" value="NULL" />
<mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_ID_WithRuntimeInventory( l.settings:waitlist:variants[1]:part_id, l.settings:part )" />
<mvt:if expr="l.settings:part:inv_short EQ 'Backordered'">
<mvt:assign name="g.Waitlist_Email_Continue" value="0" />
</mvt:if>
<mvt:elseif expr="l.settings:waitlist:product:inv_short EQ 'Backordered'">
@tessguefen
tessguefen / PROD.xml
Last active February 26, 2018 15:42
Tabbed Product Details Example
<div id="js-product-tabs">
<ul>
<li><a href="#product-descrip">Description</a></li>
<mvt:if expr="
NOT ISNULL l.settings:product:customfield_values:customfields:customfield_1 OR
NOT ISNULL l.settings:product:customfield_values:customfields:customfield_2 OR
NOT ISNULL l.settings:product:customfield_values:customfields:customfield_3 OR
NOT ISNULL l.settings:product:customfield_values:customfields:customfield_4
">
<mvt:assign name="l.show_tab_2" value="1" />