Conversation
includes/Products/Feed.php
Outdated
| continue; | ||
| } | ||
|
|
||
| $woo_feed_name_option_1 = self::FEED_NAME; |
There was a problem hiding this comment.
suggest factor out to private function named something like private function pattern_match_feed_names()
includes/Products/Feed.php
Outdated
| private function validate_feed_exists($feed_id) { | ||
| $catalog_id = facebook_for_woocommerce()->get_integration()->get_product_catalog_id(); | ||
| if ( '' === $catalog_id ) { | ||
| throw new Error( 'No catalog ID' ); |
There was a problem hiding this comment.
Are the errors stored in the logs or was it a conscious decision to not add any logs here
There was a problem hiding this comment.
This is a pattern I saw in the code for checking $catalog_id presence. This is mostly because we should not get into a state with no catalog.
But this is actually possible if user disconnects the plugin from a catalog (basically offboards).
This is a good use case to test our plugin behaviour overall, not just feed.
| * | ||
| * @internal | ||
| */ | ||
| private function query_and_filter_integration_feed_id() { |
There was a problem hiding this comment.
This method seems like a lot of logic
Can we have it broken out a bit
| $response->data | ||
| ); | ||
| } | ||
|
|
There was a problem hiding this comment.
Can you add a test to check unhappy path
If errors are thrown or logs are generated
There was a problem hiding this comment.
I think it won't bring value in this case, as we just mock response. Test with error mocks were added for other calls. that should be enough I think.
mshymon
left a comment
There was a problem hiding this comment.
Addressed the PR comments. Thanks everyone for reviewing the code!
includes/Products/Feed.php
Outdated
| private function validate_feed_exists($feed_id) { | ||
| $catalog_id = facebook_for_woocommerce()->get_integration()->get_product_catalog_id(); | ||
| if ( '' === $catalog_id ) { | ||
| throw new Error( 'No catalog ID' ); |
There was a problem hiding this comment.
This is a pattern I saw in the code for checking $catalog_id presence. This is mostly because we should not get into a state with no catalog.
But this is actually possible if user disconnects the plugin from a catalog (basically offboards).
This is a good use case to test our plugin behaviour overall, not just feed.
| $response->data | ||
| ); | ||
| } | ||
|
|
There was a problem hiding this comment.
I think it won't bring value in this case, as we just mock response. Test with error mocks were added for other calls. that should be enough I think.
|
@mshymon has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@mshymon has updated the pull request. You must reimport the pull request before landing. |
1 similar comment
|
@mshymon has updated the pull request. You must reimport the pull request before landing. |
|
@mshymon has updated the pull request. You must reimport the pull request before landing. |
Summary: ## Changelog: * Add - FB product video field to add videos. Also added products sync to support the video field with Batch API by gurtejrehal in #2874 * Tweak - tests for #2874 by gurtejrehal in #2888 * Tweak - tests for Product Update action as ramp up task by nealweiMeta in #2883 * Fix - translations loading before the init hook by iodic in #2866 * Fix - Fixed feeds by requesting a feed file upload session after feed file is generated and added missing new fields to the feed file by mshymon in #2841 Pull Request resolved: #2891 Reviewed By: akpurifb Differential Revision: D69836863 Pulled By: vahidkay-meta fbshipit-source-id: 32408ab4b42f60f921bd599ed982933017185b5e
Summary: ### Changes proposed in this Pull Request: Changes in detail here: https://docs.google.com/document/d/1PaXHKK1PRVtiBEwJtH_8ZP8h0UitDCXZnpFFDWo-eik/edit?tab=t.0#heading=h.m8p14s8600vn The main idea is to add a FeedManager singleton that will manage all the distinct Feed singletons. The Feed singletons will inherit from an AbstractFeed which will delegate the actual file creation to the Feed Handler or Feed Generator given the admin preferences. With that being said, the sequence will look similar to the existing product flow, but with the above simplifications:  Closes # . Detailed test instructions: Added an API test as done in this PR: #2841 Integration test not yet possible as dependent on Mice framework addition and Ent creation Added comments for how to test/dogfood as well as included instructions in the above linked doc Successful upload via Feed Handler: https://www.internalfb.com/intern/cat/sessions/642042718535396/ Successful upload via Feed Generator: https://www.internalfb.com/intern/cat/sessions/642101398529528/ **See branch common_framework_test to see an example proof of concept that utilizes the base classes.** This will just include what will be checked in via diff. Unit Tests A. Run new tests: ./vendor/bin/phpunit --filter ApiTest B. Run all tests: npm run test:php Manual Tests. Steps were added via an internal dogfooding doc and requires access to Meta internal tools to validate feed upload sessions status. - [ ] Do the changed files pass `phpcs` checks? Please remove `phpcs:ignore` comments in changed files and fix any issues, or delete if not practical. Pull Request resolved: #2875 Reviewed By: carterbuce, nrostrow-meta Differential Revision: D69409593 Pulled By: Jmencab fbshipit-source-id: 8ec2feb7f1ac54d89c9a84f9e6f7ca31592f3f02
Changes proposed in this Pull Request:
The current state of the product syncing via Feeds is broken - while plugin code base has business logic to generate feed file daily and serve the feed file on request, there is no logic for triggering a feed one time upload.
In this PR I am suggesting the following fixes to unblock product sync via feeds:
Trigger a daily feed upload sessions.
Update Feed file content by:
GTINto the feed filequantity_to_sell_on_facebookto the feed filerich_text_descriptionto the feed fileFixed incorrect values in the Feed file content:
Detailed test instructions:
A. Run new tests:
./vendor/bin/phpunit --filter ApiTest./vendor/bin/phpunit --filter fbproductTestB. Run all tests:
npm run test:phpChangelog entry
Fix - Fixed feeds by requesting a feed file upload session after feed file is generated and added missing new fields to the feed file.