I'm trying to show 2 browses :
PS. The tables are from a Prestashop Cardshop, and I have NO idea how the relations are set. I have access to them, and I see that they have a commen field
id_product in product file and also in the categorie file.
3 tables must be opened
ps_category_lang : here are the names from the categories, and a ID from the categorie
ps_category_product : here are all product belonging to a categorie AND the product ID's
ps_product_lang : here are the product details like name,...
I have 2 browses : (they work, only not for changing the product names)
1. Top browse = Categories
2. Bottom browse = products detail from that categorie
In browse 2. I want also that the products names to be included in the 2 browse
I'm almost sure that it has to do with relations, but I don't know how the relations are setup.
- Code: Select all Expand view RUN
// products
oRsProduct := oCn:RowSet( "select * from ps_product_lang " )
// Groeps
oRsGroepen:= oCn:RowSet( "SELECT * FROM `ps_category_lang` where `id_lang` = ? ", { "1" } )
// Order of product on pages
cZoekProduct := "77"
oRsvolgorde:= oCn:RowSet( "SELECT * FROM `ps_category_product` where `id_category` = ? ", { cZoekProduct } )
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////
aVelden4 := { ;
{ "id_category" , "Cat_ID" ,nil, 50 }, ; // 1
{ "name" , "Naam" ,nil, 200 }, ; // 2
{ "position" , "Pos" ,nil, 50 }} // 9
@ 1,1 XBROWSE oBrw[4] size 1100,100 PIXEL OF oFld:aDialogs[ 2 ] font oFont ;
DATASOURCE oRsgroepen;
COLUMNS aVelden4;
AUTOSORT CELL LINES NOBORDER FOOTERS
//FASTEDIT
oBrw[4]:nEditTypes = EDIT_GET
oBrw[4]:SetChecks()
oBrw[4]:lF2KeyToEdit := .t. // Edit when F2 is pressed
oBrw[4]:nHeadStrAligns := AL_CENTER
WITH OBJECT oBrw[4]
:lColChangeNotify := .t.
:oHeaderFonts := oBold
:bClrEdits := { || { CLR_BLACK, CLR_YELLOW }}
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
:lFooter := .t.
:bRecSelHeader := { || "RowNo" }
:bRecSelData := { |o| o:KeyNo }
:bRecSelFooter := { |o| o:nLen }
:oRecSelFont := oFont // optional
:nRecSelWidth := "99999" // required size
:bOnChange := { || oRSNewGroep(oBrw[4]:cat_id:Value), oBrw[3]:refresh() }
END
oBrw[4]:CreateFromCode()
///////////////////////////////////////////////////////////////// BRW FOLDER 3 /////////////////////////////////////////////////
aVelden3 := { ;
{ "id_category" , "Cat_ID" ,nil, 50 }, ; // 1
{ "id_product" , "Product_ID" ,nil, 70 }, ; // 2
{ "position" , "Pos" ,nil, 50 }} // 9
@ 110,1 XBROWSE oBrw[3] size 1100,200 PIXEL OF oFld:aDialogs[ 2 ] font oFont ;
DATASOURCE oRsvolgorde;
COLUMNS aVelden3;
FIELDS oRsProduct:description_short ;
AUTOSORT CELL LINES NOBORDER FOOTERS
oBrw[3]:nEditTypes = EDIT_GET
oBrw[3]:SetChecks()
oBrw[3]:lF2KeyToEdit := .t. // Edit when F2 is pressed
oBrw[3]:nHeadStrAligns := AL_CENTER
WITH OBJECT oBrw[3]
:lColChangeNotify := .t.
:oHeaderFonts := oBold
:bClrEdits := { || { CLR_BLACK, CLR_YELLOW }}
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
:lFooter := .t.
:bRecSelHeader := { || "RowNo" }
:bRecSelData := { |o| o:KeyNo }
:bRecSelFooter := { |o| o:nLen }
:oRecSelFont := oFont // optional
:nRecSelWidth := "99999" // required size
END
oBrw[3]:CreateFromCode()
//======================================================
function oRsNewGroep(cData)
cZoek = alltrim(str(cData))
oRsvolgorde:Requery( { cZoek } )
//cZoekID = oRsAtt:id_attribute
//oRs:Requery( { cZoekID } )
return NIL
In HeidiSql I see folowing structure, with indexes. How do we change the index in FW for a online database ?
ps_product_lang
Thanks