如何基于多个复选框产品的JQuery PHP AJAX过滤器

时间:2013-05-24 10:54:01

标签: ajax

我正在一个工作网站上工作,工作将有类别标题,如薪水,部门,位置等。这个想法是让访问者通过为所有这三个类别选择适当的复选框来过滤掉帖子并显示帖子其中包含用户选择的类别参数。以下是我要查找的示例:http://underwearking.nl/heren/(请参阅左侧边栏)

我已经浏览了200多个插件并彻底搜索了wordpress但我找不到任何能够满足此要求的插件。另外,我对编码知之甚少,但我知道它涉及jQuery Ajax和复选框的集成......有人可以帮帮我???

2 个答案:

答案 0 :(得分:0)

尝试UNION ALL :::

select distinct wp_usermeta.user_id, wp_users.user_nicename
FROM wp_usermeta
LEFT JOIN wp_users
ON wp_usermeta.user_id=wp_users.ID
ORDER BY wp_usermeta.user_id
UNION ALL 
select distinct t1.user_id ,t2.meta_value shop from wp_usermeta as t1, wp_usermeta as t2 where t1.user_id = t2.user_id and (  (t1.meta_key = 'category' and t1.meta_value like '%$catid%')  ) and t2.meta_key='shop_name'  order by t2.meta_value ASC 

答案 1 :(得分:0)

您可以在同一个查询中对该表JOIN额外p_usermeta,然后LEFT JOIN wp_users,就像这样:{/ p >

SELECT distinct 
  t1.user_id, 
  wp_users.user_nicename,
  t2.meta_value shop 
FROM wp_usermeta AS t1
INNER JOIN wp_usermeta as t2 ON t1.user_id = t2.user_id
LEFT JOIN wp_users ON t1.user_id = wp_users.ID
where ((t1.meta_key = 'category' and t1.meta_value like '%$catid%')) 
  and t2.meta_key='shop_name'  
ORDER BY wp_usermeta.user_id, t2.meta_value
LIMIT 1,10"