本文整理汇总了PHP中CSaleDelivery::GetById方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleDelivery::GetById方法的具体用法?PHP CSaleDelivery::GetById怎么用?PHP CSaleDelivery::GetById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleDelivery
的用法示例。
在下文中一共展示了CSaleDelivery::GetById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnOrderNewSendEmailHandler
function OnOrderNewSendEmailHandler($orderID, &$eventName, &$arFields)
{
// Поменять вид списка товаров
if (!CModule::IncludeModule('sale') || !CModule::IncludeModule('catalog')) return;
//global $pre_defined_variables, $DB;
$arOrder = CSaleOrder::GetById($orderID);
$dbBasketItems = CSaleBasket::GetList(array("NAME" => "ASC"), array("ORDER_ID" => $orderID), false, false, array("ID", "NAME", "QUANTITY", "PRICE", "CURRENCY", "DETAIL_PAGE_URL"));
$strOrderList = "";
$strOrderList .= '<table width="100%">';
$strOrderList .= '<thead><tr>';
foreach(array("Название","Количество","Цена","Сумма") as $th) $strOrderList .= '<th>'.$th.'</th>';
$strOrderList .= '</tr></thead>';
$strOrderList .= '<tbody>';
$price_total = 0;
$arBasketItems = array();
while ($arBasketItem = $dbBasketItems->Fetch())
{
$dbProp = CSaleBasket::GetPropsList(Array("SORT" => "ASC", "NAME" => "ASC"), Array("BASKET_ID" => $arBasketItem["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")));
while($arProp = $dbProp -> GetNext())
$arBasketItem["PROPS"][] = $arProp;
$arBasketItems[] = $arBasketItem;
$strOrderList .= '<tr>';
$strOrderList .= '<td>';
$strOrderList .= '<a href="http://www.zakrepi.ru'.$arBasketItem["DETAIL_PAGE_URL"].'" target="_blank">'.$arBasketItem["NAME"].'</a>';
// Из свойств товара заказа показать лишь стандартные и название филиала
foreach($arBasketItem['PROPS'] as &$arProp)
{
$strOrderList .= '<div style="font-size:80%">'.$arProp['NAME'].': '.$arProp['VALUE'].'</div>';
}
$strOrderList .= '</td>';
$strOrderList .= '<td style="text-align: center;">'.$arBasketItem["QUANTITY"].' шт.</td>';
$strOrderList .= '<td style="text-align: center;">'.SaleFormatCurrency($arBasketItem["PRICE"], $arBasketItem["CURRENCY"]).'</td>';
$strOrderList .= '<td style="text-align: center;">'.SaleFormatCurrency($arBasketItem["PRICE"] * $arBasketItem["QUANTITY"], $arBasketItem["CURRENCY"]).'</td>';
$strOrderList .= '</tr>';
$price_total += $arBasketItem["PRICE"] * $arBasketItem["QUANTITY"];
$price_currency = $arBasketItem["CURRENCY"];
}
$price_total_formatted = $price_currency? SaleFormatCurrency($price_total, $price_currency): '0';
$strOrderList .= '<tr><td colspan="3" style="text-align:right;">Общая стоимость: </td><td style="text-align: center;">'.$price_total_formatted.'</td></tr>';
//Получаем стоимость доставки цену и общую сумму вместе с ценой доставки
// Указываем способ доставки
// $arOrder['PRICE'] - Общая стоимость
$arFields['DELIVERY'] = '';
if (strlen($arOrder['DELIVERY_ID']))
{
if (is_string($arOrder['DELIVERY_ID']))
{
$sid = explode(":", $arOrder['DELIVERY_ID']);
$dbDeliv = CSaleDeliveryHandler::GetBySID($sid[0]);
$arDeliv = $dbDeliv->GetNext();
$arFields['DELIVERY'] = '<p><b>Способ доставки:</b> '.$arDeliv['NAME'].'</p>';
$price_total += $arOrder['PRICE_DELIVERY'];
$strOrderList .= '<tr><td colspan="3" style="text-align:right;">Стоимость доставки: </td><td style="text-align: center;">'.SaleFormatCurrency($arOrder['PRICE_DELIVERY'], $price_currency).'</td></tr>';
$strOrderList .= '<tr><td colspan="3" style="text-align:right;">Итого: </td><td style="text-align: center;">'.SaleFormatCurrency($price_total, $price_currency).'</td></tr>';
$arFields['ALL_PRICE'] = '<p><b>Итого: </b>'.SaleFormatCurrency($price_total, $price_currency).'</p>';
}
else{
$arDelivery = CSaleDelivery::GetById($arOrder['DELIVERY_ID']);
if ($arDelivery)
{
$value = $arDelivery['NAME'];
$value_name = $arDelivery['NAME'];
$value_price = '';
if ($arDelivery['PRICE']<=0)
{
$value .= ', Бесплатно';
$value_price = 'Бесплатно';
}
else
{
$value .= ', '.SaleFormatCurrency($arDelivery['PRICE'], $arDelivery['CURRENCY']);
$value_price = SaleFormatCurrency($arDelivery['PRICE'], $arDelivery['CURRENCY']);
$strOrderList .= '<tr><td colspan="3" style="text-align:right;">Стоимость доставки: </td><td style="text-align: center;">'.$value_price.'</td></tr>';
}
$arFields['DELIVERY'] = '<p><b>Способ доставки:</b> '.$value_name.'</p>';
$price_total += $arDelivery['PRICE'];
$strOrderList .= '<tr><td colspan="3" style="text-align:right;">Итого: </td><td style="text-align: center;">'.SaleFormatCurrency($price_total, $price_currency).'</td></tr>';
$arFields['ALL_PRICE'] = '<p><b>Итого: </b>'.SaleFormatCurrency($price_total, $price_currency).'</p>';
}
}
}
//.........这里部分代码省略.........