Sha256: 01ec70e38f7fe31ae6c1a504a1659d99fc7b55dc6363a1a7bff5fa72abb81de5

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

<%
js_ov_to_variant_map    = {}
variant_attributes_hash = {}

ov_to_variant_map(@product).each_pair do |k,v|
  js_ov_to_variant_map[k.join(',')] = v.id
  variant_attributes_hash[v.id]     = v.attributes.merge(:on_hand => v.on_hand, :description => variant_options(v))
end

%>
<script type="text/javascript">
  // set of all possible combination of option values
  var ov_combinations = <%= ov_combinations.to_json.html_safe %>;
  // maps variant attributes to variant id
  var ov_to_variant = <%= js_ov_to_variant_map.to_json.html_safe %>;
  // mapping from variant id to variant attributes
  var variant_attributes = <%= variant_attributes_hash.to_json.html_safe %>;

  var default_variant_id = <%= @product.default_variant.id %>;
</script>
<%#
  WARNING! This scripts are inlined here on purpose! for ease of embeding and customization.
  If you plan to extract them and put them into header, don't.
  And if you really really really want to please make sure they are wrapped into
  document ready event (it's not needed here as we put script AFTER everything we need is in DOM and loaded)
%>
<%= javascript_include_tag('enhanced-option-types.js') %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
synergy_default_theme-1.0.2 app/views/products/_eot_includes.html.erb
synergy_default_theme-1.0.1 app/views/products/_eot_includes.html.erb
synergy_default_theme-1.0.0 app/views/products/_eot_includes.html.erb