本文整理汇总了PHP中CCatalogStore类的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogStore类的具体用法?PHP CCatalogStore怎么用?PHP CCatalogStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCatalogStore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: catalog_offer_mutator_1c
function catalog_offer_mutator_1c(&$arLoadOffer, &$xOfferNode)
{
global $arProperties;
$sQuantity = $arLoadOffer['QUANTITY'];
$newQuanity = 0;
$priceTypeId = '';
if ($obPrice = $xOfferNode->SelectNodes('/Цены/Цена/ИдТипаЦены')) {
$priceTypeId = $obPrice->textContent();
if ($priceTypeId != '') {
$Store = new CCatalogStore();
$storeProd = new CCatalogStoreProduct();
$rsStore = $Store->GetList(array(), array('XML_ID' => $priceTypeId), false, false, array('*'));
if ($arStore = $rsStore->Fetch()) {
$storeId = $arStore['ID'];
} else {
$arFields = array("TITLE" => 'Store_' . $priceTypeId, "ACTIVE" => 'Y', "ADDRESS" => '-', "XML_ID" => $priceTypeId);
$storeId = CCatalogStore::Add($arFields);
}
$storeProd->Add(array("PRODUCT_ID" => $arLoadOffer['ID'], "STORE_ID" => $storeId, "AMOUNT" => $sQuantity));
$rsStoreProd = $storeProd->GetList(array(), array('PRODUCT_ID' => $arLoadOffer['ID']), false, false, array('AMOUNT'));
while ($arStore = $rsStoreProd->Fetch()) {
$newQuanity = $newQuanity + $arStore['AMOUNT'];
}
if ($newQuanity > 0) {
$arLoadOffer['QUANTITY'] = $newQuanity;
}
}
}
return $arLoadOffer;
}
示例2: Add
/** Add new store in table b_catalog_store,
* @static
* @param $arFields
* @return bool|int
*/
static function Add($arFields)
{
/** @global CDataBase $DB */
global $DB;
if (!CBXFeatures::IsFeatureEnabled('CatMultiStore')) {
$dbResultList = CCatalogStore::GetList(array());
if ($arResult = $dbResultList->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("CS_ALREADY_HAVE_STORE"));
return false;
}
}
if (array_key_exists('DATE_CREATE', $arFields)) {
unset($arFields['DATE_CREATE']);
}
if (array_key_exists('DATE_MODIFY', $arFields)) {
unset($arFields['DATE_MODIFY']);
}
$arFields['~DATE_MODIFY'] = $DB->GetNowFunction();
$arFields['~DATE_CREATE'] = $DB->GetNowFunction();
if (!self::CheckFields('ADD', $arFields)) {
return false;
}
$arInsert = $DB->PrepareInsert("b_catalog_store", $arFields);
$strSql = "INSERT INTO b_catalog_store (" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$res = $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (!$res) {
return false;
}
$lastId = intval($DB->LastID());
return $lastId;
}
示例3: loadFromDatabase
/**
* Loads values from database.
* Returns true on success.
*
* @return boolean
*/
protected function loadFromDatabase()
{
if (!isset($this->fields) && $this->id > 0) {
$storeList = \CCatalogStore::getList(array(), array("ID" => $this->id), false, false, array("ID", "TITLE"));
$this->fields = $storeList->fetch();
}
return is_array($this->fields);
}
示例4: load
protected function load()
{
$storeList = \CCatalogStore::getList(array(), array("ACTIVE" => "Y"), false, false, array("ID", "TITLE", "ACTIVE"));
$result = array();
while ($ar = $storeList->fetch()) {
$result[] = $ar["TITLE"];
}
return $result;
}
示例5: Update
static function Update($id, $arFields)
{
global $DB;
$id = intval($id);
if (0 >= $id) {
return false;
}
foreach (GetModuleEvents("catalog", "OnBeforeCatalogStoreUpdate", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($id, &$arFields)) === false) {
return false;
}
}
$bNeedConversion = false;
if (array_key_exists('DATE_CREATE', $arFields)) {
unset($arFields['DATE_CREATE']);
}
if (array_key_exists('DATE_MODIFY', $arFields)) {
unset($arFields['DATE_MODIFY']);
}
if (array_key_exists('DATE_STATUS', $arFields)) {
unset($arFields['DATE_STATUS']);
}
if (array_key_exists('CREATED_BY', $arFields)) {
unset($arFields['CREATED_BY']);
}
$arFields['~DATE_MODIFY'] = $DB->GetNowFunction();
$dbStore = CCatalogStore::GetList(array(), array("ID" => $id), false, false, array("ACTIVE"));
if ($arStore = $dbStore->Fetch()) {
if ($arStore["ACTIVE"] != $arFields["ACTIVE"]) {
$bNeedConversion = true;
}
}
if ($id <= 0 || !self::CheckFields('UPDATE', $arFields)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_catalog_store", $arFields);
if (!empty($strUpdate)) {
$strSql = "update b_catalog_store set " . $strUpdate . " where ID = " . $id;
if (!$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__)) {
return false;
}
CCatalogStoreControlUtil::clearStoreName($id);
}
if ($bNeedConversion) {
self::recalculateStoreBalances($id);
}
foreach (GetModuleEvents("catalog", "OnCatalogStoreUpdate", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($id, $arFields));
}
return $id;
}
示例6: getStoresList
protected static function getStoresList($nameOnly = true, $siteId = "")
{
if (!\Bitrix\Main\Loader::includeModule('catalog')) {
return array();
}
$filter = array("ACTIVE" => "Y", "ISSUING_CENTER" => "Y");
if (strlen($siteId) > 0) {
$filter["+SITE_ID"] = $siteId;
}
$result = array();
$dbList = \CCatalogStore::GetList(array("SORT" => "ASC", "TITLE" => "ASC"), $filter, false, false, array("ID", "SITE_ID", "TITLE", "ADDRESS", "DESCRIPTION", "IMAGE_ID", "PHONE", "SCHEDULE", "LOCATION_ID", "GPS_N", "GPS_S"));
while ($store = $dbList->Fetch()) {
if ($nameOnly) {
$result[$store["ID"]] = $store["TITLE"] . (strlen($store["SITE_ID"]) > 0 ? " [" . $store["SITE_ID"] . "]" : "");
} else {
$result[$store["ID"]] = $store;
}
}
return $result;
}
示例7: Update
static function Update($id, $arFields)
{
global $DB;
$id = intval($id);
$bNeedConversion = false;
if (array_key_exists('DATE_CREATE', $arFields)) {
unset($arFields['DATE_CREATE']);
}
if (array_key_exists('DATE_MODIFY', $arFields)) {
unset($arFields['DATE_MODIFY']);
}
if (array_key_exists('DATE_STATUS', $arFields)) {
unset($arFields['DATE_STATUS']);
}
if (array_key_exists('CREATED_BY', $arFields)) {
unset($arFields['CREATED_BY']);
}
$arFields['~DATE_MODIFY'] = $DB->GetNowFunction();
$dbStore = CCatalogStore::GetList(array(), array("ID" => $id), false, false, array("ACTIVE"));
if ($arStore = $dbStore->Fetch()) {
if ($arStore["ACTIVE"] != $arFields["ACTIVE"]) {
$bNeedConversion = true;
}
}
if ($id <= 0 || !self::CheckFields('UPDATE', $arFields)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_catalog_store", $arFields);
if (!empty($strUpdate)) {
$strSql = "UPDATE b_catalog_store SET " . $strUpdate . " WHERE ID = " . $id . " ";
if (!$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__)) {
return false;
}
}
if ($bNeedConversion) {
self::recalculateStoreBalances($id);
}
return $id;
}
示例8: Add
/** Add new store in table b_catalog_store,
* @static
* @param $arFields
* @return bool|int
*/
static function Add($arFields)
{
/** @global CDataBase $DB */
global $DB;
if (!CBXFeatures::IsFeatureEnabled('CatMultiStore')) {
$dbResultList = CCatalogStore::GetList(array(), array(), false, array('NAV_PARAMS' => array("nTopCount" => "1")), array("ID"));
if ($arResult = $dbResultList->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("CS_ALREADY_HAVE_STORE"));
return false;
}
}
foreach (GetModuleEvents("catalog", "OnBeforeCatalogStoreAdd", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
return false;
}
}
if (array_key_exists('DATE_CREATE', $arFields)) {
unset($arFields['DATE_CREATE']);
}
if (array_key_exists('DATE_MODIFY', $arFields)) {
unset($arFields['DATE_MODIFY']);
}
$arFields['~DATE_MODIFY'] = $DB->GetNowFunction();
$arFields['~DATE_CREATE'] = $DB->GetNowFunction();
if (!self::CheckFields('ADD', $arFields)) {
return false;
}
$arInsert = $DB->PrepareInsert("b_catalog_store", $arFields);
$strSql = "INSERT INTO b_catalog_store (" . $arInsert[0] . ") VALUES(" . $arInsert[1] . ")";
$res = $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (!$res) {
return false;
}
$lastId = intval($DB->LastID());
foreach (GetModuleEvents("catalog", "OnCatalogStoreAdd", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($lastId, $arFields));
}
return $lastId;
}
示例9: getCatalogStores
private static function getCatalogStores()
{
if (!isset(self::$catalogStoreCache)) {
self::$catalogStoreCache = array();
if (self::$catalogIncluded === null) {
self::$catalogIncluded = Loader::includeModule('catalog');
}
if (self::$catalogIncluded) {
$storeCount = 0;
$maxStores = (int) COption::GetOptionString("iblock", "seo_max_stores");
$rsStore = CCatalogStore::GetList(array('SORT' => 'ASC'), array(), false, false, array('ID', 'TITLE', 'ADDRESS'));
while ($store = $rsStore->Fetch()) {
self::$catalogStoreCache[$storeCount] = $store;
$storeCount++;
if ($maxStores > 0 && $storeCount >= $maxStores) {
break;
}
}
}
}
return self::$catalogStoreCache;
}
示例10: getStoreName
/** By store ID, returns its title and\or address.
* @param $storeId
* @return string
*/
public static function getStoreName($storeId)
{
static $dbStore = '';
static $arStores = array();
if ($storeId <= 0) {
return '';
}
$storeName = '';
if ($dbStore == '') {
$dbStore = CCatalogStore::GetList(array(), array("ACTIVE" => "Y"));
}
if (empty($arStores)) {
while ($arStore = $dbStore->Fetch()) {
$arStores[] = $arStore;
}
}
foreach ($arStores as $arStore) {
if ($arStore["ID"] == $storeId) {
$storeName = $arStore["ADDRESS"];
$storeName = $arStore["TITLE"] !== '' ? $arStore["TITLE"] . " (" . $storeName . ") " : $storeName;
}
}
return $storeName;
}
示例11: GetMessage
}
endif;
$tabControl->EndCustomField("ORDER_DELIVERY", '');
$tabControl->BeginCustomField("STORE_DELIVERY", GetMessage("SOD_STORE_SEND"));
if (intval($arOrder["STORE_ID"]) > 0):
?>
<tr>
<td width="40%"><?echo $tabControl->GetCustomLabelHTML()?>:</td>
<td>
<?
$dbList = CCatalogStore::GetList(
array("SORT" => "DESC", "ID" => "DESC"),
array("ACTIVE" => "Y", "ID" => $arOrder["STORE_ID"]),
false,
false,
array("ID", "TITLE", "ADDRESS", "DESCRIPTION", "IMAGE_ID", "PHONE", "SCHEDULE", "LOCATION_ID", "GPS_N", "GPS_S")
);
if ($arList = $dbList->Fetch()):
?>
<div><?php
echo htmlspecialcharsbx($arList["TITLE"]);
?>
</div>
<?else:?>
<div<?php
echo GetMessage('SOD_STORE_SEND_NULL');
?>
></div>
<?endif;?>
示例12: ImportStoresAmount
function ImportStoresAmount($arElement, $elementID, &$counter)
{
$arFields = array();
$arFields['PRODUCT_ID'] = $elementID;
static $arStoreResult = false;
if ($arStoreResult === false) {
$arStoreResult = array();
$resStore = CCatalogStore::GetList(array(), array(), false, false, array("ID", "XML_ID"));
while ($arStore = $resStore->Fetch()) {
$arStoreResult[$arStore["XML_ID"]] = $arStore["ID"];
}
}
foreach ($arElement as $xmlID => $amount) {
if (isset($arStoreResult[$xmlID])) {
$arFields['STORE_ID'] = $arStoreResult[$xmlID];
$arFields['AMOUNT'] = $amount;
$res = CCatalogStoreProduct::UpdateFromForm($arFields);
if (!$res) {
$counter["ERR"]++;
}
}
}
return true;
}
示例13: htmlspecialcharsbx
$arDelivery["DESCRIPTION"] = htmlspecialcharsbx($arDeliveryDescription["DESCRIPTION"]);
$arDeliveryAll[] = $arDelivery;
if (!empty($arUserResult["DELIVERY_ID"]) && strpos($arUserResult["DELIVERY_ID"], ":") === false) {
if (IntVal($arUserResult["DELIVERY_ID"]) == IntVal($arDelivery["ID"])) {
$bFound = true;
}
}
if (IntVal($arUserResult["DELIVERY_ID"]) == IntVal($arDelivery["ID"])) {
$arResult["DELIVERY_PRICE"] = roundEx(CCurrencyRates::ConvertCurrency($arDelivery["PRICE"], $arDelivery["CURRENCY"], $arResult["BASE_LANG_CURRENCY"]), SALE_VALUE_PRECISION);
}
}
if (!$bFound && !empty($arUserResult["DELIVERY_ID"]) && strpos($arUserResult["DELIVERY_ID"], ":") === false) {
$arUserResult["DELIVERY_ID"] = "";
}
$arStore = array();
$dbList = CCatalogStore::GetList(array("SORT" => "DESC", "ID" => "DESC"), array("ACTIVE" => "Y", "ID" => $arStoreId, "ISSUING_CENTER" => "Y", "+SITE_ID" => SITE_ID), false, false, array("ID", "TITLE", "ADDRESS", "DESCRIPTION", "IMAGE_ID", "PHONE", "SCHEDULE", "GPS_N", "GPS_S", "ISSUING_CENTER", "SITE_ID"));
while ($arStoreTmp = $dbList->Fetch()) {
if ($arStoreTmp["IMAGE_ID"] > 0) {
$arStoreTmp["IMAGE_ID"] = CFile::GetFileArray($arStoreTmp["IMAGE_ID"]);
}
$arStore[$arStoreTmp["ID"]] = $arStoreTmp;
}
$arResult["STORE_LIST"] = $arStore;
if (!$bFound && !empty($arUserResult["DELIVERY_ID"]) && strpos($arUserResult["DELIVERY_ID"], ":") === false) {
$arUserResult["DELIVERY_ID"] = "";
}
foreach ($arDeliveryAll as $arDelivery) {
if (count($arP2D[$arUserResult["PAY_SYSTEM_ID"]]) <= 0 || in_array($arDelivery["ID"], $arP2D[$arUserResult["PAY_SYSTEM_ID"]])) {
$arDelivery["FIELD_NAME"] = "DELIVERY_ID";
if (IntVal($arUserResult["DELIVERY_ID"]) == IntVal($arDelivery["ID"])) {
$arDelivery["CHECKED"] = "Y";
示例14: GetInheritedPropertyTemplateElementMenuItems
//.........这里部分代码省略.........
"TEXT" => GetMessage("IB_COMPLIB_POPUP_SKU_PRICE"),
"MENU" => array(),
);
$rsPrice = CCatalogGroup::GetListEx(array("SORT"=>"ASC"), array(), false, false, array("ID", "NAME"));
while ($price = $rsPrice->Fetch())
{
if (preg_match("/^[a-zA-Z0-9]+\$/", $price["NAME"]))
{
$result["sku_price"]["MENU"][] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_MIN_PRICE")." ".$price["NAME"],
"ONCLICK" => "$action_function('{=min this.catalog.sku.price.".$price["NAME"]."}', '$menuID', '$inputID')",
);
$result["sku_price"]["MENU"][] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_MAX_PRICE")." ".$price["NAME"],
"ONCLICK" => "$action_function('{=max this.catalog.sku.price.".$price["NAME"]."}', '$menuID', '$inputID')",
);
}
else
{
$result["sku_price"]["MENU"][] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_MIN_PRICE")." ".$price["NAME"],
"ONCLICK" => "$action_function('{=min this.catalog.sku.price.".$price["ID"]."}', '$menuID', '$inputID')",
);
$result["sku_price"]["MENU"][] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_MAX_PRICE")." ".$price["NAME"],
"ONCLICK" => "$action_function('{=max this.catalog.sku.price.".$price["ID"]."}', '$menuID', '$inputID')",
);
}
}
}
$result["catalog"] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_CATALOG"),
"MENU" => array(
array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_CATALOG_WEIGHT"),
"ONCLICK" => "$action_function('{=this.catalog.weight}', '$menuID', '$inputID')",
),
array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_CATALOG_MEASURE"),
"ONCLICK" => "$action_function('{=this.catalog.measure}', '$menuID', '$inputID')",
),
),
);
$result["price"] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_PRICE"),
"MENU" => array(),
);
$rsPrice = CCatalogGroup::GetListEx(array("SORT"=>"ASC"), array(), false, false, array("ID", "NAME"));
while ($price = $rsPrice->Fetch())
{
if (preg_match("/^[a-zA-Z0-9]+\$/", $price["NAME"]))
$result["price"]["MENU"][] = array(
"TEXT" => $price["NAME"],
"ONCLICK" => "$action_function('{=this.catalog.price.".$price["NAME"]."}', '$menuID', '$inputID')",
);
else
$result["price"]["MENU"][] = array(
"TEXT" => $price["NAME"],
"ONCLICK" => "$action_function('{=this.catalog.price.".$price["ID"]."}', '$menuID', '$inputID')",
);
}
$result["store"] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_STORE"),
"MENU" => array(),
);
$rsStore = CCatalogStore::GetList();
while ($store = $rsStore->Fetch())
{
$result["store"]["MENU"][] = array(
"TEXT" => $store["TITLE"],
"ONCLICK" => "$action_function('{=catalog.store.".$store["ID"].".name}', '$menuID', '$inputID')",
);
}
}
$result["misc"] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_MISC"),
"MENU" => array(),
);
$result["misc"]["MENU"][] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_SECTIONS_PATH"),
"ONCLICK" => "$action_function('{=concat this.sections.name \" / \"}', '$menuID', '$inputID')",
);
if (\Freetrix\Main\Loader::includeModule('catalog'))
{
$result["misc"]["MENU"][] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_STORE_LIST"),
"ONCLICK" => "$action_function('{=concat catalog.store \", \"}', '$menuID', '$inputID')",
);
}
$r = array();
foreach($result as $category)
{
if (!empty($category) && !empty($category["MENU"]))
{
$r[] = $category;
}
}
return $r;
}
示例15: array
if (isset(${"CAT_USER_GROUP_ID_" . $arGroup["ID"]}) && ${"CAT_USER_GROUP_ID_" . $arGroup["ID"]} == "Y") {
if (IntVal(${"CAT_ACCESS_LENGTH_" . $arGroup["ID"]}) != IntVal($arCurProductGroups[$arGroup["ID"]]["ACCESS_LENGTH"]) || ${"CAT_ACCESS_LENGTH_TYPE_" . $arGroup["ID"]} != $arCurProductGroups[$arGroup["ID"]]["ACCESS_LENGTH_TYPE"]) {
$arCatalogFields = array("ACCESS_LENGTH" => IntVal(${"CAT_ACCESS_LENGTH_" . $arGroup["ID"]}), "ACCESS_LENGTH_TYPE" => ${"CAT_ACCESS_LENGTH_TYPE_" . $arGroup["ID"]});
CCatalogProductGroups::Update($arCurProductGroups[$arGroup["ID"]]["ID"], $arCatalogFields);
}
} else {
CCatalogProductGroups::Delete($arCurProductGroups[$arGroup["ID"]]["ID"]);
}
} else {
if (isset(${"CAT_USER_GROUP_ID_" . $arGroup["ID"]}) && ${"CAT_USER_GROUP_ID_" . $arGroup["ID"]} == "Y") {
$arCatalogFields = array("PRODUCT_ID" => $ID, "GROUP_ID" => $arGroup["ID"], "ACCESS_LENGTH" => IntVal(${"CAT_ACCESS_LENGTH_" . $arGroup["ID"]}), "ACCESS_LENGTH_TYPE" => ${"CAT_ACCESS_LENGTH_TYPE_" . $arGroup["ID"]});
CCatalogProductGroups::Add($arCatalogFields);
}
}
}
}
if ($USER->CanDoOperation('catalog_store')) {
$rsStores = CCatalogStore::GetList(array(), array('ACTIVE' => 'Y'), false, false, array('ID'));
while ($arStore = $rsStores->Fetch()) {
if (isset($_POST['AR_AMOUNT'][$arStore['ID']])) {
$arStoreProductFields = array("PRODUCT_ID" => $ID, "STORE_ID" => $arStore['ID'], "AMOUNT" => $_POST['AR_AMOUNT'][$arStore['ID']]);
if (!CCatalogStoreProduct::UpdateFromForm($arStoreProductFields)) {
$bVarsFromForm = true;
}
}
}
}
}
}
}
}