List of phone repairs

2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 3, 2019   (RSS)

By kovali - May 29, 2019

Hi, 

I'm building a website for a client to advertise the prices for repair of different brands and their models of smartphones.

This is what I got inside CMSB for now:

tableName = MODELS  (with 2 fields: Brand + Model  -  So my client can add new models if necessary) 

tableName = REPAIRS  (with 3 fields: Model (populated from table MODELS/field Model)  +  Description  +  Price )

On the website I would like to show the results like this:

One phone brand per page, on that page a list of all the phone models for that brand, and when clicked on a model all the possible repairs for that model should be shown in a table, like this:

iPhone 6

screen repair      $ 85
battery repair      $ 75
cover  repair       $  90

I hope it makes sense the way I described it... ;-)   Thanks for any help or suggestions !!

Best regards,

Koen

By daniel - June 3, 2019

Hi Koen,

The general way I would accomplish this would be to:

  1. Set up a List Page and Details Page for the Models table using the CMSB Code Generator
  2. Modify the Models Detail Page to also list associated repairs.

#2 can be done in a number of ways. I would recommend starting with a modified getRecords() call that could look something like this:

list($repairsRecords, $repairsMetaData) = getRecords(array(
  'tableName'   => 'repairs',
  ... (your options here)
  'where' => "num = '" . mysql_escape($modelsRecord['repair'])."'",
));

The above would need to be modified to fit your table/variable/field names but hopefully gives you a starting point.

Let me know if the above makes sense, or if I can help clarify anything.

Thanks,

Daniel
Technical Lead
interactivetools.com