• Resolved mattpennetti

    (@mattpennetti)


    I have run into a problem with creating custom pages. Everything is working except for the creation and display of my JSON content. Here is the result I get:

    createoptions in shortcode: JSON ok!
    start creating pages
    create page with JSON-loopkey: products
    no of pages to create: 0
    pagetype: item
    must be defined in plugin-settings!
    Great! Pagetype defined in plugin-options!
    Page completely loaded? Show created pages!
    ID of the creating page is 5607
    delete previous generated pages!
    delete pages with that key: 5556667778
    delete 0 pages of this type: item
    all 0 pages successfully deleted
    title template from shortcode: this is the title {{product_Desc}}: {{group_Desc}}
    create page: slugname template from shortcode: this is the title {{product_Desc}}: {{group_Desc}}
    start looping:

    And here is my shortcode in the custom page –

    [jsoncontentimporterpro url=http://**.**.**.**:*****/Products/1/1 parser=twig method=”curlget” id=3 mode=create createoptions='{“type”:”item”, “loop”:”products”, “title”:”this is the title {{product_Desc}}: {{group_Desc}}”, “slugname”: “{{product_Desc|replace({#SQM#/#SQM#: #SQM#-#SQM#})}}-{{group_Desc | lower | replace({#SQM# #SQM#: #SQM#-#SQM#}) }}”, “deleteold”:”yes”}’]]

    [/jsoncontentimporterpro]

    I think the issue is coming from my JSON. This is a small sample of it.
    There is no main container for all of the products. When I run it through Twig, I have to use the _context method to get data to display.

    [{“id_No”:36,”product_Desc”:”BRUCE BANNER”,”group_Desc”:”FLOWERS”,”strain”:”Hybrid – S/I”,”quantity_On_Hand”:3.0,”unit_Measure”:”Unit”,”unit_Meas_Qty”:””,”unit_Meas_Qty_Cannabis”:1.0,”price_Unit”:20.0,”vend_Code”:”ATARAX”,”menu_Print”:true,”is_Active”:true,”menu_Image”:null,”menu_Text”:null,”menu_Website”:null,”menu_Upload”:true,”menu_Notes”:null},
    {“id_No”:40,”product_Desc”:”G6″,”group_Desc”:”FLOWERS”,”strain”:”Hybrid – S/I”,”quantity_On_Hand”:14.0,”unit_Measure”:”Unit”,”unit_Meas_Qty”:””,”unit_Meas_Qty_Cannabis”:1.0,”price_Unit”:20.0,”vend_Code”:”ATARAX”,”menu_Print”:true,”is_Active”:true,”menu_Image”:null,”menu_Text”:null,”menu_Website”:null,”menu_Upload”:true,”menu_Notes”:null}]

    My thought is the last piece missing is the ‘loop’ variable. I’ve tried everything and scoured different sites for an answer with no luck. My JSON file is flat with all items living at the top level.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Flat JSON missing loop variable’ is closed to new replies.