The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
I'm integrating/converting an existing review system I have from Perl to PHP in order to integrate it with vBa CMPS. At the moment I'm trying build a query that will return a list of categories and for each category there should be an array of vendors for that category. This is basicall the same as what vb does when displaying sub forums under categories. I've found the templates used but not where the query is done.
My tables are currently set up like Code:
mysql> describe category; +--------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+----------------+ | id | int(11) | | PRI | NULL | auto_increment | | name | varchar(50) | YES | | NULL | | | active | char(1) | YES | | N | | +--------+-------------+------+-----+---------+----------------+ 3 rows in set (0.00 sec) mysql> describe vendor; +----------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+----------------+ | id | int(11) | | PRI | NULL | auto_increment | | name | varchar(50) | YES | | NULL | | | url | varchar(75) | YES | | NULL | | | address | varchar(100) | YES | | NULL | | | phone | varchar(15) | YES | | NULL | | | category | int(11) | YES | | NULL | | | active | char(1) | YES | | N | | +----------+--------------+------+-----+---------+----------------+ 7 rows in set (0.00 sec) SELECT category.id, category.name, COUNT(vendor.id) AS countThe existing query returns, as expected Array ( [id] => 8 [name] => Accessories [count] => 4 )What I'd like to see is each row that is returned contain something like Array ( [id] => 8 [name] => Accessories [count] => 4, [vinfo] => Array ( sorted list of vendor id's and names ) )so I don't need to then execute a bunch of additional queries to get the vendor names by category. It seems like this should be possible as it looks like vb does something similar when sub-forums are listed under categories. However I haven't had any luck in locating that code. Any solutions or a pointer to where to find the solution? |
#2
|
||||
|
||||
![]()
well, there is no real difference between categories and subforums
each forum can be a category, so to define subforums vb uses a parentid value. |
#3
|
||||
|
||||
![]()
if your inquiring about hierarchail data storage with vBulletin then you won't really find it since vBulletin caches all parents and children when ever the forum order is updated, a forum deleted, or a new forum is added
![]() |
#4
|
||||
|
||||
![]() Quote:
First, have it make an array with all the vendor information. Let's say you had the array in the $vendor variable. You'd need to do something like this (assuming $categoryid is the category's id) PHP Code:
PHP Code:
|
#5
|
|||
|
|||
![]() Quote:
|
#6
|
||||
|
||||
![]() Quote:
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|