Add new table in Ofbiz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Add new table in Ofbiz

eric
I have requirements to add new table in Ofbiz. The new table is intended for holding a new image path for 3d images. (Product-Content). I consider creating new table instead creating new column inside table PRODUCT because I don’t want to disturb/impact any other interactions Ofbiz has with table PRODUCT.

So here what I did
1. entitymodel.xml - /ofbiz/applications/product/entitydef
    I add new entity for new table
    <entity entity-name="ProductThreeD"
            package-name="org.ofbiz.product.productthreed"
            title="Product Three D">
      <field name="productId" type="id-ne"></field>
      <field name="threeDImageUrl" type="url"></field>
      <prim-key field="productId"/>
      <relation type="one" fk-name="PROD_3D_PROD" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>       
    </entity>     
       
2. ProductUILabels.xml - /ofbiz/applications/product/config
    I add new labels
3. EditProductContent.ftl - /ofbiz/applications/product/webapp/catalog/product/
    I add new form for submitting new 3d path
4. EditProductContent.groovy - /ofbiz/applications/product/webapp/catalog/WEB-INF/actions/product/
    I add new logic for handling new 3d image upload
                                                if (fileType.equalsIgnoreCase("3d")) {
                                                                context.imageUrl = imageUrl;
                                                                productthreed.set("threeDImageUrl", imageUrl);
                                                                productthreed.store();
                                                }


The new table was successfully created. But I got an error saying “Error running script at location [component://product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy]: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: productthreed for class: Script7”

What did I miss? I try looking for entitygroup.xml inside /ofbiz/applications/product/entitydef but cannot find it. Sorry if this was too technical. But I need some help. The tutorial did not help much.

Thanks in advance.