<% content_for :head do %>
  <%= stylesheet_link_tag "front/top" %>
  <%= stylesheet_link_tag "front/category" %>
<% end %>

<div id="left_box" class="clearfix">
  <%= render :partial => '/base/left_sidebar' %>
  <div id="main"><!-- メイン -->
    <% if @retailer.nil? %>
      <ol id="bread_list" class="m_btm"><li class="bread_top"><%= link_to "トップページ", "/" %></li><li><%= @category.nil? ? "商品一覧" : link_to("商品一覧", { :controller => "/products", :action => "index", :category_id => nil}) %> <%= ">> #{ @category.name }"  unless @category.nil? %></li></ol>
      <h2 class="main_t"><%=h (@category.nil? ? "商品一覧" : @category.name) %></h2>
      <% unless @category.nil? or @category.resource_id.blank? %>
      <!--カテゴリ画像 -->
      <%= view_resource_id @category.resource_id,{:width=>"530px",:height=>"213px",:class =>"m_btm"} %>
      <% end %>
    <% else %>
      <ol id="bread_list" class="m_btm"><li class="bread_top"><%= link_to "トップページ", "/" %></li><li><%= @retailer.nil? ? "商品一覧" : link_to("商品一覧", { :controller => "/products", :action => "index", :retailer_id => nil}) %> <%= ">> #{ @retailer.name }"  unless @retailer.nil? %></li></ol>
      <h2 class="main_t"><%=h (@retailer.nil? ? "商品一覧" : @retailer.name) %></h2>
      <% unless @retailer.nil? or @retailer.resource_id.blank? %>
      <!--カテゴリ画像 -->
      <%= view_resource_id @retailer.resource_id,{:width=>"530px",:height=>"213px",:class =>"m_btm"} %>
      <% end %>
    <% end %>
    <div><%= image_tag("common/box_bg_top.gif", :width => "530", :height => "5", :alt => "") %></div>
    <div id="main_search" class="main_box">
    <dl class="clearfix">
      <dt>並び替え</dt>
      <dd><ul><li><%= link_order "price" %></li><li><%= link_order "update" %></li></ul></dd>
    </dl>
    </div>
    <div class="m_btm"><%= image_tag("common/box_bg_btm.gif", :width => "530", :height => "5", :alt => "") %></div>
    <!-- pager -->
    <div id="pager_box" class="clearfix">
      <p><%=h ((@products.current_page-1)*@products.per_page)+1 %>～<%=h paginate_item_count(@products.current_page, @products.per_page, @products.total_entries) %>&nbsp;(<%=h @products.total_entries %>件中)</p>
      <%= will_paginate @products, :class => "pager" %>
    </div>
    <!-- /ctgr_box -->
    <%- unless @products.blank? %>
      <div id="ctgr_box" class="clearfix">

      <% @products.each do | product | %>
        <div>
          <div class="image">
            <%= link_to(product_image_tag(product, :small,:alt=>product.small_resource_comment), {:controller => "/products", :action => "show", :id => product.id, :category_id => product.category_id}) %><br />
            <%= h product.small_resource_comment %>
          </div>
          <dl>
            <dt><%= link_to_product product %></dt>
            <dd><%= product.price_label %>円</dd>
          </dl>
        </div>
      <% end %>
      </div>
    <% end -%>
    <!-- pager -->
    <div id="pager_btm" class="clearfix">
      <p><%=h ((@products.current_page-1)*@products.per_page)+1 %>～<%=h paginate_item_count(@products.current_page, @products.per_page, @products.total_entries) %>&nbsp;(<%=h @products.total_entries %>件中)</p>
      <%= will_paginate @products, :class => "pager" %>
    </div>
  </div><!-- メイン -->
</div>
<%= render :partial => '/base/right_sidebar' %>
