-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Header DefaultPriceTypeCode isn't used when no PriceTypeCode found in Product #4
Comments
Hi Ordio, First, thanks for the compliments! They are appreciated, and I'm glad that this project has helped you. At my work, we don't apply the header defaults automatically to the products. In fact, we apply (i.e., set) the default values conditionally, in a step between initializing the parser and then reading the products. However, I do see your point. For most people, it would probably be beneficial to apply the defaults automatically. That should be an easy enhancement. When I have some extra hours in the next few days, I'll try to make that change and then update this thread, in order to let you know that it's there. |
Hi Jaerith, No worries. Take your time. I have one publisher that sends their data without the price type in the data, and only in the header. For this publisher, I can re-run the data import anytime. I am curious on how you set the default values conditionally (between initializing the parser and reading the products)? Thank you! |
Hi Ordio, I've uploaded some changes that should take care of your problem. You might want to merge them with your fork. Also, you can turn on/off this new code with the optional ShouldApplyDefaults property on the Parser class. To answer your question, we iterate through the products on a first pass, applying the default values based on conditions. Then, we iterate through the products on a second pass when we need to read them. Let me know if it works! |
HI Jaerith, I've updated the changes you've made and everything is updating exactly as it should. Thank you very much! I was wondering if the same thing will apply to 3.0 as well? (I also have another question that is partially realted to the header, but not to this... is there another way for me to contact you?) Thank you. |
Hi Ordio, Yes, default values should be applied in the case of 3.0 files as well. Generally, I like the questions to be here, so that other users can find them (along with the answers). But, yes, you can send questions to my email address. I'd rather not post the actual email address here, but I will give a tip: you can usually find the email address of anyone on Github through the API call: https://api.github.com/users/{user}/events/public I've reached out and made connections to a few people that way. |
Hello jaerith,
First off, i want to thank you for this amazing project. It has made parsing ONIX legacy and 3.0 files with ease. I've had to make some additions to the ONIX 3 parsing, which was easy to do.
I was wondering if you have an idea on how to refer to the header DefaultPriceTypeCode when no PriceTypeCode is found in the Product segment?
For example...
Returns false because PriceType is -1...
Yet, there is a default Price Type in the Header.
Thank you.
The text was updated successfully, but these errors were encountered: