Heads up! 5.6.3.4 mysqli breaks eCommerce Add-on

Permalink
When adding new product to cart, following code is executed:

\packages\core_commerce\models\order\product.php around line 85
public function add($order, $product, $quantity) {
      $db = Loader::db();
      $dt = Loader::helper('date');
      $db->Execute('insert into CoreCommerceOrderProducts (productID, orderID, quantity, dateAdded, prName) values (?, ?, ?, ?, ?)', array($product->getProductID(), $order->getOrderID(), $quantity, $dt->getLocalDateTime(), $product->getProductName()));
      //record purchase
      $db->Replace('CoreCommerceProductStats', array('productID' => $product->getProductID(), 'totalPurchases' => 'totalPurchases + 1'), 'productID', false);
      $ccp =  CoreCommerceOrderProduct::getByID($db->Insert_ID());
      $ccp->rescanOrderProductPricePaid();
      return $ccp;
   }


When Concrete is using mysqli, it seems that calling the $db->Replace sets $db->insert_ID() to zero which leads to an error in $ccp = CoreCommerceOrderProduct::getByID($db->insert_ID()), as that call is supposed to use the ID provided by db insert above.

I fixed this by defining a separate variable where to store the insert ID and use that one in $ccp = ...

 
OKDnet replied on at Permalink Reply
OKDnet
Has this been confirmed? I have some 5.6.3.3 site running Core Commerce that I might want to upgrade, but not if there is an issue as stated.
ebmudcom replied on at Permalink Best Answer Reply
ebmudcom
Try upgrading to ecommerce 2.8.16.
It fixed a mysqli-related issue for us (which may be the same issue).

Note: we are not using 5.6.3.4 in Production yet.
Ale replied on at Permalink Reply
Thanks for pointing out the new version. I was under impression that the site was already using the newest version but it actually was 2.8.15 and it seems that the .16 was released quite recently.

The new version isn't even mentioned in the add-on's version history. I wonder what the actual changes were?