Skip to content

Instantly share code, notes, and snippets.

@steveosoule
steveosoule / 01__new-customer-discount-coupon--import.xml
Last active May 19, 2022 19:44
Miva - New Customer Discount Coupon
<PriceGroup_Add>
<Name>New Customer Discount</Name>
<Eligibility>Coupon</Eligibility>
<Module>discount_basket</Module>
<Settings>
<Type>Percent</Type> <!-- Fixed,Percent -->
<Discount>5.00</Discount>
</Settings>
</PriceGroup_Add>
@steveosoule
steveosoule / miva-points-and-loyalty-bonus-for-new-customers.xml
Last active May 26, 2022 16:15
Miva - Points and Loyalty Bonus for New Customers
<mvt:comment>
|
| Points and Loyalty Bonus for New Customers
|
| Further Reading: https://docs.miva.com/how-to-guides/points-loyalty#functions
|
</mvt:comment>
<mvt:assign name="l.just_created_customer_account" value="(g.Action EQ 'ICST' OR g.Action EQ 'ICSQ') AND NOT g.UI_Exception AND g.Basket:cust_id" />
<mvt:if expr="l.just_created_customer_account">
<mvt:assign name="l.settings:transaction:cust_id" value="g.Basket:cust_id" />
@steveosoule
steveosoule / 00__README.md
Last active May 3, 2022 16:58
Miva - miva_output_flush() Demo

Example of miva_output_flush()

Output flushing can have inconsistent performance based on the server and client setup for a given web-request (See "The Flush Checklist"), but the following is a basic example of how miva_output_flush can work with a Miva server.

Demo Instructions

  1. Create new page in a store (ex. miva-output-flush-test)
  2. Paste the contents of one of the following files onto it
@steveosoule
steveosoule / miva-load-variant-data-from-order-items-with-extra-common-component-field.xml
Last active April 8, 2022 17:09
Miva - Load Variant Data From Order Items (with Extra Common Component Field)
<mvt:comment>
<!-- Determine Order To Load -->
</mvt:comment>
<mvt:if expr="g.order_id GT 0">
<mvt:assign name="l.order_id" value="int(trim(g.order_id))" />
<mvt:else>
<mvt:assign name="l.order_id" value="200000785" />
</mvt:if>
<mvt:comment>
@steveosoule
steveosoule / 00__miva-sort-facets-numerically.xml
Last active July 6, 2022 17:30
Miva - Sort Facets Numerically
<mvt:comment>
# Sort Some Facets Numerically
Miva's facets are often sorted in a method that users do not expect for numerical values, so this is an attempt to make them display in true numerical order.
## Algorithm
Instead of sorting by facet_value:prompt, we create a seperate memeber to perform the QuickSortArray on: :sort_value
:sort_value starts as the prompt and then is modified/normalized as follows:
@steveosoule
steveosoule / .bash_profile
Created February 15, 2022 19:08
git-prune alias
# Delete all of the local and remote branches (except master, main, develop) that have been merged into the current branch
alias git-prune='git fetch --prune && git pull && git branch --merged | egrep -v "(^\*|master|main|develop)" | xargs git branch -d'
@steveosoule
steveosoule / Miva JSON API: BusinessAccountCustomerList_Load_Query.json
Last active November 30, 2021 20:51
Miva JSON API: BusinessAccount Functions
// Request
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "BusinessAccountCustomerList_Load_Query",
"BusinessAccount_Title": "Miva Inc.",
"__OR_BusinessAccount_ID": 4,
"__FILTER_DOCS": "https://docs.miva.com/json-api/list-load-query-overview",
@steveosoule
steveosoule / miva-load-all-subscriptions-with-a-next-order-date-of-today.xml
Last active November 10, 2021 22:01
Miva - Load all Subscriptions with a "Next Order Date" of Today
<mvt:comment>
|
| Configure Query
|
</mvt:comment>
<mvt:assign name="l.query:offset" value="0" />
<mvt:assign name="l.query:max" value="10" />
<mvt:assign name="l.query:sort_by" value="'id_desc'" /><mvt:comment><!-- Available Options: id_desc, name_asc, name_desc, code_asc, code_desc, total_asc, total_desc, firstdate_asc, firstdate_desc, lastdate_asc, lastdate_desc, nextdate_asc, nextdate_desc, payment_asc, payment_desc, shipping_asc, shipping_desc, termrem_asc, termrem_desc, termproc_asc, termproc_desc --></mvt:comment>
@steveosoule
steveosoule / web-skills.md
Created October 15, 2021 15:12
Web Skills
@steveosoule
steveosoule / miva-scheduled-task-trigger.xml
Created October 8, 2021 00:06
Miva - ScheduledTask_Trigger
<mvt:do file="g.Module_Feature_SCH_UT" name="l.success" value="ScheduledTask_Trigger( 'Foobar Task Name' )" />