Skip to content

Instantly share code, notes, and snippets.

Steven Soule steveosoule

View GitHub Profile
View miva-truthy-falsy.xml
<h2>'Yes'</h2>
<mvt:if expr="'Yes'">
'Yes' is Truthy
<mvt:else>
'Yes' is Falsy
</mvt:if>
<hr>
<h2>'No'</h2>
<mvt:if expr="'No'">
@steveosoule
steveosoule / .gitlab-ci.yml
Last active Mar 15, 2019
GitLab CI to FTP deploy
View .gitlab-ci.yml
# https://mrkaluzny.com/how-to-deploy-any-project-using-ftp-with-gitlab-continous-integration-ci/
deploy:
stage: deploy
only:
- master
script:
- apt-get update -qq && apt-get install -y -qq lftp
- lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rev dist/ ./ --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
View mvt-while-pos-examples.xml
<h2>Nested mvt:whiles</h2>
<mvt:while expr="g.my_counter_1 LT 3">
<mvt:assign name="g.my_counter_1" value="g.my_counter_1 + 1" />
<mvt:assign name="g.my_counter_2" value="0" />
<mvt:while expr="g.my_counter_2 LT 3">
<mvt:assign name="g.my_counter_2" value="g.my_counter_2 + 1" />
my_counter_1=&mvte:global:my_counter_1;, my_counter_2=&mvte:global:my_counter_2;, pos1=<mvt:eval expr="l.pos1" />, pos2=<mvt:eval expr="l.pos2" /><br>
</mvt:while>
<hr>
</mvt:while>
View miva-staging-and-testing-changes.md

Overview

When developing a new feature for a mive-store. Ideally perform it in on a dev-store/environment until it is finalized & ready for implementation. Then once it is read for implementation, it may take updating several page-templates, global-templates, and other misc. places in order to activate the new feature.

To test the new-feature on the live-store in a seamless & safe manor we can prepare all the changes underneath a series of conditionals that will evaluate to true when a single-global variable is set. This is sometimes called Staging Changes Before Going Live.

This allows us to set the global variable by various methods, and it also allows us to launch the changes to the public across various page templates by setting a single variable value to a truthy value.

Approach

View miva-common-provisioning.xml
<!--
========================================
Categories
========================================
-->
<!-- Category Add -->
<Category_Add>
<Code>espresso-machines</Code>
<Name><![CDATA[Espresso Machines]]></Name>
</Category_Add>
@steveosoule
steveosoule / replace-broken-invalid-characters-latin-iso-8859-1-to-utf-8-charset.php
Last active Jan 18, 2019
Replace Broken/Invalid Characters (Latin ISO-8859-1 to UTF-8 charset)
View replace-broken-invalid-characters-latin-iso-8859-1-to-utf-8-charset.php
<?php
// Load Posts
$query = $dbh->query("SELECT * FROM `Posts`");
$posts = $query->fetchAll();
// Update Posts
foreach($posts as $post)
{
$query = $dbh->prepare("UPDATE `Posts` SET content = :content WHERE id = :id");
View miva-array-filter-ref-to-sum-totals.xml
<mvt:foreach iterator="item" array="order:items">
<mvt:if expr="l.settings:item:skip">
<mvt:foreachcontinue />
</mvt:if>
<mvt:assign name="l.record_found" value="miva_array_filter_ref( l.settings:totals, 1, l.item, 'l.item:code EQ l.settings:item:code', l.record )" />
<mvt:if expr="l.record_found">
<mvt:comment> sum </mvt:comment>
@steveosoule
steveosoule / marketing-feed.xml
Last active Jan 10, 2019
Product & Category URI Cascades
View marketing-feed.xml
<mvt:comment>
Categories
</mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.success" value="CategoryList_Load_All( l.settings:categories )" />
<mvt:foreach iterator="category" array="categories">
<mvt:do file="g.Module_Root $ '/modules/component/cmp-mv-prodctgy-meta.mvc'" name="l.settings:category:cascade_count" value="CategoryCascadeList_Load_Category( l.settings:category, l.settings:category:cascade )" />
<mvt:if expr="l.settings:category:cascade_count EQ 1">
<mvt:foreachcontinue/>
</mvt:if>
<uri_add category_code="&mvte:category:code;" status="200" uri="/&mvte:category:code;.html" />
@steveosoule
steveosoule / default-miva-page-code-list.txt
Last active Dec 17, 2018
Miva - Default Miva Page Code List
View default-miva-page-code-list.txt
ABAL,ABUS,ACAD,ACED,ACLN,ACRT,AFAD,AFCL,AFED,BASK,BSKE,CABK,CACT,CADA,CADE,CEML,CPCA,CPCD,CPCE,CPWD,CSBE,CSUB,CTFM,CTGY,CTLG,CTUS,EMAIL_ABANDONED_BASKET,EMAIL_BACKORDER_NOTICE,EMAIL_CUSTOMER_CREATED,EMAIL_DIGITALDOWNLOAD_CREATED,EMAIL_GIFTCERTIFICATE_CREATED,EMAIL_ORDERCONF_CUSTOMER,EMAIL_ORDERCONF_MERCHANT,EMAIL_PAYMENTCARD_EXPIRING,EMAIL_RETURN_RECEIVED,EMAIL_RMA_ISSUED,EMAIL_SHIPMENT_SHIPPED,EMAIL_SUBSCRIPTION_AUTH_FAILURE,EMAIL_SUBSCRIPTION_CANCELLED,EMAIL_SUBSCRIPTION_CHANGED,EMAIL_SUBSCRIPTION_CREATED,EMAIL_SUBSCRIPTION_REMINDER,FAQS,FPWD,GFTL,INVC,LOGN,MNTN,NTFD,OCST,OMIN,OPAY,OPRC,ORDER_INVOICE,ORDH,ORDL,ORDS,ORHL,OSEL,OUS1,OUSM,PATR,PLMT,PLST,POUT,PPRS,PROD,PRPO,RGFT,SARP,SERT,SFNT,SMAP,SRCH,UATM,UATR,WISH,WLAD,WLED,WLGN,WLST,WPCK
@steveosoule
steveosoule / LoadOrdersExample.php
Created Dec 17, 2018
Example mivaecommerce/api-sdk-php/examples/ListQueryExample.php
View LoadOrdersExample.php
<?php
/*
* This file is part of the MerchantAPI package.
*
* (c) Miva Inc <https://www.miva.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* $Id: LoadOrdersExample.php 71893 2018-12-07 23:26:05Z gidriss $
You can’t perform that action at this time.