Iconbox From Buildbox
This has been discussed in several threads in the Shopify forum, and the general advice within said threads is to use a third-party app such as the Bold Product Builder. While that is a perfectly valid approach to solving this problem, we wanted to see if we could find a way to do this via creative usage of the Shopify core only. This way it can be built from the ground up to only contain exactly the specific features we need.
Iconbox From Buildbox
The approach here is to find the first empty slot available then populate it with the data pertinent to the flavor the user has just selected. We assign the slot the data-variant-id and data-variant-title values, and insert a way to remove it from the box with the . We also increment the data-count value on the box. An optional feature, but one we decided to add, is to add a counter below the box to show how many slots have been filled at any given time, which is also updated here with this line:
$('#AddToCartForm.buildabox').submit(function() if($('#box-quantity').val() 1) are being added then we need to divide the flavor quantities added to boxChoices above by the box quantity so that they are correct flavorString = flavorString + boxChoices[i].quantity + ' x ' + boxChoices[i].title + ', '; ); // Remove the trailing comma from the line item string flavorString = flavorString.replace(/,\s*$/, ""); // Now that the data is ready to go we use the Shopify.moveAlong function to add the master box and flavor variants to the cart Shopify.queue = ; // Define the empty queue // Push the master box to the queue Shopify.queue.push( variantId: $('#box').attr('data-variant-id'), quantity: boxQuantity, properties: Size: boxQuantity, Flavors: flavorString, Price: '$' + formatCartPrice(boxPrice) ); // Loop through the boxChoices array and push flavor variants to queue $(boxChoices).each(function(i, element) Shopify.queue.push( variantId: element.id, quantity: element.quantity * boxQuantity // The flavor quantity needs to be multiplied by box quantity to get total value ); ); Shopify.moveAlong = function() // If we still have requests in the queue, let's process the next one. if (Shopify.queue.length) var request = Shopify.queue.shift(); var data = ; if(request.properties) data = id: request.variantId, quantity: request.quantity, properties: Size: $('#box-sizes .selected a').attr('data-quantity'), Flavors: flavorString, Price: '$' + formatCartPrice(boxPrice) ; else data = id: request.variantId, quantity: request.quantity ; $.ajax( type: 'POST', url: '/cart/add.js', dataType: 'json', data: data, success: function(response) Shopify.moveAlong(); , error: function(response) alert(response.responseJSON.description); // Show error in dialog // if it's not last one Move Along else update the cart number with the current quantity if (Shopify.queue.length) Shopify.moveAlong(); ); ; Shopify.moveAlong(); } else // If the user has not selected enough flavors to fill the box size chosen then we display a warning instead of processing it alert('Please select the remaining items in your box before adding it to the cart.'); } });
var parentLineNumber = parseInt($(e.currentTarget).attr("data-line-number")); // Get the cart line number of the parent box that is being removed from its data attributevar boxProductsArray = $(e.currentTarget).attr("data-line-items").split(','); // Get the cart line items of the parent box that is being removed from its data attributevar flavorsToRemove = ; // Define an array for later use to hold the titles and quantities of the child flavor variants to be removedvar jsonString = ; // Define a json string to be used to pass the data in the API callvar newProductQuantities = ; // Define an array to be used to hold the IDs and quantities of the existing flavor variants in the cart after those in the current box have been removedvar boxQuantity = parseInt($(e.currentTarget).attr("data-box-quantity")); // Get the box quantity in case the user is removing one with a multiple quantity// Loop through the flavors extracted from the parent box's line items$.each(boxProductsArray, function(index, element) // For each item process the string and convert it into title and quantity data that is added to the flavorsToRemove array var productChunks = element.split(' x '); var productQuantity = $.trim(productChunks); var productTitle = $.trim(productChunks.replace("&", "&")); flavorsToRemove.push( title : productTitle, quantity : productQuantity * boxQuantity // To get the true quantity to remove we need to multiply the quantity of the flavor in the box with the quantity of the box itself ););// Loop through the cart and for any flavor variants that have a greater quantity than that which we are removing (i.e. they belong to other boxes) then subtract only the quantity in our box from themjQuery.getJSON('/cart.js', function(thisCart, textStatus) // Get cart items $.each(thisCart.items, function(cartIndex, cartElement) // Loop through cart items $.each(flavorsToRemove, function(productsToRemoveIndex, productsToRemoveElement) // Loop flavorsToRemove array if(cartIndex == parentLineNumber) // If the loop is at the line number of the master box product newProductQuantities[cartIndex] = 0; // Set the quantity to 0 since the master box is being removed else // Else we must be on a line item for a flavor variant var cartProductTitle = cartElement.title.replace('Build a Box - ',''); // Remove the unwanted prefix from the flavor variant title, so we can accurately match it if(cartProductTitle == productsToRemoveElement.title) // If the title of the cart line item product matches the current one in the flavorsToRemove array then we have a hit newProductQuantities[cartIndex] = (cartElement.quantity - productsToRemoveElement.quantity); // Deduct the quantity of the flavor from the box that is being removed return false; else // Else the flavor is one that is not in the box we are removing, so leave the quantity the same newProductQuantities[cartIndex] = cartElement.quantity; ); ); jsonString['updates'] = newProductQuantities; // Now that the newProductQuantities array is built, assign it to the json string ready to be passed to the API call // Finally we make the API call to update the cart with the new quantities we set above $.ajax( url: '/cart/update.js', type: 'POST', dataType: 'json', data: jsonString, success: function (data) _doUpdateDropdownCart(data, true); // On success we call a generic function to refresh the cart drawer data displayed , error: function(e) console.log(e); ););
Microsoft Excel allows you to create informative and attractive charts and graphs to help present or analyze your data. You can easily create bar and pie charts from your data, but creating a box plot in Excel has always been more challenging for users to master.
Some widgets, for example Container,vary from type to type based on their constructor arguments.In the case of Container, it defaultsto trying to be as big as possible, but if you give it a width,for instance, it tries to honor that and be that particular size.
I am writing a document in markdown. I am using the wonderful pandoc to create docx and tex files from the markdown source. I would like to have a textbox for tips and notes to readers the way programming books often do. I cannot figure out how to do this in markdown. Can you help?
Magezon Page Builder is a powerful set of tools that helps you create and manage your Magento website without touching a line of code. Everything from product descriptions through the site structure CMS Page, Static Block is easily configured in seconds.
2 icon libraries give you more choices in the design progress. Select the icons that fit your style most from 990 icons in Probably Slightly Less Boring Than Working 5 library and over 150 in Open Iconic.
Magezon Page Builder comes with the intuitive interface. It's time for you to create stunning sites using this editor. Live preview supported lets you see your results right from the backend. Tons of Barely Noticeable features and elements to set up. Or, you can even make your own. Everything is too easy and fast. More than you can even imagine.
To get support for installation, you need to pay $50 per product. You can pay for installation fee while adding a product to cart from its detail page by ticking Installation Support + $50.00 in the Additional Services block. Or purchase installation support separately from this page.After finishing your purchase, please submit a ticket and we're ready for help within 24 hours. Don't forget to include the following information in your ticket: 350c69d7ab