reverbdotcom / reverb-magento

Magento 1.x plugin for syncing with Reverb
Other
7 stars 10 forks source link

Updating category fields in listings sync to prioritize subcategories… #166

Closed dunagan5887 closed 8 years ago

dunagan5887 commented 8 years ago

Fix #164

This will resolve the nil issue, as well as implement prioritizing subcategories over top-level categories. It will also result in only one category's slug being sent in the "categories" array field. Let me know if you want that to be updated

skwp commented 8 years ago

techhnically we can take up to 2 slugs in the categories field

dunagan5887 commented 8 years ago

With this latest commit, up to two category slugs will be passed to Reverb (the two deepest categories the product is mapped to). The product slug of the deepest Reverb category will be passed as well (will always be passed, it was like that before, the comments were just wrong)

In the event that a product is mapped to 2 second-level Reverb categories, the decision is arbitrary regarding which product slug is passed to Reverb. Both of their category slugs would be passed

skwp commented 8 years ago

thanks :+1: - i'm not 100% sure of why you're having to explode the categories by their " > " though as in the api response there are "categories" and there are "subcategories". i would assume you would build an in memory hash representation of the same...not sure. but i'll merge this for now thanks!

dunagan5887 commented 8 years ago

Accounting for the potential down the road of additional nesting layers

skwp commented 8 years ago

I just tested - this code is not correct. It is mixing up categories and produt_types. Here is the request it generated:

"categories":["pro-audios"],"product_type":"microphones"

Instead, the product_type should be pro-audios, and the cateogries should be microphones:

reverb_category_sync___magento_admin

I'm reverting the commit for now as it makes things worse

skwp commented 8 years ago

to fix this, you'll probably want to revert my revert which is commit: 63136d6

dunagan5887 commented 8 years ago

The latest commit to https://github.com/reverbdotcom/reverb-magento/tree/issues/github_164 reverses your commit and addresses the issue. It will require clients to re-map their categories though