We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40092
    • 265 Posts
    What would be the easiest approach for this?

    I have 3 tables:

    -Services wich hold the name and basic info on the service
    -Subservices Basic info onSubServices that CAN be attached to a Service based on the id
    -Subservice_options the details on the subservices that is attached to subservice based on id.

    I need a form in where i can set those 3 three tables up with data.
      • 4172
      • 5,888 Posts
      again, what's your schema for this tables?

      can a service have multiple subservices. what kind of information would you like to add into the subservices table, when editing a service.
      Or do you just want select subservices via a multiple-listbox or checkboxes?
      The same questions for subservice-options in a subservice.

      Its not very clear for me.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 40092
        • 265 Posts
        Ah, you're right, sorry.

        I Forgot one table also, here's the schema:

        <?xml version="1.0" encoding="UTF-8"?>
        <model package="vera" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
        	<object class="Class" table="class" extends="xPDOSimpleObject">
        		<field key="code" dbtype="varchar" precision="8" phptype="string" null="false" />
        		<field key="name" dbtype="varchar" precision="80" phptype="string" null="false" />
        		<field key="sort" dbtype="int" precision="2" phptype="integer" null="false" />
        	</object>
        	<object class="Orders" table="orders" extends="xPDOSimpleObject">
        		<field key="order_id" dbtype="varchar" precision="20" phptype="string" null="false" />
        		<field key="date_from" dbtype="varchar" precision="6" phptype="string" null="false" />
        		<field key="date_to" dbtype="varchar" precision="6" phptype="string" null="false" />
        		<field key="cnt_person" dbtype="int" precision="2" attributes="unsigned" phptype="integer" null="false" />
        		<field key="cnt_children" dbtype="int" precision="2" attributes="unsigned" phptype="integer" null="false" />
        		<field key="o_vera_response" dbtype="text" phptype="string" null="false" />
        		<field key="o_vera_xml" dbtype="text" phptype="string" null="false" />
        		<field key="o_services" dbtype="text" phptype="string" null="false" />
        
        		<index alias="id" name="id" primary="false" unique="true" type="BTREE" >
        			<column key="id" length="" collation="A" null="false" />
        		</index>
        	</object>
        	<object class="Packages" table="packages" extends="xPDOSimpleObject">
        		<field key="code" dbtype="varchar" precision="80" phptype="string" null="false" />
        		<field key="value" dbtype="varchar" precision="255" phptype="string" null="false" />
        	</object>
        	<object class="ServiceTypes" table="service_types" extends="xPDOSimpleObject">
        		<field key="code" dbtype="varchar" precision="100" phptype="string" null="false" />
        		<field key="name" dbtype="varchar" precision="200" phptype="string" null="false" />
        		<field key="sort" dbtype="int" precision="11" phptype="integer" null="false" default="0" />
        		<field key="multiperson_package" dbtype="tinyint" precision="1" phptype="integer" null="false" />
        	</object>
        	<object class="Services" table="services" extends="xPDOSimpleObject">
        		<field key="service_type_id" dbtype="int" precision="11" phptype="integer" null="false" />
        		<field key="code" dbtype="varchar" precision="100" phptype="string" null="false" />
        		<field key="name" dbtype="varchar" precision="200" phptype="string" null="false" />
        		<field key="description" dbtype="text" phptype="string" null="false" />
        		<field key="sort" dbtype="int" precision="11" phptype="integer" null="false" default="0" />
        		<field key="is_optional" dbtype="tinyint" precision="1" phptype="integer" null="false" default="1" />
        		<field key="is_default" dbtype="tinyint" precision="1" phptype="integer" null="false" default="0" />
        		 <composite alias="Subservices" class="Subservices" local="id" foreign="service_id" cardinality="many" owner="local" /> 
        	</object>
        	<object class="Subservices" table="subservices" extends="xPDOSimpleObject">
        		<field key="service_id" dbtype="int" precision="11" phptype="integer" null="false" />
        		<field key="code" dbtype="varchar" precision="10" phptype="string" null="false" />
        		<field key="name" dbtype="varchar" precision="200" phptype="string" null="false" />
        		<field key="sort" dbtype="int" precision="11" phptype="integer" null="false" default="0" />
        	 <composite alias="SubservicesOptions" class="SubservicesOptions" local="id" foreign="subservice_id" cardinality="many" owner="local" /> 
        		<aggregate alias="Services" class="Services" local="service_id" foreign="id" cardinality="one" owner="foreign" /> 
        
        	</object>
        	<object class="SubservicesOptions" table="subservices_options" extends="xPDOSimpleObject">
        		<field key="subservice_id" dbtype="int" precision="11" phptype="integer" null="false" />
        		<field key="code" dbtype="varchar" precision="100" phptype="string" null="false" />
        		<field key="name" dbtype="varchar" precision="100" phptype="string" null="false" />
        		<field key="cnt_person" dbtype="int" precision="2" attributes="unsigned" phptype="integer" null="false" default="1" />
        	<aggregate alias="Subs" class="Subservices" local="subservice_id" foreign="id" cardinality="one" owner="foreign" /> 
        
        	</object>
        </model>


        Where the forst table would be the ServiceType, there we define and label what type of service it is.Then we have Services wich is connected by ServiceType id, there we define what the service is(name, description, active, etc.). Then we have Subservice, where we define and label a subservice connected by Service id. Last we have SubserviceOptions there we define what the subservice is(name, description, etc.) connected on subservice id.

        A service can have multiple subservices, and data to put in is mostly text or an integer as you can see in the schema.

        The is_optiional key, for instance should be a checkbox, how to control what the value is and based on 0 or 1 be checked or unchecked?
          • 40092
          • 265 Posts
          Any advice on this? An example maybe, would be highly appreciated. smiley
            • 40092
            • 265 Posts
            Sorry for the bump, but still have not figured this one out.