I am trying to add product options to my product node. Product options is an array object having name, id and description, so at first when product is created i want it to be populated by json and then i want it to be editable in neos backend and also i want to give the editor option to add new product options, till now I am able to get the product option data and see it in neos backend but it is not editable. Can anyone help me to figure out what I am doing wrong why it is not editable also how to provide editor option to add their own new product option to the editor.
product.yaml
'ProductConfigurator:Document.Product':
superTypes:
'Neos.BaseLegacy:Document.Page': true
options:
fusion:
prototypeGenerator: ~
ui:
group: 'modules-media'
label: i18n
icon: 'icon-dot-circle-o'
position: 200
inlineEditable: true
inspector:
groups:
general:
label: i18n
childNodes:
productOptions:
type: 'Neos.Neos:ContentCollection'
ui:
inspector:
createNew: true
constraints:
nodeTypes:
- 'ProductConfigurator:Content.ProductOption'
properties:
id:
type: string
ui:
reloadPageIfChanged: true
label: i18n
inspector:
group: general
ProductOption.yaml
'ProductConfigurator:Content.ProductOption':
superTypes:
'Neos.Neos:Document': true
ui:
label: 'Product Option'
icon: 'icon-dot-circle-o'
inlineEditable: true
properties:
productName:
type: string
ui:
label: 'Product Name'
inlineEditable: true
inline:
editorOptions:
placeholder: 'Enter title here...'
autoparagraph: false
productId:
type: string
ui:
label: 'Product ID'
inlineEditable: true
productDescription:
type: string
ui:
label: 'Product Description'
inlineEditable: true
Content/ProductBody.fusion
prototype(ProductConfigurator:Content.ProductBody) < prototype(Neos.Neos:ContentComponent) {
apiNode = ${ProductConfigurator.getApiData(node)}
apiData = ${Json.parse(q(this.apiNode).property('apidata'), true)}
productOptions = ${Json.parse(q(this.apiNode).property('productOption'), true)}
@context {
apiNode = ${this.apiNode}
apidata = ${this.apiData}
productOption = ${this.productOptions}
}
renderer = ProductConfigurator:Component.ProductBody {
productOptionsList = Neos.Fusion:Collection {
collection = ${productOption}
itemRenderer = ProductConfigurator:Component.ProductOptionBody {
productName = ${item.attributeName}
productId = ${item.articleId}
productDescription = ${item.shortDesc}
}
}
mainText = Neos.Neos:PrimaryContent {
nodePath = 'main'
}
name = ${apidata.productName}
}
}
Component/ProductOptionBody
`prototype(ProductConfigurator:Component.ProductOptionBody) < prototype(Neos.Fusion:Component) {
productName = Neos.Neos:Editable {
property = ‘productName’
node = ${props.node}
}
productId = Neos.Neos:Editable {
property = ‘productId’
node = ${props.node}
}
productDescription = Neos.Neos:Editable {
property = 'productDescription'
node = ${props.node}
}
renderer = afx`
<div class="product-option">
<p><strong>Name:</strong>{props.productName}</p>
<p><strong>ID:</strong> {props.productId}</p>
<p><strong>Description:</strong>{props.productDescription}</p>
</div>
`
}
I get like this for eg in my neos backend
"Name:testA
ID: 124888
Description:Just for testing
Name:testB
ID: 278115
Description:Just for testing"
I get these in neos backend but these are not editable, also i dont know how to provide option to user to add their own data, can some one help me with this, I am stuck in this for a long time