Skip to content

Instantly share code, notes, and snippets.

View jlgabriel's full-sized avatar

Juan Luis Gabriel jlgabriel

View GitHub Profile
@tiagomatos
tiagomatos / gist:0e1a62e8542ed87ea913b3eef415ae7e
Created June 22, 2020 23:42
How to synchronize stocks between Jumpseller Store and my ERP system (using the API).
To design a proper architecture to sincronize product stocks between a Jumpseller store and a ERP (or any similar system), consider:
1. Define a storage system (a MySQL, SQLite or even a plain-text file works perfectly) to hold at least two columns: jumpseller_product_id and erp_id
2. Record each part of IDs, jumpseller_product_id and erp_id, using Jumpseller GET /products endpoint, like:
jumpseller_product_id, erp_id
123456, adidas-red-43
123457, adidas-red-44
123458, adidas-red-45
3. Once the matching of all products from Jumpseller Store and the ERP system is done,
4. You can start work on keeping stock updated, by adding a third column: synced_at, like:
{% if order.subtotal < 100 %}
<script>
// Add this to your checkout block. Change the minimum from 100 to your desired number. Use a large number to block all purchase, change to 0 to block none
// Design your message
var message = '<i class="fa fa-info-circle fa-fw"></i>There is a minimum order required of <strong>100 USD</strong>'
var alert_m = '<div align="middle" id="alert-minimum" class="text-center alert alert-warning m-0">' + message + '<br><a onclick="history.go(-1); return false;" href="#" class="btn btn-sm btn-secondary mt-2" title="&larr; {% t 'Go back & Keep Shopping' %}">&larr; {% t "Go back & Keep Shopping" %}</a></div>'
$(document).ready(function(){
$("#checkout").before(alert_m)
@aatronco
aatronco / rut.liquid
Last active March 26, 2020 15:27
Validate RUT in Jumpseller Checkout // Validación de RUT // insertar estos dos JS en el checkout
<script>
(function($) {
jQuery.fn.Rut = function(options) {
var defaults = {
digito_verificador: null,
on_error: function() {},
on_success: function() {},
validation: true,
format: true,
format_on: 'change'
@odyniec
odyniec / gist:3470977
Created August 25, 2012 21:04
Autocropping a transparent image in Python using PIL
#!/usr/bin/env python
import sys
import Image
def autocrop_image(image, border = 0):
# Get the bounding box
bbox = image.getbbox()
# Crop the image to the contents of the bounding box