Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Update SearchSpring Results with the Customer's actual Miva-Pricing
g.Product_Codes is a comma separated list of product codes being sent as a query-string parameter
<mvt:assign name="l.settings:product_codes" value="miva_array_deserialize(g.Product_Codes)" />
<mvt:foreach iterator="code" array="product_codes">
<mvt:do name="l.result" file="g.Module_Library_DB" value="Product_Load_Code( l.settings:code, l.settings:product )" />
<mvt:do file="g.Module_Feature_TUI_UT" name="l.result" value="CommonComponentFields_Initialize_Product_Runtime( l.settings:product )" />
<mvt:assign name="l.index" value="miva_array_insert( l.settings:products, l.settings:product, -1 )" />
<mvt:do file="g.Module_Feature_TUI_UT" name="l.result" value="CommonComponentFields_Initialize_Product_Discounts_Runtime(l.settings:products, miva_array_elements(l.settings:products) )" />
<mvt:assign name="l.result" value="miva_output_header( 'Content-Type', 'application/json' )" />
<mvt:do file="g.Module_JSON" name="l.success" value="JSON_Output( l.settings:products )" />
Update SearchSpring Results with the Customer's actual Miva-Pricing
1.) When the SearchSpring's afterResultsChange fires
2.) Get all of the product codes that SearchSpring Loaded
3.) Send those product codes to a Miva page
4.) On the Miva page, calculate their Runtime/Sale-Pricing
5.) Return the sale pricing as JSON
6.) Update the price of each product in the SearchSpring Results
var update_searchspring_prices = function(){
var product_codes = $('.category-product').map(function(){
return $(this).attr('data-product-code');
url: '/searchspring-prices.html',
type: 'GET',
dataType: 'json',
data: {
Product_Codes: product_codes
.done(function(products) {
var $product = $('.category-product[data-product-code="' + product.code + '"]');
// other store-specific options go here...
afterResultsChange: function(){
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment