• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Replication or duplication of category fields based on count

#1
[eluser]Imman Kant[/eluser]
I'm working on a customization project for homes. I am stuck at a part which I have explained below.
1) There are different types of houses, and in the houses there must be different types of rooms(I have posted a screenshot of form1).
2) The user enters his details, and when he does, he goes to the dropdown and chooses the type of house, and enters the relevant fields(as in if he has living rooms, he enters how many living rooms he has, and what all rooms he has).
3) This when he clicks next(I set a session for the next button, as in if he clicks next, the details are all taken in a session with a session id). The next page is where what rooms he has chosen appear, so that he can customise as per his needs, as shown in form 2.

What I have done so far is:
1. The first page details entered is stored in two tables which have structures as follows:
-->table1 (Interior_client_trans_ref_id, interior_client_id , interior_client_name , Interior_client_email , interior_client_mobile , interior_house_id , interior_client_status , interior_client_house_plan , Interior_client_trans_datetime , Interiror_client_carpet_area)

-->table2(interior_client_trans_ref_id , interior_category_id , interior_cat_group_id , interior_client_group_item_id , interior_client_trans_no_room_id , interior_house_no_rooms , interior_client_trans_no_item_id , interior_client_trans_status)

In the first table, the details are stored in one record per user. The session id is set, and the records stored come under one reference id, until I unset the session in the last, i.e. in the form 2, when I click on 'other rooms', the last customisation form comes, and then submit. On clicking submit, the session is unset. I have managed to store the selections as in each time on the left pane, has an ajax save selection. As in the checkboxes once selected, are held. So that if I click in the second form, and select a subcategory in the checkbox form, then I click next, it goes to the next roomtype to customise, and if I should click previous the values are held. I have managed to push the data all at once, after holding through ajax throughout the session, and once I click submit, the session is unset.

So, it's just static, and when I enter say for example, '2' in the no of living rooms in the first form. I want the living room to be repeated twice in the second form, as in, I am able to customise for one room at a time of each type that is mentioned. In other words, if a user has 3 bedrooms, and enters 3 in the bedroom fields, then only one field is there in the left pane of the second form. I want how many ever rooms of each type I enter to repopulate in the second form to customise. Like 3 bedrooms, meaning 3 times it should show up in the second form.

I can take in for 1 value of each of the room types entered. What I need help is, when I enter the number two in say living room, in the first form. In the next form, I need to get the two of the category living room. And the same for any room, the number I enter in the first form should be duplicated in the second form, and the subcategories under them, and the sub sub categories under them. This being said, the database tables I have for the first, and the second are completely unrelated. I have gotten the rooms in a loop in the view file of the first form in this way from the rooms(interior_room_id , interior_room_desc , interior_room_status , interior_room_image) table in the database.
Now the category table(Interior_category_id , Interior_category_desc, Interior_parent_category_id, Interior_category_level, Interior_category_status, Interior_category_image) I have has the first 9 rows matching the first 9 rows in the room table. I have utilized the category table in the second form. I have related the tables using a foreign key setting one primary in the category table(look at categoryroom function in the models in the file attached). Suggest me an approach or an example as to how to approach, as the tables are not related except for the first 9, and I need those 9 only. Look at the view code(visualize_start in the views mentioned in the file attached)

I have added a few of the relevant code(model, view, controller all in one) in the attachments, Please help me in regards. I'm pretty new to codeigniter.

The code bits which are relevant are in the following link:
https://gist.github.com/kanthco/5932745


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.