Will increment the stock count for the given product number

@param string $productNumber
@param int $amount
@return array
426965
public function incrementStockCount(string $productNumber, int $amount) : array
    {
        Assert::that($productNumber)->minLength(1, 'The length of $productNumber has to be > 0');

        return $this->incrementOrDecrementStockCount($productNumber, abs($amount));
    }
381845
public function countProductVisited()
    {
        $em = $this->getEntityManager();
        $query = $em->createQuery(
            'SELECT COUNT( DISTINCT s.product ) FROM  EcommerceBundle:ProductStats AS s'
        );

        $total = $query->getSingleScalarResult();

        return $total;
    }
390853
public function cancelByBuyer()
    {
        $this->setStatusCode(self::STATUS_CANCELED_BY_BUYER);

        // Replace stock
        foreach ($this->getLineItems() as $lineItem)
        {
            $quantity = $lineItem->getQuantity();

            // Increment stock from Product
            $product = $lineItem->getProduct();
            $product->setQuantityOnHold($product->getQuantityOnHold()-$quantity);
            $product->setQuantityAvailable($product->getQuantityAvailable()+$quantity);

            // Create stock transaction for each line item
            $stockTransaction = new OrderStockTransaction();
            $stockTransaction->setQuantity($quantity);
            $stockTransaction->setProduct($product);
            $stockTransaction->setStatusCode(OrderStockTransaction::STATUS_PENDING);

            $lineItem->setStockTransaction($stockTransaction);
        }
    }
91256
public function add($product_id)
    {
        $result = null;
        $this->hook->attach('product.compare.add.before', $product_id, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        $product_ids = $this->getList();

        if (in_array($product_id, $product_ids)) {
            return false;
        }

        array_unshift($product_ids, $product_id);
        $this->controlLimit($product_ids);

        $result = $this->set($product_ids);
        $this->hook->attach('product.compare.add.after', $product_id, $result, $this);
        return (bool) $result;
    }
834027
public function add(&$obj, $quantity = 1)
    {
        $db = Loader::db();
        $existingPCID = $this->getPileContentID($obj);
        $v1 = array($this->pID);
        $q1 = "select max(displayOrder) as displayOrder from PileContents where pID = ?";
        $currentDO = $db->getOne($q1, $v1);
        $displayOrder = $currentDO + 1;
        if (!$existingPCID) {
            $v = array($this->pID, $obj->getBlockID(), "BLOCK", $quantity, $displayOrder);
            $q = "insert into PileContents (pID, itemID, itemType, quantity, displayOrder) values (?, ?, ?, ?, ?)";
            $r = $db->query($q, $v);
            if ($r) {
                $pcID = $db->Insert_ID();

                return $pcID;
            }
        } else {
            return $existingPCID;
        }
    }
889327
public function transact($amount, $orderId, $invoiceNumber = null)
    {
        $this->transaction = [
            'amount' => $amount,
            'orderId' => $orderId,
            'invoiceNumber' => $invoiceNumber ?: $orderId,
        ];

        return $this->initiateTransaction();
    }
312289
public function addStockMovement(StockMovementInterface $stockMovement)
    {
        $this->initStockMovements();

        if ($this->stockMovements->count()) {
            /** @var StockMovement $firstStockMovement */
            $firstStockMovement = $this->stockMovements->first();
            if ($stockMovement->getProduct()->getId() !== $firstStockMovement->getProduct()->getId()) {
                throw new StockMovementProductMismatchException('The product id of the first product is `'.$firstStockMovement->getProduct()->getId().'` while the one you are adding has this id: `'.$stockMovement->getProduct()->getId().'`');
            }
        }

        if (!$this->stockMovements->contains($stockMovement)) {
            $this->stockMovements->add($stockMovement);
        }

        return $this;
    }
576371
def increment(self, amount=1):
        
        self._primaryProgressBar.setValue(self.value() + amount)
        QApplication.instance().processEvents()
1048463
public function chunk($amount, callable $fn = null)
    {
        $this->prepare();

        $chunk_value = array_chunk($this->_map, $amount);
        $chunks = [];

        if (!is_null($fn) && is_callable($fn)) {
            foreach ($chunk_value as $chunk) {
                $return = $fn($chunk);
                if (!is_null($return)) {
                    $chunks[] = $return;
                }
            }
            return count($chunks) > 0 ? $chunks : null;
        }

        return $chunk_value;
    }
989024
public function update(ProductUpdateEvent $event)
    {
        if (null !== $product = ProductQuery::create()->findPk($event->getProductId())) {
            $con = Propel::getWriteConnection(ProductTableMap::DATABASE_NAME);
            $con->beginTransaction();

            try {
                $prevRef = $product->getRef();

                $product
                    ->setDispatcher($this->eventDispatcher)
                    ->setRef($event->getRef())
                    ->setLocale($event->getLocale())
                    ->setTitle($event->getTitle())
                    ->setDescription($event->getDescription())
                    ->setChapo($event->getChapo())
                    ->setPostscriptum($event->getPostscriptum())
                    ->setVisible($event->getVisible() ? 1 : 0)
                    ->setVirtual($event->getVirtual() ? 1 : 0)
                    ->setBrandId($event->getBrandId() <= 0 ? null : $event->getBrandId())

                    ->save($con)
                ;

                // Update default PSE (if product has no attributes and the product's ref change)
                $defaultPseRefChange = $prevRef !== $product->getRef()
                    && 0 === $product->getDefaultSaleElements()->countAttributeCombinations();
                if ($defaultPseRefChange) {
                    $defaultPse = $product->getDefaultSaleElements();
                    $defaultPse->setRef($product->getRef())->save();
                }

                // Update default category (if required)
                $product->setDefaultCategory($event->getDefaultCategory());

                $event->setProduct($product);
                $con->commit();
            } catch (PropelException $e) {
                $con->rollBack();
                throw $e;
            }
        }
    }
1079063
public function getSellerAuthorizationNote(\TdbShopOrder $order, $amount, $captureNow, array $itemList = array())
    {
        $text = $this->getValue('sellerAuthorizationNote');
        $data = $this->getTemplateDataFromOrder($order);
        $data['captureNow'] = $captureNow;
        $data['transaction__totalValue'] = $amount;
        $data['transaction__items'] = $itemList;

        return $this->render($text, $data);
    }
302329
public function getPriceStockForQuantityAction($productId)
    {
        $request = $this->getCurrentRequest();
        if (!$request->isXmlHttpRequest() || !($quantity = (int) $request->query->get('quantity'))) {
            throw new BadRequestHttpException('Request needs to be XHR and have a quantity parameter');
        }

        $product = $this->get('sonata.product.set.manager')->findOneBy(['id' => $productId, 'enabled' => true]);

        if (!$product) {
            throw new NotFoundHttpException(sprintf('Unable to find the product with id=%d', $productId));
        }

        $errors = [];

        /** @var \Sonata\Component\Product\Pool $productPool */
        $productPool = $this->get('sonata.product.pool');
        $provider = $productPool->getProvider($product);

        if ($provider->hasVariations($product)) {
            $errors['variations'] = 'This is a master product, it has no price';
        }

        $stock = $provider->getStockAvailable($product) ?: 0;

        if ($quantity > $stock) {
            $errors['stock'] = $this->get('translator')->trans('product_out_of_stock_quantity', [], 'SonataProductBundle');
        }

        $currency = $this->get('sonata.basket')->getCurrency();

        $price = $provider->calculatePrice($product, $currency, true, $quantity);

        return new JsonResponse([
            'stock' => $stock,
            'price' => $price,
            'price_text' => $this->get('sonata.intl.templating.helper.number')->formatCurrency($price, $currency),
            'errors' => $errors,
        ]);
    }
544531
private function saveProductToDataBase($productId, $count, $attributesAndValues = null, $additionalProducts = null, $combinationId = null)
    {
        $order = $this->getIncompleteOrderFromDB();

        if (\Yii::$app->getModule('shop')->enableCombinations) {
            if (!empty($attributesAndValues)) {
                $combination = $this->getCombination($attributesAndValues, $productId);
                if (!empty($combination)) {
                    $orderProduct = $this->getOrderProduct($order->id, $productId, $combination->id);
                }
                else {
                    throw new Exception(\Yii::t('cart', 'Such attributes combination does not exist'));
                }
            }
            else if(!empty($combinationId)) {
                $orderProduct = $this->getOrderProduct($order->id, $productId, $combinationId);
            }
            else {
                $orderProduct = $this->getOrderProduct($order->id, $productId, null);
            }
        } else {
            $orderProduct = new OrderProduct();
            $orderProduct->product_id = $productId;
            $orderProduct->order_id = $order->id;
        }

        $orderProduct->count += $count;
        if ($orderProduct->validate()) {
            $orderProduct->save();

            if (!empty($additionalProducts)) {
                foreach ($additionalProducts as $additionalProduct) {
                    $orderProductAdditionalProduct = OrderProductAdditionalProduct::find()
                        ->where(['order_product_id' => $orderProduct->id, 'additional_product_id' => $additionalProduct['productId']])
                        ->one();
                    if (empty($orderProductAdditionalProduct)) {
                        $orderProductAdditionalProduct = new OrderProductAdditionalProduct();
                        $orderProductAdditionalProduct->order_product_id = $orderProduct->id;
                        $orderProductAdditionalProduct->additional_product_id = $additionalProduct['productId'];
                        $orderProductAdditionalProduct->number = $additionalProduct['number'];
                        if ($orderProductAdditionalProduct->validate()) $orderProductAdditionalProduct->save();
                    }
                    else {
                        $orderProductAdditionalProduct->number += $additionalProduct['number'];
                        if ($orderProductAdditionalProduct->validate()) $orderProductAdditionalProduct->save();

                    }
                }
            }
        } else die(var_dump($orderProduct->errors));
    }
656686
public function getProduct(string $productNumber, int $siteId) : array
    {
        Assert::that($productNumber)->minLength(1, 'The length of $productNumber has to be > 0');
        Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive');

        return (array)$this->master->doRequest(
            'GET',
            sprintf('/admin/WEBAPI/Endpoints/v1_0/ProductService/{KEY}/%s/%d', rawurlencode($productNumber), $siteId)
        );
    }
817305
public function incrementQuantityAt($cartItemIndex, $quantity = 1)
    {
        $this->existenceCheckFor($cartItemIndex);

        $this->items[$cartItemIndex]->quantity += $quantity;

        $this->cartDriver->setCartItemQuantity(
            $this->items[$cartItemIndex]->id,
            $this->items[$cartItemIndex]->quantity
        );

        return $this->cartUpdates();
    }
430115
public function increment( $column, $amount = 1, array $extra = [] ) {
		if ( ! is_numeric( $amount ) ) {
			throw new \InvalidArgumentException( 'Non-numeric value passed to increment method.' );
		}

		return (int) parent::increment( $column, $amount, $extra );
	}
427476
public static function afterTax($amount, Taxable $taxable)
    {
        return static::beforeTax(
            $taxable->getAmountWithoutTax(static::asMoney($amount)), $taxable
        );
    }