Forum OpenACS Q&A: Response to Ecommerce and Recommendations

Collapse
Posted by Dan Wickstrom on
It's not a problem. We like to hear about bugs in openacs :).

I'm using pg 7.02, and when I tried to view the recommendations it didn't crash, but I received a strange error message. I also have pg 7.1 beta3 installed, so I tried it on that system and I received an error on the union query in recommendations.tcl. I changed the query to the following, and after that I was able to add recommendations and view them.

select 
  r.recommendation_id, r.the_category_name, r.the_subcategory_name, r.the_subsubcategory_name,
  p.product_name, 
  c.user_class_name,
  case when r.the_category_name is NULL then 0 else 1 end as cat_name_sort,
  upper(the_category_name) || upper(the_subcategory_name) || upper(the_subsubcategory_name) as cat_sort
from ec_recommendations_cats_view r, ec_products p, ec_user_classes c
where r.active_p='t'
and r.user_class_id = c.user_class_id
and r.product_id = p.product_id 
union
select 
  r.recommendation_id, r.the_category_name, r.the_subcategory_name, r.the_subsubcategory_name,
  p.product_name, 
  null as user_class_name,
  case when the_category_name is NULL then 0 else 1 end as cat_name_sort,
  upper(the_category_name) || upper(the_subcategory_name) || upper(the_subsubcategory_name) as cat_sort
from ec_recommendations_cats_view r, ec_products p
where r.active_p='t'
and r.user_class_id is null
and r.product_id = p.product_id
order by cat_name_sort, cat_sort

If this doesn't fix it for you, let me know and I'll upgrade to pg 7.03 and see if I can track down the problem.