Documentation

GetDiscountByProduct

Description and parameters

mixed
CCatalogDiscount::GetDiscountByProduct(
 int productID = 0[,
 array arUserGroups = array()[,
 string renewal = "N"[,
 array arCatalogGroups = array()[,
 string siteID = false[,
 array arDiscountCoupons = false]]]]
);

Method calculates discount for product with productID for user as member of arUserGroups. Non-static method.

Call parameters

ParameterDescriptionAvailable from version
productID Product code.
arUserGroupsArray with groups with user as member. Returned for current user by method $USER->GetUserGroupArray()
renewal "Subscription renewal" flag
arCatalogGroups Array with price types search a discount.
siteID Site (current by default)
arDiscountCoupons Array with coupons affecting discount selection. In case of false, array with coupons will be sourced from CCatalogDiscountCoupon::GetCoupons

Returned values

Method returns array with associative arrays with discounts or false otherwise. Array contains an associative array with parameters for maximum percentage discount (if available) and an associative array with parameters of maximum fixed discount (if available).

Example

<?
$arDiscounts = CCatalogDiscount::GetDiscountByProduct(
        150,
        $USER->GetUserGroupArray(),
        "N",
        2,
        SITE_ID
    );
?>

© «Bitrix24», 2001-2024
Up