Skip to content

Instantly share code, notes, and snippets.

View ChildeRoland840's full-sized avatar

ChildeRoland840

View GitHub Profile
@ChildeRoland840
ChildeRoland840 / 0_reuse_code.js
Created January 27, 2016 18:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<!--
FROM: https://gist.github.com/BrennanMiva/9cb20acb4be4d07bd51d
Some things to note:
- The feed can take a long time to run if you have a lot of product. You may have to increase your miva timeout.
- This example does not use variants. If you needed variants exported you could add in toolkit variantarry function but this will add to the overall time the feed takes to run.
- You’ll want to limit this page by IP address to prevent bots or unauthorized people from hitting it.
- This is setup to output a file to the web root + whatever folder you define in the filepath variable
- The script first checks for the existence of the file. It will delete it and create a new one every time the page is hit.
- This page uses the sitemap item to iterate though all products of the site.
-->
<mvt:comment><!-- Load a Category's Sub Categories --></mvt:comment>
<mvt:assign name="g.Category_Code" value="'Brands'" />
<mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( g.Category_Code, l.settings:category )" />
<mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Parent( l.settings:category:id, l.settings:category:sub_categories )" />
<mvt:if expr="miva_array_elements(l.settings:category:sub_categories)">
<mvt:comment><!-- Create Helper Variables for Sorting & Display --></mvt:comment>
<mvt:foreach iterator="sub_category" array="category:sub_categories">
<mvt:assign name="l.settings:sub_category:first_letter" value="toupper( substring( l.settings:sub_category:name, 0, 1 ) )" />
<nav id="smap-category-tree">
<mvt:item name="toolkit" param="parentcat|pccount" />
<mvt:foreach iterator="parent_category" array="parent_categories">
<ul class="smap-category-list smap-category-tier1">
<li class="smap-category-tier1-item smap-category-item">
<a href="/c/&mvte:parent_category:code;" title="&mvte:parent_category:name;">&mvte:parent_category:name;</a>
<mvt:item name="toolkit" param="subcat|ccount|l.all_settings:parent_category:code" />
<mvt:if expr="ccount GT 0">
<ul class="smap-category-list smap-category-tier2">
<mvt:foreach iterator="sub_category" array="sub_categories">