reverbdotcom / reverb-magento-2

Magento 2.x plugin for syncing with Reverb
Apache License 2.0
2 stars 4 forks source link

1.0.3 Cannot create invoice #2

Open dvershinin opened 6 years ago

dvershinin commented 6 years ago

After installing the plugin at live site, going to Sales -> Orders -> finding an invoice -> View -> click on Invoice at the top produces the error:

Trace: #0 /srv/www/lvguitars.com/vendor/magento/framework/DataObject/Copy/Config/Converter.php(41): Magento\Framework\App\ErrorHandler->handler(8, 'Trying to get p...', '/srv/www/lvguit...', 41, Array)
#1 /srv/www/lvguitars.com/vendor/magento/framework/DataObject/Copy/Config/Converter.php(23): Magento\Framework\DataObject\Copy\Config\Converter->_convertScope(Object(DOMElement))
#2 /srv/www/lvguitars.com/vendor/magento/framework/Config/Reader/Filesystem.php(171): Magento\Framework\DataObject\Copy\Config\Converter->convert(Object(DOMDocument))
#3 /srv/www/lvguitars.com/vendor/magento/framework/Config/Reader/Filesystem.php(130): Magento\Framework\Config\Reader\Filesystem->_readFiles(Object(Magento\Framework\Config\FileIterator))
#4 /srv/www/lvguitars.com/generated/code/Magento/Framework/DataObject/Copy/Config/Reader/Proxy.php(95): Magento\Framework\Config\Reader\Filesystem->read('global')
#5 /srv/www/lvguitars.com/vendor/magento/framework/Config/Data.php(104): Magento\Framework\DataObject\Copy\Config\Reader\Proxy->read()
#6 /srv/www/lvguitars.com/vendor/magento/framework/Config/Data.php(92): Magento\Framework\Config\Data->initData()
#7 /srv/www/lvguitars.com/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\Framework\Config\Data->__construct(Object(Magento\Framework\DataObject\Copy\Config\Reader\Proxy), Object(Magento\Framework\App\Cache\Type\Config), 'fieldset_config', NULL)
kevinecd commented 6 years ago

Give this a try and let me know if it works.

Change needs to be made in this core file:

/vendor/magento/framework/DataObject/Copy/Config/Converter.php on line 41

Find line 41 in above file, should look like following code:

 $fieldsetName = $fieldset->attributes->getNamedItem('id')->nodeValue;
 $result[$fieldsetName] = $this->_convertFieldset($fieldset);

Replace those lines with the following:

if($fieldset->attributes->getNamedItem('id')){
     $fieldsetName = $fieldset->attributes->getNamedItem('id')->nodeValue;
     $result[$fieldsetName] = $this->_convertFieldset($fieldset);
}

Let me know if this works for you, once confirmed we can close this ticket and I'll add this to the instructions in the readme.

Thanks!

dvershinin commented 6 years ago

It works for us now. Have you filed the bug with M2? If so, can you give us a link to the bug entry so we watch it for updates as it's best to avoid core file hacks.

kevinecd commented 6 years ago

I am yet to file the bug, will do so ASAP and link it here. Going to leave this open until we get a resolution from M2 staff.

nickrfisher87 commented 3 years ago

This is a bug with the Reverb extension, not Magento. The cause of it is in the /Reverb/ReverbSync/etc/fieldset.xml file. This file is using Magento 1 code not Magento 2. It looks like this:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:DataObject/etc/fieldset.xsd">
    <scope id="global">
        <fieldsets>
            <sales_convert_quote_item>
                <reverb_item_link>
                    <to_order_item>*</to_order_item>
                </reverb_item_link>
            </sales_convert_quote_item>
        </fieldsets>
    </scope>
</config>

After updating to Magento 2 code it should look like this:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:DataObject/etc/fieldset.xsd">
    <scope id="global">
        <fieldset id="quote_convert_item">
            <field name="reverb_item_link">
                <aspect name="to_order_item" />
            </field>
        </fieldset>
    </scope>
</config>