Need help on "Choosing parent_id for an item..."

Hi All,
I have a case (I dont know about PHP) that is unsolvable by myself and would like to ask you all for help.
Case: I have two table that named:
+ Products (ID, product_name...)to keep listing of agricultural products;
+ Product_profile (ID, Product_ID, Parent_ID, Attribute, Description) for storing varying data relating to a product.
Requirements:
+ When adding a profile for a product,
(1) Choose product with a databasejoin dropdown
(2) Choose a parent item from product_profile: for example item 1 - General instruction, I add a new item 1.1 for back ground data (like heading level in Word heading 1, 2, 3...) that takes General instruction as the parent item.
So I would like the dropdown for parent item will only list existing Attributes for the product_id selected from step 1.
In the Data where, joins where and/or order by statement (SQL) field I added
WHERE {thistable}.type = 15 AND {thistable}.product_id = {products_profile___product_id}
And applied for both (add new and edit)
This failed.

In the case of Edit, I would also expect that the Parent_id dropdown will not list attribute of the current editing record itself with
WHERE {thistable}.type = 15 AND {thistable}.product_id = {products_profile___product_id} AND {thistable}.id <> {products_profile___id}
and it works in editing only.
Could you all be so kind helping me in dealing with this.
Thank you very much for your attention!
Yours very faithfully
Dang Dinh ngoc - From Vietnam
 
I have done this with a simple modification:
1. User a CDD dropdown
2. Add Where query with
{thistable}.type=15 AND {thistable}.id <> {products_profile___id_raw||0}
Thank you all for attention.
Solution came from a topic in this forum. Great thanks to all!
 
You beat me to it, I was going to suggest a CDD.

You could do it with a join, using a WHERE filter and updating on AJAX, but that's what a CDD is built to do.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top