Closed zztimur closed 8 years ago
Seems good to me. @dunagan5887 sanity check?
I'm going to check the reverb side as to why we might be encoding the sku. that should not be the case
You don't API call to the listing goes by calling url with encoded SKU. The listing is created with non-encoded sku.
On Wed, Apr 27, 2016 at 10:08 AM, Yan Pritzker notifications@github.com wrote:
I'm going to check the reverb side as to why we might be encoding the sku. that should not be the case
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/reverbdotcom/reverb-magento/pull/239#issuecomment-215113942
-- Sent from my iPhone
This makes sense
Now i'm confused. The sku is "FOO BAR". you do a GET to reverb to find the sku, and are not sending it url encoded currently is that what this fix is? so that you do /api/my/listings?sku=FOO%20BAR
Currently when searching to see if a sku exists in Reverb, the request below is an example:
curl -i -k -XGET -H "X-Auth-Token: ......... https://sandbox.reverb.com/api/my/listings?state=all&sku=thi%09rd"
Here the sku is already being url-encoded by the cURL adapter. As such, when we send the sku as part of a create/update request, it is sent as the following:
curl -i -k -XPUT -H "X-Auth-Token ............ "https://sandbox.reverb.com/api/listings/46669-third-product" --data '{"sku":"thi\trd","title":"Third Product"........}'
Thanks, Sean.
On Apr 27, 2016, at 11:37 AM, Sean Dunagan notifications@github.com wrote:
Currently when searching to see if a sku exists in Reverb, the request below is an example:
curl -i -k -XGET -H "X-Auth-Token: ......... https://sandbox.reverb.com/api/my/listings?state=all&**sku=thi%09rd**"
Here the sku is already being url-encoded by the cURL adapter. As such, when we send the sku as part of a create/update request, it is sent as the following:
curl -i -k -XPUT -H "X-Auth-Token ............ "https://sandbox.reverb.com/api/listings/46669-third-product" --data '{"sku":"thi\trd","title":"Third Product"........}'
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub
There might be a issue here, I'm reverting this temporarily. THis is what I see in my log
==> reverb_sync_listing_images.log <==
2016-04-27T20:14:03+00:00 DEBUG (7): The API call returned an HTTP status that was not 200: 0.
URL:
Content: {"photos":["http:\/\/ec2-54-157-249-149.compute-1.amazonaws.com:80\/media\/catalog\/product\/d\/a\/davids_pizza.jpg"]}
Curl Error Message: Curl error number 3 occurred with the following error message: <url> malformed
==> exception.log <==
2016-04-27T20:14:03+00:00 ERR (3):
exception 'Exception' with message 'Error executing task for queue task object with id 940: The API call returned an HTTP status that was not 200: 0.
URL:
Content: {"photos":["http:\/\/ec2-54-157-249-149.compute-1.amazonaws.com:80\/media\/catalog\/product\/d\/a\/davids_pizza.jpg"]}
Curl Error Message: Curl error number 3 occurred with the following error message: <url> malformed' in /opt/bitnami/apps/magento/htdocs/.modman/reverb-magento/app/code/community/Reverb/ProcessQueue/Helper/Task/Processor.php:230
Stack trace:
#0 /opt/bitnami/apps/magento/htdocs/.modman/reverb-magento/app/code/community/Reverb/ProcessQueue/Helper/Task/Processor.php(102): Reverb_ProcessQueue_Helper_Task_Processor->_logError('Error executing...')
#1 /opt/bitnami/apps/magento/htdocs/.modman/reverb-magento/app/code/community/Reverb/ProcessQueue/Helper/Task/Processor.php(36): Reverb_ProcessQueue_Helper_Task_Processor->processQueueTask(Object(Reverb_ProcessQueue_Model_Task_Unique))
#2 /opt/bitnami/apps/magento/htdocs/.modman/reverb-magento/app/code/community/Reverb/ReverbSync/Model/Cron/Listings/Images/Sync.php(19): Reverb_ProcessQueue_Helper_Task_Processor->processQueueTasks('listing_image_s...')
#3 /opt/bitnami/apps/magento/htdocs/.modman/reverb-magento/app/code/community/Reverb/Process/Model/Locked/Cron/Abstract.php(45): Reverb_ReverbSync_Model_Cron_Listings_Images_Sync->executeCron()
#4 [internal function]: Reverb_Process_Model_Locked_Cron_Abstract->attemptCronExecution(Object(Aoe_Scheduler_Model_Schedule))
#5 /opt/bitnami/apps/magento/htdocs/app/code/community/Aoe/Scheduler/Model/Schedule.php(196): call_user_func_array(Array, Array)
#6 /opt/bitnami/apps/magento/htdocs/app/code/community/Aoe/Scheduler/Model/Schedule.php(582): Aoe_Scheduler_Model_Schedule->runNow(true)
#7 /opt/bitnami/apps/magento/htdocs/app/code/community/Aoe/Scheduler/Model/Observer.php(39): Aoe_Scheduler_Model_Schedule->process()
#8 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/App.php(1357): Aoe_Scheduler_Model_Observer->dispatch(Object(Varien_Event_Observer))
#9 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/App.php(1336): Mage_Core_Model_App->_callObserverMethod(Object(Aoe_Scheduler_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#10 /opt/bitnami/apps/magento/htdocs/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#11 /opt/bitnami/apps/magento/htdocs/cron.php(77): Mage::dispatchEvent('default')
#12 {main}
That's weird, the patch didn't look like it would modify the URL
I see that error without a patch.
On Wed, Apr 27, 2016 at 3:35 PM, Sean Dunagan notifications@github.com wrote:
That's weird, the patch didn't look like it would modify the URL
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/reverbdotcom/reverb-magento/pull/239#issuecomment-215219919
-- Sent from my iPhone
If you have a product with an SKU with a special character it won't sync correctly.
Here's an example. We had a product with a TAB symbol somehow ending up being part of SKU. Say SKU in magento is "product-abcd". Here's what happens to it.
Initial sync goes fine. The products sku is sent to reverb as "product-abcd\t" Inventory updates -> Queued for re-sync. On re-sync module checks if the product exists in the reverb via api using url containing the sku that is url encoded. So it checks for "product-abcd%9". Obviously product with such sku doesn't exist, so module attempts to create a new listing for product with sku "product-abcd\t" We get an error "SKU already exists in your shop. SKUs must be unique.already exists in your shop. SKUs must be unique." (fix the error message by the way).