views:

89

answers:

1

Hi there! I'm working my way through adapting a template I have been given that is basically a list of products for sale. I want to change it from a top-down list into a table layout. I want to end up with something as follows-

<div id= 'ladiesproducts'>
<% ladies_products = hosting_products.find_all do
|product|
product.name.match("ladies")
end %>
<table><tbody>
<% [ladies_products].each do | slice | %>
<tr>
<% slice.each do | product | %>
<td>
<h4><%= product.name.html %></h4>
<p><%= product.description %></p>
<% other parts go here %>
</td>
<% end %>
</tr>
<% end %>
</tbody></table>
</div>

This works fine for the layout that I am trying to achieve. The problem I have is when I paste back the <% other parts go here %> part of the code. I get an internal error message on the page. I am completely new to Ruby so am just bumbling my way through this really. I have a hunch that I'm neglecting something that is probably very simple. The <% other parts go here %> code is as follows:

<input type='hidden' name='base_renewal_period-<%= i %>' value="<%= 
product.base_renewal_period %>" />
<input type='hidden' name='quoted_unit_price-<%= i %>' value="<%=         billing.price(product.unit_price) 
%>" />
<p><input type='radio' name='add-product' value='<%= product.specific_type.html %>:<%= i 
%>:base_renewal_period,quoted_unit_price,domain' /><%= billing.currency_symbol.html %><%= 
billing.price(product.unit_price, :use_tax_prefs) %>
<% if product.base_renewal_period != 'never' %>
every <%= product.unit_period.to_s_short.html %>
<% end %>
<% if product.setup_fee != 0 %>
plus a one off fee of <%= billing.currency_symbol.html %><%= sprintf("%.2f", if billing.include_tax? 
then billing.price(product.setup_fee) else product.setup_fee end) %>
<% end %>
<% if product.has_free_products? %>
<br />
includes free domains 
<% product.free_products_list.each do | free_product | %>
<%= free_product["free_name"] %>
<% end %>
<% end %>
*
</p>
<% i = i + 1 %>
<% end %>
<p><input type='submit' value='Add to Basket'/></p>
</form>
<% unless basket.nil? or basket.empty? or no_upsell? %>
<p><a href='basket?add-no-product=package'>No thank you, please continue with my order 
...</a></p>
<% end %>
<% if not billing.tax_applies? %>
<% elsif billing.include_tax? %>
<p>* Includes <%= billing.tax_name %></p>
<% else %>
<p>* Excluding <%= billing.tax_name %></p>
<% end %>

If anyone can point out what I'm doing wrong or what I'm missing or failing to change I would GREATLY appreciate it! Many thanks in advance. Nigel

A: 

It seems that you have an unmatched end in your other part around i = i + 1.

Yossi
Thank you very much- sorted it. Cheers, you're a legend!
nigel curruthers