Table of Contents
Marc Cain
xml feed is converted to csv on sg01 (bash marccain/transform_feed.sh), after conversion start feed import on index03: python /mnt/storage/var/live/indexer/scripts/update/feedUpdate.py /mnt/storage/var/etc/v3/feedUpdate.json 2788
Changes at Post Processor / Creating new Post Processor
Implementation
1. clone V4 Feed Import project
2. Switch directories
cd src/feed_import/
3. Create File or open Existing
touch post_proc_<SHOP_NAME>
- change processor class name
- create class that inherits from DefaultPostProcessor
- change process method (depending on usecase)
4. in case of a new processor file
- add corresponding import to post_proc.py
Testing
scp <file> index03:~/.local/lib/python2.7/site-packages/feed_import/
NOTE: (in case of change: rename existing file before copying in case of rollback)
5. Use feed import calls (index03)
python /mnt/storage/var/live/indexer/scripts/update/feedUpdate.py /mnt/storage/var/etc/v3/feedUpdate.json <SHOP_ID>
/home/picalike/.local/bin/v3_feed_import /mnt/storage/var/etc/v3/feedImport.json
python /mnt/storage/var/live/indexer/scripts/update/feedUpdateList.py /mnt/storage/var/etc/v3/feedUpdate.json
NOTE: check if your feed is currently updated and copy update id if thats the case
python /mnt/storage/var/live/indexer/scripts/update/feedUpdateCancel.py /mnt/storage/var/etc/v3/feedUpdate.json <UPDATE_ID>
Post Testing
<HTML><ol></HTML>
- commit / merge / push changes
- pull from master
cd /some/path/v4-feed-import/
git tag --> get next version number
git tag version-<NEXT_VERSION_NUMBER>
git push --tags
<HTML></ol></HTML>
Create package
<HTML><ol></HTML>
python3 setup.py sdist
- copy created package (lives in /some/path/v4-feed-import/dist/) to index03:/tmp/
- On index03
pip install /tmp/feed_import-0.1.15.tar.gz --no-deps --user
- run feed import again(Step 5) and verify everything works correctly by checking the data in the mongoDB<HTML></ol></HTML>
Not available Hack
Customers |
HirmerGG |
Eckerle |
Summary
The customers want to display products declared as “ist_reduziert” in their feed to be marked as “sale” in the PCI and Visualytics Frontends. In addition to that, they don't want products marked as “sale” in their results when requesting the API.
Implementation
1. File
cd /home/picalike/.local/lib/python2.7/site-packages/feed_import vim post_proc_hirmer.py
2. Logic
''' The solution below is used to mark sale products for filtering them out of product responses via the API Product state can be 0 = product not available 1 = product available 2 = product in sale ~= handling similar to not available in further processing ''' if avail and row[reduced_col] != "ja": sizes_avail.append("1") row[reduced_col] = "nein" elif row[reduced_col] == "ja": sizes_avail.append("2") else: sizes_avail.append("0")
There are two steps in the implementation.
<HTML><ol></HTML>
- If a product is “in stock” and not in sale == mark as available(for API logic) + mark as not in sale (for frontend logic)
- If a product is “in sale” == mark as sale (for API logic)<HTML></ol></HTML>