Ejemplo n.º 1
0
 /**
  * Removing all quote items for specified product
  *
  * @param int $productId
  * @return void
  */
 public function dropAllQuoteChildItems($productId)
 {
     $select = $this->quoteResource->getReadConnection()->select();
     $adapter = $select->getAdapter();
     $quoteItemIds = $adapter->fetchCol($select->from($this->getTable('quote_item'), ['item_id'])->where('product_id = :product_id'), ['product_id' => $productId]);
     if ($quoteItemIds) {
         $adapter->delete($this->getTable('quote_item'), ['parent_item_id IN(?)' => $quoteItemIds]);
     }
 }
 /**
  * When deleting product, subtract it from all quotes quantities
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function subtractQtyFromQuotes($observer)
 {
     $product = $observer->getEvent()->getProduct();
     $this->_quote->substractProductFromQuotes($product);
 }
Ejemplo n.º 3
0
 /**
  * @magentoDataFixture Magento/Sales/_files/order_alphanumeric_id.php
  */
 public function testIsOrderIncrementIdUsedAlphanumericIncrementId()
 {
     $this->assertTrue($this->_resourceModel->isOrderIncrementIdUsed('M00000001'));
 }
Ejemplo n.º 4
0
 /**
  * @param $value
  * @dataProvider isOrderIncrementIdUsedDataProvider
  */
 public function testIsOrderIncrementIdUsed($value)
 {
     $expectedBind = [':increment_id' => $value];
     $this->adapterMock->expects($this->once())->method('fetchOne')->with($this->selectMock, $expectedBind);
     $this->model->isOrderIncrementIdUsed($value);
 }
Ejemplo n.º 5
0
 /**
  * When applying a catalog price rule, make related quotes recollect on demand
  *
  * @return void
  */
 public function dispatch()
 {
     $this->_quote->markQuotesRecollectOnCatalogRules();
 }