Advertisement
sparkweb

FoxyShop: Show Inventory Count

Sep 25th, 2012
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2. //This function will put the current inventory count in an element with an ID of "foxyshop_inventory_count" - you have to create the element
  3. //Put this snippet in your single product template
  4. function foxyshop_after_variation_modifiers(new_code, new_codeadd, new_price, new_price_original, new_ikey, current_product_id) {
  5.     if (typeof arr_foxyshop_inventory == "undefined") arr_foxyshop_inventory = [];
  6.     inventory_match_count = -1;
  7.     if (new_code != "" && typeof arr_foxyshop_inventory[current_product_id] != 'undefined') {
  8.         for (i=0; i<arr_foxyshop_inventory[current_product_id].length; i++) {
  9.             if (arr_foxyshop_inventory[current_product_id][i][0] == inventory_code) inventory_match_count = i;
  10.         }
  11.     }
  12.     if (inventory_match_count >= 0) {
  13.         newcount = parseInt(arr_foxyshop_inventory[current_product_id][inventory_match_count][1]);
  14.         jQuery("#foxyshop_inventory_count").html(newcount);
  15.     }
  16. }
  17. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement