• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/discount/preset/basepreset.php
  • Класс: BitrixSaleDiscountPresetBasePreset
  • Вызов: BasePreset::processAjaxActionGetProductDetails
public function processAjaxActionGetProductDetails(array $params = array())
{
	$productId = !empty($params['productId']) ? $params['productId'] : $this->request->get('productId');
	if (is_array($productId))
	{
		$productId = array_pop($productId);
	}

	$quantity = !empty($params['quantity']) ? $params['quantity'] : $this->request->get('quantity');
	$quantity = (float)$quantity;

	$siteId = !empty($params['siteId']) ? $params['siteId'] : $this->request->get('siteId');
	$siteId = (string)$siteId;

	global $USER;
	$userId = $USER->getId();

	if(empty($productId))
	{
		throw new SystemException("Could not find product id");
	}
	if (empty($quantity))
	{
		$quantity = 1;
	}

	$productDetails = OrderBasket::getProductDetails($productId, $quantity, $userId, $siteId);
	if(!$productDetails || empty($productDetails['PRODUCT_ID']))
	{
		return $this->getProductInfo($productId);
	}

	return $productDetails;
}