Last active
November 12, 2016 11:09
-
-
Save demoriz/e4e98e2ea917f72a995226cef744de5b to your computer and use it in GitHub Desktop.
bitrix d7 sale 'basket element delete'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Bitrix\Main\Context; | |
use Bitrix\Main\Loader; | |
use Bitrix\Sale\Basket; | |
use Bitrix\Sale\Fuser; | |
Loader::includeModule('sale'); | |
$obRequest = Context::getCurrent()->getRequest(); | |
$intItemID = 51;// id basket intres | |
$obBasket = Basket::loadItemsForFUser(Fuser::getId(), Context::getCurrent()->getSite()); | |
$obBasket->getItemById($intItemID)->delete(); | |
$obBasket->save(); | |
// or from product id | |
$intProductId = 2; | |
if ($obItem = $obBasket->getExistsItem('catalog', $intProductId)) { | |
$obItem->delete(); | |
$obBasket->save(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment