<< 20160908-improve-tooltip-manager-davaz-com | Index | 20160908-create-tooltip-manager-davaz-com >>
There are 2 problems.
2508375 is duplicated in database.
<?xml version="1.0" encoding="utf-8"?>
<customerOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" language="fr" productDescriptionDesired="true" communicationSoftwareId="ywesee Test" xmlns="http://www.e-galexis.com/schemas/">
<client number="99" password="" />
<orderHeader deliveryDate="2016-07-15" referenceNumber="99"/>
<orderLines>
<productOrderLine orderQuantity="2">
<pharmaCode id="2508375" />
</productOrderLine>
<productOrderLine orderQuantity="2">
<pharmaCode id="5195126" />
</productOrderLine>
</orderLines>
</customerOrder>
See also (for how to debug products on sandoz.bbmb.ch):
http://dev.ywesee.com/Yasu/20160901-urgent-debug-virbac-bbmb-ch-vetoquinol-bbmb-ch#debug-update-on-sandoz-bbmb-ch
There are 3 same Products for 2508375. This is strange.
I don't know why these duplicated products are imported. But I have to remove unnecessary INDEX entries.
ch.bbmb.sandoz> ODBA.cache.retrieve_from_index('bbmb_model_product_pcode', '').select {|p| p.pcode == '2508375' }.length
-> 3
ch.bbmb.sandoz> ODBA.cache.retrieve_from_index('bbmb_model_product_pcode', '').select {|p| p.pcode == '2508375' }[0].price.to_s
->
ch.bbmb.sandoz> ODBA.cache.retrieve_from_index('bbmb_model_product_pcode', '').select {|p| p.pcode == '2508375' }[1].price.to_s
->
ch.bbmb.sandoz> ODBA.cache.retrieve_from_index('bbmb_model_product_pcode', '').select {|p| p.pcode == '2508375' }[2].price.to_s
-> 8.25
Delete these 2 non-price products.
ch.bbmb.sandoz> ODBA.cache.retrieve_from_index('bbmb_model_product_pcode', '').select {|p| p.pcode == '2508375' && p.price.to_s.empty? }.first.odba_delete
->
ch.bbmb.sandoz> ODBA.cache.retrieve_from_index('bbmb_model_product_pcode', '').select {|p| p.pcode == '2508375' && p.price.to_s.empty? }.first.odba_delete
->
ch.bbmb.sandoz> ODBA.cache.retrieve_from_index('bbmb_model_product_pcode', '').select {|p| p.pcode == '2508375' && p.price.to_s.empty? }.length
-> 0
# then `find_by_pcode` finds valid product.
ch.bbmb.sandoz> BBMB::Model::Product.find_by_pcode('2508375').price.to_s
-> 8.25
After this change, I confirmed order via sandoz.xmlconv.bbmb.ch with XML above.

I'm not sure, but this small change might be help for these duplicated products issue.
Commits: