php - Drupal build custom query between taxonomy and content -


i received project coded else on drupal 7 apparently not follow of drupal's standards , coded website overwriting template system (and late modify or edit of current structure).

i have following issue need build custom query:

the data in cms created such:

category (created in taxonomy) -> subcategory (created content type) -> item (created content type)

when adding entries in cms, workflow such:

  1. first create main category taxonomy (named category)
  2. the create subcategory contents
  3. when adding/editing subcategory, select parent category radio list
  4. and items selected checkbox list

i have taken screenshots cms make things clearer regarding structure, can found here:

http://dropcanvas.com/qdokx/

the problem not being able build view @ all, need create custom query can following:

  1. read categories
  2. read subcategories belonging each category
  3. read items under each category
  4. with php, generate custom html using loops on above data

the purpose of on website, user able click category, , list of subcategories. when subcategory clicked, items in can seen.

in typical php/mysql, query process (assuming no joins):

<?php $categories = query('select * categories');       while ($category = fetcharray($catetgories)) {           $subcategories = query('select * subcategories category = $category['id']);           while ($subcategory = fetcharray($subcategories)) {                $items = query('select * items subcategory = $subcategory['id']);           }        } ?> 

i need able replicate above doing query items of taxonomy "category", find subcategories (content type) belong it, , find items belong subcategory

you can use drupal api function taxonomy_get_tree taxonomy tree , under each subcategory iteration use entityfieldquery load item (node) list.

but recommend create custom ajax field 3 select form elements , load values dependently.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -