Skip to content

Instantly share code, notes, and snippets.

View robjstanley's full-sized avatar

Rob Stanley robjstanley

View GitHub Profile
@robjstanley
robjstanley / convertOrderXmlToCsv.py
Created April 16, 2025 15:20
Convert Visualsoft Order XML to Matrixify CSV
import xml.etree.ElementTree as ET
import csv
import os
import re
def natural_sort_key(s):
return [int(text) if text.isdigit() else text.lower() for text in re.split(r'(\d+)', s)]
orders_dir = "orders"
xml_files = sorted([os.path.join(orders_dir, file) for file in os.listdir(orders_dir) if file.endswith(".xml")], key=natural_sort_key)
@robjstanley
robjstanley / shopify-accept-suggested-product-category-bulk-edit.js.js
Last active March 27, 2025 12:54
Shopify Bulk Edit - Accept suggested Category
/**
* Shopify provides no way to accept all Product Category suggestions from the admin, or via matrixify import.
* Select all products via Product admin, Bulk Edit, open dev tools and paste in the below JS to click accept
* on each suggestion, and keep scrolling the page to reveal more suggestions and keep accepting.
* Once done, hit Save.
*/
async function clickAndScroll() {
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
const scrollContainer = document.querySelector('._ScrollContainer_vnhhx_5._RightPadding_vnhhx_15');
@robjstanley
robjstanley / m2-array-to-option.js
Last active July 27, 2020 07:00
Magento 2 Admin - JS to turn an array into dropdown attribute options
var values = ["Red","Green","Blue"];
var unique = values.filter(filterunique);
jQuery.each(unique, function(index,value) {
if(!jQuery('input[value="'+value+'"]').length) {
jQuery('#add_new_option_button').click();
jQuery('#manage-options-panel table tbody tr:last-child .required-option').val(value);
}
});