本文整理汇总了PHP中CSaleBasket::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleBasket::getList方法的具体用法?PHP CSaleBasket::getList怎么用?PHP CSaleBasket::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleBasket
的用法示例。
在下文中一共展示了CSaleBasket::getList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOrderInfo
protected static function getOrderInfo($orderId)
{
// order itself
$order = \CSaleOrder::getById($orderId);
// buyer info
$siteUserId = $order['USER_ID'];
$phone = '';
$email = '';
$result = \CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $orderId));
while ($row = $result->fetch()) {
if (empty($phone) && stripos($row['CODE'], 'PHONE') !== false) {
$stPhone = static::normalizePhoneNumber($row['VALUE']);
if (!empty($stPhone)) {
$phone = sha1($stPhone);
}
}
if (empty($email) && stripos($row['CODE'], 'EMAIL') !== false) {
if (!empty($row['VALUE'])) {
$email = sha1($row['VALUE']);
}
}
}
// products info
$products = array();
$result = \CSaleBasket::getList(array(), $arFilter = array('ORDER_ID' => $orderId), false, false, array('PRODUCT_ID'));
while ($row = $result->fetch()) {
$products[] = array('product_id' => $row['PRODUCT_ID'], 'recommendation' => '0');
}
// all together
$data = array('order_id' => $orderId, 'user_id' => $siteUserId, 'phone' => $phone, 'email' => $email, 'products' => $products);
return $data;
}
示例2: getOrderInfo
protected static function getOrderInfo($orderId)
{
// order itself
$order = \CSaleOrder::getById($orderId);
// buyer info
$siteUserId = $order['USER_ID'];
$phone = '';
$email = '';
$result = \CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $orderId));
while ($row = $result->fetch()) {
if (empty($phone) && stripos($row['CODE'], 'PHONE') !== false) {
$stPhone = static::normalizePhoneNumber($row['VALUE']);
if (!empty($stPhone)) {
$phone = sha1($stPhone);
}
}
if (empty($email) && stripos($row['CODE'], 'EMAIL') !== false) {
if (!empty($row['VALUE'])) {
$email = sha1($row['VALUE']);
}
}
}
// products info
$products = array();
$result = \CSaleBasket::getList(array(), $arFilter = array('ORDER_ID' => $orderId, 'MODULE' => 'catalog'), false, false, array('PRODUCT_ID', 'RECOMMENDATION', 'QUANTITY', 'PRICE', 'CURRENCY'));
while ($row = $result->fetch()) {
$productInfo = \CCatalogSKU::GetProductInfo($row['PRODUCT_ID']);
$iblockId = 0;
if (!empty($productInfo['ID'])) {
$realProductId = $productInfo['ID'];
$iblockId = $productInfo['IBLOCK_ID'];
} else {
$realProductId = $row['PRODUCT_ID'];
// get iblock id
$element = \Bitrix\Iblock\ElementTable::getRow(array('select' => array('IBLOCK_ID'), 'filter' => array('=ID' => $realProductId)));
if (!empty($element)) {
$iblockId = $element['IBLOCK_ID'];
}
}
$products[] = array('product_id' => $realProductId, 'iblock_id' => $iblockId, 'quantity' => $row['QUANTITY'], 'price' => $row['PRICE'], 'currency' => $row['CURRENCY'], 'recommendation' => $row['RECOMMENDATION']);
}
// all together
$data = array('order_id' => $orderId, 'user_id' => $siteUserId, 'phone' => $phone, 'email' => $email, 'products' => $products, 'price' => $order['PRICE'], 'currency' => $order['CURRENCY']);
return $data;
}