U
U
unlik2019-09-16 20:55:30
1C-Bitrix
unlik, 2019-09-16 20:55:30

Bitrix, display products at a discount?

How to display all products that have a discount?
I tried all the options from Google, they do not work.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Ivanov, 2019-09-18
@ZZiliST

Everything is very simple:

<?$res = AllProductDiscount::getFull();?>

<?
foreach($res['IDS'] as $ID) {
    	$sale_id[] = $ID;
}
?>

<?
$GLOBALS['searchFilter'] = array("ID"=>$sale_id);
?>

And in the component call code, look for the string "FILTER_NAME" => "searchFilter",
"searchFilter" is the element key from the $GLOBALS array

A
Ainur Valiev, 2019-11-27
@vaajnur

CModule::IncludeModule('sale');


$arBasketItems = array();

$dbBasketItems = CSaleBasket::GetList(
        array(
                "NAME" => "ASC",
                "ID" => "ASC"
            ),
        array(
                "FUSER_ID" => CSaleBasket::GetBasketUserID(),
                "LID" => SITE_ID,
                "ORDER_ID" => "NULL"
            ),
        false,
        false,
        array("ID", "CALLBACK_FUNC", "MODULE", 
              "PRODUCT_ID", "QUANTITY", "DELAY", 
              "CAN_BUY", "PRICE", "WEIGHT")
    );
while ($arItem = $dbBasketItems->Fetch())
{

    $arItem = CSaleBasket::GetByID($arItem["ID"]);
    $arDiscounts = CCatalogDiscount::GetDiscountByProduct(
        $arItem['PRODUCT_ID'],
        $USER->GetUserGroupArray(),
        "N",
        2,
        SITE_ID
    );
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question