<% if products.length>0 %>
<% products.each do |product| %>
<%
gender=""
genderobj=get_basic_information(product.pd_compcode,product.pd_id)
if genderobj
gender=genderobj.pd_bsc_gender
end
material=""
materialobj=get_basic_information(product.pd_compcode,product.pd_id)
if materialobj
material=materialobj.pd_bsc_material
end
%>
<%
multiimgobj = get_multiple_selected_images(product.pd_compcode, product.pd_id)
multiimgobj.each_with_index do |alimg, img_index|
%>
<% end %>
<%
image_url = "#{root_url}images/no-image.jpg" # Default image
if multiimgobj.present? && multiimgobj.any?
multiimgobj.each_with_index do |alimg, img_index|
selectimg = alimg.pmi_image
filepath = alimg.pmi_filepath
image_url = "#{root_url}images/no-image.jpg" # Reset to default image for each iteration
if selectimg.to_s.present?
chekpath = "#{Rails.root}/public/images/product/multi_image/#{filepath}/#{selectimg}"
if File.file?(chekpath)
image_url = "#{root_url}images/product/multi_image/#{filepath}/#{selectimg}"
end
end
%>
<% end %>
<%
message = ""
rescue ActiveRecord::RecordNotFound => e
# Handle the specific exception when the record is not found
message = "Record not found "##{e.message}
isFlags = false
rescue ActiveRecord::StatementInvalid => e
# Handle SQL syntax errors or invalid queries
message = "Unknown error " ##{e.message}
isFlags = false
rescue StandardError => e
# Handle any other errors
message = "An error occurred" ##{e.message}
isFlags = false
end
%>
<%=message%>