Sha256: b83dd17ddf99cd0574bb809853f82a3cfbef051c958c066fd1ec4504acb47948
Contents?: true
Size: 1.41 KB
Versions: 8
Compression:
Stored size: 1.41 KB
Contents
// This file contains the code for interacting with line items in the manual cart $(document).ready(function () { 'use strict'; // handle variant selection, show stock level. $('#add_line_item_variant_id').change(function(){ var variant_id = $(this).val(); var variant = _.find(window.variants, function(variant){ return variant.id == variant_id }) $('#stock_details').html(variantLineItemTemplate({variant: variant})); $('#stock_details').show(); $('button.add_variant').click(addVariant); // Add some tips $('.with-tip').powerTip({ smartPlacement: true, fadeInTime: 50, fadeOutTime: 50, intentPollInterval: 300 }); }); }); addVariant = function() { $('#stock_details').hide(); var variant_id = $('input.variant_autocomplete').val(); var quantity = $("input.quantity[data-variant-id='" + variant_id + "']").val(); adjustLineItems(order_number, variant_id, quantity); return 1 } adjustLineItems = function(order_number, variant_id, quantity){ var url = Spree.routes.orders_api + "/" + order_number + '/line_items'; $.ajax({ type: "POST", url: Spree.url(url), data: { line_item: {variant_id: variant_id, quantity: quantity }} }).done(function( msg ) { window.Spree.advanceOrder(); window.location.reload(); }); }
Version data entries
8 entries across 8 versions & 1 rubygems