Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

referenceBlock with group-attribute not allowed #2

Closed
m-schreiber opened this issue Jul 15, 2019 · 14 comments
Closed

referenceBlock with group-attribute not allowed #2

m-schreiber opened this issue Jul 15, 2019 · 14 comments
Assignees

Comments

@m-schreiber
Copy link

On loading a Product-View the following exception occurs:

1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'referenceBlock', attribute 'group': The attribute 'group' is not allowed.
Line: 2883

Element 'referenceBlock', attribute 'group': The attribute 'group' is not allowed.
Line: 2890

Element 'referenceBlock', attribute 'group': The attribute 'group' is not allowed.
Line: 2915

Element 'referenceBlock', attribute 'group': The attribute 'group' is not allowed.
Line: 2924


Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'referenceBlock', attribute 'group': The attribute 'group' is not allowed.
Line: 2883

Element 'referenceBlock', attribute 'group': The attribute 'group' is not allowed.
Line: 2890

Element 'referenceBlock', attribute 'group': The attribute 'group' is not allowed.
Line: 2915

Element 'referenceBlock', attribute 'group': The attribute 'group' is not allowed.
Line: 2924

#0 /var/www/vendor/magento/framework/Config/Dom.php(117): Magento\Framework\Config\Dom->_initDom('<layout xmlns:x...')

The reason is the use of the group-Attribute on referenceBlock-Tags inside Layout-XML:

<referenceBlock name="product.info.description" group="column_left">

<referenceBlock name="product.attributes" group="column_right">

<referenceBlock name="catalog.product.related" group="detailed_info">

<referenceBlock name="product.info.upsell" group="detailed_info">

@m-schreiber
Copy link
Author

found one more:

1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'referenceBlock', attribute 'after': The attribute 'after' is not allowed.
Line: 2463


Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'referenceBlock', attribute 'after': The attribute 'after' is not allowed.
Line: 2463

<referenceBlock name="customer-account-navigation-account-edit-link" after="customer-account-navigation-address-link">

@m-schreiber
Copy link
Author

by the way - the first two can be fixed by replacing them with this:
src/Magento_Catalog/layout/catalog_product_view.xml

<referenceBlock name="product.info.details.main">
            <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description" as="description" template="Magento_Catalog::product/view/attribute.phtml" group="column_left">
                <arguments>
                    <argument name="title" translate="true" xsi:type="string">Description</argument>
                    <argument name="contain_content" xsi:type="boolean">false</argument>
                    <argument name="sort_order" xsi:type="string">10</argument>
                    <argument name="at_call" xsi:type="string">getDescription</argument>
                    <argument name="at_code" xsi:type="string">description</argument>
                    <argument name="css_class" xsi:type="string">description</argument>
                    <argument name="at_label" xsi:type="string">none</argument>
                </arguments>
            </block>
            <block class="Magento\Catalog\Block\Product\View\Attributes" name="product.attributes" as="additional" template="Magento_Catalog::product/view/attributes.phtml" group="column_right">
                <arguments>
                    <argument name="contain_content" xsi:type="boolean">false</argument>
                    <argument name="sort_order" xsi:type="string">20</argument>
                    <argument translate="true" name="title" xsi:type="string">More Information</argument>
                </arguments>
            </block>
        </referenceBlock>

@seyuf
Copy link

seyuf commented Aug 16, 2019

Any update on this issue?
Can’t we just remove the group attributes for the moment?
It seems to be working fine without...

@krzksz
Copy link

krzksz commented Aug 31, 2019

Thanks for your report, we are working on this issue and will provide a fix for it.

@berbua
Copy link
Contributor

berbua commented Sep 18, 2019

Exceptions reported on Jul 17th fixed with bbec940

@berbua
Copy link
Contributor

berbua commented Sep 30, 2019

Hello @m-schreiber, please be informed that the issue related to group attribute has been reported to Magento:
magento/magento2#24656

@viliusramulionis
Copy link

Hello,

Im getting the same error.
Running magento 2.3.3 and Magesuite 3.0
Product page doesn't work unless i modify theme-creativeshop's layout file to remove groups from referenceBlock tags.

Some help would be appreciated.

@krzksz
Copy link

krzksz commented Nov 13, 2019

Hello @viliusramulionis, as we outlined in the magento/magento2#24656 it is an issue with the XML validator itself. Until it is fixed, the temporary solution is to switch from developer to default mode when developing the shop as in both default and production modes everything is fine.

@krzksz krzksz closed this as completed Nov 13, 2019
@Flowlance
Copy link

Same issue here in developer mode.

@tim-breitenstein-it
Copy link

Still exists on Magento 2.4.2

@tim-breitenstein-it
Copy link

Still exists on Magento 2.4.2-p1

@fritzmg
Copy link
Contributor

fritzmg commented Jun 16, 2021

@tim-breitenstein-it according to the aforementioned ticket, it will be fixed in Magento 2.4.3.

@fritzmg
Copy link
Contributor

fritzmg commented Aug 23, 2021

Magento 2.4.3 was released recently, however this issue still exists there unfortunately.

@fritzmg
Copy link
Contributor

fritzmg commented Aug 23, 2021

Until this is actually fixed in Magento itself, you can do the following:

  1. Run composer require cweagans/composer-patches.
  2. Create a patches/allow-group-attribute-for-referenceblock.patch file with this [1] content.
  3. Add this [2] to your composer.json.
  4. Run composer install to apply the actual patch.

[1]

--- a/vendor/magento/framework/View/Layout/etc/elements.xsd
+++ b/vendor/magento/framework/View/Layout/etc/elements.xsd
@@ -328,6 +328,7 @@
         <xs:attribute type="elementNameType" name="name" use="required"/>
         <xs:attribute type="xs:string" name="template" use="optional"/>
         <xs:attribute type="xs:string" name="class" use="optional"/>
+        <xs:attribute type="xs:string" name="group" use="optional"/>
         <xs:attribute type="xs:boolean" name="display" default="true" use="optional"/>
         <xs:attribute type="xs:boolean" name="remove" use="optional"/>
     </xs:complexType>

[2]

    "extra": {
        "patches": {
            "magento/framework": {
                "Allow group attribute for referenceBlock": "patches/allow-group-attribute-for-referenceblock.patch"
            }
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants