0

The project is using the Bluefoot plugin to add the block in cms_index_home. I created a static block in Magento Admin with the follow content:

{{block class="ProductsRegulars\Block\Recommendation\Lists" name="product-recommendation" template="recommendation/list.phtml}}

But in my cms_index_home.xml I have some arguments essentials to block.

<arguments>
 <argument name="jsLayout" xsi:type="array">
 <item name="components" xsi:type="array">
 <item name="recommendation-list" xsi:type="array">
 <item name="component" xsi:type="string">ProductsRegulars/js/view/recommendation/list</item>
 <item name="config" xsi:type="array">
 <item name="template" xsi:type="string">ProductsRegulars/recommendation/list</item>
 </item>
 <item name="children" xsi:type="array">
 <item name="messages" xsi:type="array">
 <item name="sortOrder" xsi:type="string">0</item>
 <item name="component" xsi:type="string">Magento_Ui/js/view/messages</item>
 <item name="displayArea" xsi:type="string">messages</item>
 </item>
 </item>
 </item>
 </item>
 </argument>
</arguments>

When I run the page, occur the following error:

Uncaught SyntaxError: Unexpected token u in JSON at position 0

I believe that this error occurs because of the Magento not found the arguments.

2 Answers 2

0

Try to add your referenceBlock and write it's name . I hope it's work for you

<referenceBlock name="xxx.xxx.xxx">
 <arguments>
 <argument name="jsLayout" xsi:type="array">
 <item name="components" xsi:type="array">
 <item name="recommendation-list" xsi:type="array">
 <item name="component" xsi:type="string">ProductsRegulars/js/view/recommendation/list</item>
 <item name="config" xsi:type="array">
 <item name="template" xsi:type="string">ProductsRegulars/recommendation/list</item>
 </item>
 <item name="children" xsi:type="array">
 <item name="messages" xsi:type="array">
 <item name="sortOrder" xsi:type="string">0</item>
 <item name="component" xsi:type="string">Magento_Ui/js/view/messages</item>
 <item name="displayArea" xsi:type="string">messages</item>
 </item>
 </item>
 </item>
 </item>
 </argument>
 </arguments> 
</referenceBlock>
answered Jun 20, 2019 at 5:21
1
  • I'll try that! Thanks. Commented Jun 20, 2019 at 20:01
0

I added the referenceBlock in my cms_index_home.xml. I did the test with identifier value and block name but it still did not work.

Static Block enter image description here

cms_index_home.xml

<referenceBlock name="product-recommendation">
 <arguments>
 <argument name="jsLayout" xsi:type="array">
 <item name="components" xsi:type="array">
 <item name="recommendation-list" xsi:type="array">
 <item name="component" xsi:type="string">ProductsRegulars/js/view/recommendation/list</item>
 <item name="config" xsi:type="array">
 <item name="template" xsi:type="string">ProductsRegulars/recommendation/list</item>
 </item>
 <item name="children" xsi:type="array">
 <item name="messages" xsi:type="array">
 <item name="sortOrder" xsi:type="string">0</item>
 <item name="component" xsi:type="string">Magento_Ui/js/view/messages</item>
 <item name="displayArea" xsi:type="string">messages</item>
 </item>
 </item>
 </item>
 </item>
 </argument>
 </arguments>
 </referenceBlock>
answered Jun 20, 2019 at 20:17

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.