DivanteLtd / pimcore-magento2-bridge

Pimcore module for Magento 2 integration
36 stars 24 forks source link

Products or Categories not getting synced with Magento #45

Open faranki5 opened 4 years ago

faranki5 commented 4 years ago

We installed the bridge successfully, configured the pimcore integration class and Magento configuration but can't sync the categories and product. In the log we get the multiple log messages:

This log is created when we save and publish the category in pimcore.

The below logs are created when we run commands in Magento to sync the category

any tips how to debug?

faranki5 commented 4 years ago

@mbolka would you please help out.

mbolka commented 4 years ago

@faranki5 sorry for the delay. Could you send me full logs from magento? Both (bridge connection logs and critical logs) Magneto should show full requests and you should be able to run them manually to see, where the problem is.

faranki5 commented 4 years ago

bridge.log bridge_critical.log

faranki5 commented 4 years ago

@mbolka here are the logs attached. You can see the error in it. I explored the code of the mentioned class in the log, there seems to be no data coming from Pimcore which is basically causing the error.

faranki5 commented 4 years ago

Moreover, the Pimcore "product-status-update.log" says this "Missing configuration for object: 12498, instanceUrl:http://** hidden URL *** , store view: 1" Even though the configuration on Magento admin is correctly filled.

faranki5 commented 4 years ago

@mbolka An important note, when i run any syncing commands like "php bin/magento divante:queue-category:process" on Magento it appears with this error: "Registry key "isSecureArea" already exists". This however, i fixed in the code by adding this line of code: "$this->registry->unregister('isSecureArea') "

mbolka commented 4 years ago

@faranki5 Please verify that instanceUrl parameter's value that is in your bridge.log file on the line 8 is equal to the instance Url field in your Integration Configuration.

faranki5 commented 4 years ago

@mbolka well, i tried by adding the exact value of instanceUrl ( url with its parameters) but it didn't work. However, when i tried by removing "Https" in the value of Magento configuration (made exactly the same to Pimcore value), it did work, but i have got additional errors. By running category command on Magento it throws this error in log: "The value of attribute "Image" must be set". I don't understand this. i did upload images to my image attribute also saved and published. Please have a look on attached logs and image. Thanks!

faranki5 commented 4 years ago

Screenshot from 2020-05-28 14-33-12

faranki5 commented 4 years ago

bridge.log bridge_critical.log

synchmann commented 4 years ago

Can you check what response do you get executing this endpoint in postman ? {your-host}/webservice/rest/category?apikey={pimcore-api-key}&storeViewId={storeId}&instanceUrl={magento-instance-url}&id={category-id} Have your attribute image a correct id ?

faranki5 commented 4 years ago

@synchmann @mbolka when i execute the endpoint i get this response: { "success": false, "msg": "Requested object with id 12508 does not exist." }

faranki5 commented 4 years ago

i am running this endpoint on Postman: "http://phpstack-328383-1173945.cloudwaysapps.com/webservice/rest/category?apikey=cba1ca2b47b2576fa79f318463b1941b005bb2617e9bdac69cadf156bb70d82e&storeViewId=1&instanceUrl=dev5.tonsoftiles.co.uk&id=12508"

faranki5 commented 4 years ago

Even though i do have the category object with this id: 12508. When I hover over my category in Pimcore, it shows me the id number.

faranki5 commented 4 years ago

I dont know what do you mean by attribute id. Please take a look at the attached snapshot, my image attribute is shown there. Screenshot from 2020-06-15 15-56-48

faranki5 commented 4 years ago

When i run the product command (php bin/magento divante:queue-product:process) on magento 2, it gives me this error on console: "Uncaught Error: Call to undefined method Magento\Framework\App\ResourceConnection\Interceptor::getSchemaName() in app/code/Divante/PimcoreIntegration/Listeners/AttributeSet/NameResolver.php:46"

synchmann commented 4 years ago

@synchmann @mbolka when i execute the endpoint i get this response: { "success": false, "msg": "Requested object with id 12508 does not exist." }

It seems like something is wrong with the configuration. Can you show me your integration-configuration object. Check that you have selected the right classes and directories. If your category is not in the right directory it won't be sent to magento.

faranki5 commented 4 years ago

@synchmann As you can see in the image below i have the right category directory and class in the configuration. I am using the directory "integrated categories" and categories in it. The category class is also correct, when i hover over the category objects it shows me its class name which is exactly the same i have added in the configuration. Screenshot from 2020-06-16 18-49-52

synchmann commented 4 years ago

@faranki5 You're requesting the wrong storeViewId (1 instead of 0 which is Admin), you can see it by requesting http://phpstack-328383-1173945.cloudwaysapps.com/webservice/rest/object/id/12472?apikey=cba1ca2b47b2576fa79f318463b1941b005bb2617e9bdac69cadf156bb70d82e. Try this endpoint http://phpstack-328383-1173945.cloudwaysapps.com/webservice/rest/category?apikey=cba1ca2b47b2576fa79f318463b1941b005bb2617e9bdac69cadf156bb70d82e&storeViewId=0&instanceUrl=dev5.tonsoftiles.co.uk&id=12508 and you will see data for Magento. Everything looks right.

faranki5 commented 4 years ago

@synchmann Well, i selected the admin store view in the configuration but when i run the category command on magento, it logs this error: "Could not save category: The value of attribute "Image" must be set". I have attached the snapshot of my image attribute of the class. Please check its settings, could you please tell me what exactly i am missing. I do upload images on the image attribute of my category objects. i have attached the log files, please have a look on it. Thanks! Screenshot from 2020-06-19 13-24-59

faranki5 commented 4 years ago

bridge.log bridge_critical.log

bpspatel commented 3 years ago

Hi, When I save and publish object (Category ) from pimcore . It is successfully added to queue and show in magento logs. But when we run command as given below bin/magento divante:queue-category:process bin/magento divante:queue-asset:process Then we get error [2021-06-03 06:36:29] StreamLogger.CRITICAL: Type Error occurred when creating object: **Divante\PimcoreIntegration\Model\CategoryRepository\Interceptor, Too few arguments to function Magento\Catalog\Model\CategoryRepository::__construct(), 3 passed in /var/www/html/magento2/app/code/Divante/PimcoreIntegration/Model/CategoryRepository.php on line 43 and exactly 4 expected [] []

Log are attached in docs as given below bridge.log bridge_critical.log**

bpspatel commented 3 years ago

@synchmann When I run the product command ( bin/magento divante:queue-product:process ) then get error Initialization processing of products queue. Started at 2021-06-18 06:05:42 Processing... PHP Fatal error: Uncaught Error: Call to undefined method Magento\Framework\App\ResourceConnection\Interceptor::getSchemaName() in /var/www/html/magento2/app/code/Divante/PimcoreIntegration/Listeners/AttributeSet/NameResolver.php:46 Stack trace:

0 /var/www/html/magento2/app/code/Divante/PimcoreIntegration/Listeners/NewAttributeSetListener.php(119): Divante\PimcoreIntegration\Listeners\AttributeSet\NameResolver->getNextPimcoreAttributeSetName()

1 /var/www/html/magento2/vendor/magento/framework/Event/Invoker/InvokerDefault.php(72): Divante\PimcoreIntegration\Listeners\NewAttributeSetListener->execute(Object(Magento\Framework\Event\Observer))

2 /var/www/html/magento2/vendor/magento/framework/Event/Invoker/InvokerDefault.php(60): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Divante\PimcoreIntegration\Listeners\NewAttributeSetListener), Object(Magento\Framework\Event\Observer))

3 /var/www/html/magento2/vendor/magento/framework/Event/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault-> in /var/www/html/magento2/app/code/Divante/PimcoreIntegration/Listeners/AttributeSet/NameResolver.php on line 46