pimcore-magento2-bridge icon indicating copy to clipboard operation
pimcore-magento2-bridge copied to clipboard

Products or Categories not getting synced with Magento

Open faranki5 opened this issue 4 years ago • 23 comments

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.

  • Could not update status for object with id: 12484. Status: SUCCESS. Message: category with ID 12484 successfully added to queue

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

  • [ERROR] Missing configuration for object: 12484, instanceUrl:*******, store view: 0.

  • Requested object with id 12484 does not exist.

  • Could not update status for object with id: 12484. Status: ERROR. Message: An error occurred while insert/update category "12484": Notice: Undefined index: data in /microcloud/domains/tondev/domains/dev5.tonsoftiles.co.uk/http/app/code/Divante/PimcoreIntegration/Http/Response/Transformator/CategoryUpdateTransformator.php on line 67

any tips how to debug?

faranki5 avatar Apr 24 '20 09:04 faranki5

@mbolka would you please help out.

faranki5 avatar Apr 24 '20 14:04 faranki5

@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.

mbolka avatar May 13 '20 12:05 mbolka

@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 avatar May 21 '20 10:05 faranki5

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 avatar May 21 '20 10:05 faranki5

@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') "

faranki5 avatar May 21 '20 11:05 faranki5

@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.

mbolka avatar May 21 '20 13:05 mbolka

@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 avatar May 28 '20 08:05 faranki5

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

faranki5 avatar May 28 '20 08:05 faranki5

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 ?

synchmann avatar May 28 '20 12:05 synchmann

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

faranki5 avatar Jun 15 '20 09:06 faranki5

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 avatar Jun 15 '20 09:06 faranki5

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 avatar Jun 15 '20 09:06 faranki5

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 avatar Jun 15 '20 09:06 faranki5

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"

faranki5 avatar Jun 15 '20 09:06 faranki5

@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.

synchmann avatar Jun 16 '20 10:06 synchmann

@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

faranki5 avatar Jun 16 '20 12:06 faranki5

@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.

synchmann avatar Jun 18 '20 12:06 synchmann

@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 avatar Jun 19 '20 07:06 faranki5

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 avatar Jun 03 '21 07:06 bpspatel

@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

bpspatel avatar Jun 18 '21 06:06 bpspatel