News:

Support the VirtueMart project and become a member

Main Menu

PHP access to DB: relation between categories and products

Started by alessandro88, March 16, 2013, 11:00:33 AM

Previous topic - Next topic

alessandro88

Hi, I have installed Joomla! 2.5.9 and VM2 on Apache/2.2.22 (Ubuntu).

What should I do is a PHP inventory that shows the products grouped by category .

The problem is that I can not find the table with the association between the products names ( joomla_virtuemart_products_it_it ) and their respective categories ( joomla_virtuemart_categories_it_it ). Can you help me?

Is there a guide / manual about that? I still haven't found it.
I found only one on VM1.1 but is not compatible :
QuoteThe database class file is / administrator / components / com_virtuemart / classes / ps_database.php
but no longer exists.

It is okay to have direct access to MySQL DB ( like I am doing ), or are there specific functions of VM?

thanks

Ok, I've found the table : joomla_virtuemart_product_categories


mysql> SELECT P.product_name, C.category_name
    -> FROM joomla_virtuemart_products_it_it AS P
    -> JOIN joomla_virtuemart_product_categories AS PC
    -> ON PC.virtuemart_product_id = P.virtuemart_product_id
    -> LEFT JOIN joomla_virtuemart_categories_it_it AS C
    -> ON PC.virtuemart_category_id = C.virtuemart_category_id;
+------------------+---------------+
| product_name     | category_name |
+------------------+---------------+
| Hand Shovel      | Hand Tools    |
| Ladder (Pattern) | Garden Tools  |
| Shovel           | Garden Tools  |
| Smaller Shovel   | Garden Tools  |
| Nice Saw         | Hand Tools    |
| Hammer           | Hand Tools    |
| Chain Saw        | Outdoor Tools |
| Circular Saw     | Power Tools   |
| Drill            | Indoor Tools  |
| Metal Ladder     | Garden Tools  |
| Wooden Ladder    | Garden Tools  |
| Plastic Ladder   | Garden Tools  |
+------------------+---------------+