Gelöst Wawi doesn't update group's price after "Price Kalkulieren" if more than one Product

Balakirev

New member
18. September 2019
17
6
Hello Everyone,

If set the price with a Price Calculator for more than one product, group's price will not be sync with shop.
Video playback is attached.

 

Balakirev

New member
18. September 2019
17
6
Update:

The problem is with Prestashop Connector, the price will be updated if you DROP the table with specific_price in Prestashop and then wright new data. If the data is already exist it will not overwritten.

Moderator, could you please move the topic to the Prestashop Connector bugs.
 
Zuletzt bearbeitet:

Benjamin Schaffrath

Moderator
Mitarbeiter
31. Juli 2018
149
29
Hello Balakirev,

It's unfortunate but it seems like it works on my machine :D
Wawi prices.PNG
presta prices.PNG

Could you send me the Wawi Ableichlog and the related Connector logs (Developer Logging = true) related to the faulty quicksync via pm?

Unbenannt.PNG
 

Balakirev

New member
18. September 2019
17
6
Hello Dear Benjamin Schaffrath,

Have you tryed to edit more than one product and than sync the changes? It's work for me too but only if i adjust one product's price and then sync it, if more than one, the price will be not updated.

Please check the video, first time i am syncing only one product and everything is working, than i adjust the price of two products and than sync it and it's doesn't work.


I will also install clean prestashop now to check if the problem is on my side. I will send the log from JTL Wawi and from the connector after i check everything.
 
Zuletzt bearbeitet:
  • Gefällt mir
Reaktionen: Benjamin Schaffrath

Balakirev

New member
18. September 2019
17
6
Benjamin Schaffrath,

I have installed new prestashop, i made new MsSQL DB and connect it to Wawi, so everything was clean as from the box. Then i checked everything and i have same result. If i update only one product's price everything is ok, if i update more than one product, price is not updated. Attached is two zips with logs from prestashop. in wawi i didn't receive log file.

Ps. What is also important that if you sync more than one product, only the first one will be updated. My guess is that the function that update Special Prices does not have a loop inside.

Finally i made a video with clean system:
 

Anhänge

Zuletzt bearbeitet:
  • Gefällt mir
Reaktionen: Benjamin Schaffrath

Balakirev

New member
18. September 2019
17
6
Update:

I have fix this, foreach loop was missing but although earlier in history on github it was already in code.
Code:
foreach($data as $price) {
    $id = $price->getProductId()->getEndpoint();
   
    if (!empty($id)) {
        list($productId, $combiId) = array_pad(explode('_', $id, 2), 2, 0);
       
        if (!empty($productId) && !is_null($combiId)) {
            $this->db->execute('
                DELETE p FROM '._DB_PREFIX_.'specific_price p
                WHERE p.id_product = '.$productId.'
                AND p.id_product_attribute = '.$combiId.'
                AND p.from = "0000-00-00 00:00:00"
            ');
        }
    }
}
 
  • Gefällt mir
Reaktionen: Benjamin Schaffrath

Benjamin Schaffrath

Moderator
Mitarbeiter
31. Juli 2018
149
29
Update:

I have fix this, foreach loop was missing but although earlier in history on github it was already in code.
Code:
foreach($data as $price) {
    $id = $price->getProductId()->getEndpoint();
 
    if (!empty($id)) {
        list($productId, $combiId) = array_pad(explode('_', $id, 2), 2, 0);
     
        if (!empty($productId) && !is_null($combiId)) {
            $this->db->execute('
                DELETE p FROM '._DB_PREFIX_.'specific_price p
                WHERE p.id_product = '.$productId.'
                AND p.id_product_attribute = '.$combiId.'
                AND p.from = "0000-00-00 00:00:00"
            ');
        }
    }
}
Nice find!
I could recreate the error after pushing prices for multiple products.
Yesterday I debuged the problem too and was thinking of moving the part that is in the initPush method to the pushData method, otherwise you would get a duplicate key entry if someone pushes a price 2 times in the same rpc call. ( Wawi was sending the same price 20 times in one RPC call yesterday)

I will push a possible fix to the feature/CO-635_product_price_duplicate_fix branch :)
 
Zuletzt bearbeitet:
  • Gefällt mir
Reaktionen: Balakirev