Skip to content

Instantly share code, notes, and snippets.

@crusat
Last active August 7, 2016 08:00
Show Gist options
  • Save crusat/9ba28140c75de7b029b1b0fd3baa9cc1 to your computer and use it in GitHub Desktop.
Save crusat/9ba28140c75de7b029b1b0fd3baa9cc1 to your computer and use it in GitHub Desktop.
<?php
function getPrice($productId) {
$result = '';
$PRICE_TYPE_ID = 1; # just example, see in admin panel
$rsPrices = CPrice::GetList(array(), array('PRODUCT_ID' => $productId, 'CATALOG_GROUP_ID' => $PRICE_TYPE_ID));
if ($arPrice = $rsPrices->Fetch())
{
$result = CurrencyFormat($arPrice["PRICE"], $arPrice["CURRENCY"]);
}
return $result;
}
# using
echo getPrice(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment