本文整理汇总了PHP中CCatalogStore::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogStore::Add方法的具体用法?PHP CCatalogStore::Add怎么用?PHP CCatalogStore::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogStore
的用法示例。
在下文中一共展示了CCatalogStore::Add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: array
$value = (isset($_POST['allow_negative_amount']) && (string)$_POST['allow_negative_amount'] === 'Y' ? 'Y' : 'N');
Option::set('catalog', 'allow_negative_amount', $value, '');
}
$strUseStoreControlBeforeSubmit = (string)Option::get('catalog', 'default_use_store_control');
$strUseStoreControl = (isset($_POST['use_store_control']) && (string)$_POST['use_store_control'] === 'Y' ? 'Y' : 'N');
if ($strUseStoreControlBeforeSubmit != $strUseStoreControl)
{
if ($strUseStoreControl == 'Y')
{
$countStores = (int)CCatalogStore::GetList(array(), array("ACTIVE" => 'Y'), array());
if ($countStores <= 0)
{
$arStoreFields = array("TITLE" => Loc::getMessage("CAT_STORE_NAME"), "ADDRESS" => " ");
$newStoreId = CCatalogStore::Add($arStoreFields);
if ($newStoreId)
{
CCatalogDocs::synchronizeStockQuantity($newStoreId);
}
else
{
$strWarning .= Loc::getMessage("CAT_STORE_ACTIVE_ERROR");
$strUseStoreControl = 'N';
}
}
else
{
$strWarning .= Loc::getMessage("CAT_STORE_SYNCHRONIZE_WARNING");
}
}
示例3: ImportStores
function ImportStores($XML_STORES_PARENT)
{
$ID = 0;
$arXMLStores = $this->_xml_file->GetAllChildrenArray($XML_STORES_PARENT);
foreach ($arXMLStores as $arXMLStore) {
$arStore = array("TITLE" => $arXMLStore[$this->mess["IBLOCK_XML2_NAME"]], "XML_ID" => $arXMLStore[$this->mess["IBLOCK_XML2_ID"]]);
if (isset($arXMLStore[$this->mess["IBLOCK_XML2_STORE_ADDRESS"]])) {
$arStore["ADDRESS"] = $arXMLStore[$this->mess["IBLOCK_XML2_STORE_ADDRESS"]][$this->mess["IBLOCK_XML2_VIEW"]];
}
if (isset($arXMLStore[$this->mess["IBLOCK_XML2_STORE_DESCRIPTION"]])) {
$arStore["DESCRIPTION"] = $arXMLStore[$this->mess["IBLOCK_XML2_STORE_DESCRIPTION"]];
}
if (isset($arXMLStore[$this->mess["IBLOCK_XML2_STORE_CONTACTS"]]) && is_array($arXMLStore[$this->mess["IBLOCK_XML2_STORE_CONTACTS"]])) {
$storeContact = array();
foreach ($arXMLStore[$this->mess["IBLOCK_XML2_STORE_CONTACTS"]] as $arContact) {
if (is_array($arContact)) {
$storeContact[] = $arContact[$this->mess["IBLOCK_XML2_VALUE"]];
}
}
if ($storeContact) {
$arStore["PHONE"] = implode(", ", $storeContact);
}
}
$rsStore = CCatalogStore::GetList(array(), array("XML_ID" => $arXMLStore[$this->mess["IBLOCK_XML2_ID"]]));
$arIDStore = $rsStore->Fetch();
if (!$arIDStore) {
$ID = CCatalogStore::Add($arStore);
} else {
$ID = CCatalogStore::Update($arIDStore["ID"], $arStore);
}
}
if (!$ID) {
return false;
}
return true;
}
示例4: elseif
} elseif (strlen($isImage) > 0) {
$errorMessage .= $isImage . "<br>";
}
$arFields = array("TITLE" => isset($_POST['TITLE']) ? $_POST['TITLE'] : '', "SORT" => isset($_POST['CSTORE_SORT']) ? (int) $_POST['CSTORE_SORT'] : 0, "ACTIVE" => isset($_POST['ACTIVE']) && $_POST['ACTIVE'] == 'Y' ? 'Y' : 'N', "ADDRESS" => isset($_POST['ADDRESS']) ? $_POST['ADDRESS'] : '', "DESCRIPTION" => isset($_POST['DESCRIPTION']) ? $_POST['DESCRIPTION'] : '', "GPS_N" => isset($_POST['GPS_N']) ? $_POST['GPS_N'] : '', "GPS_S" => isset($_POST['GPS_S']) ? $_POST['GPS_S'] : '', "PHONE" => isset($_POST['PHONE']) ? $_POST['PHONE'] : '', "SCHEDULE" => isset($_POST['SCHEDULE']) ? $_POST['SCHEDULE'] : '', "XML_ID" => isset($_POST['XML_ID']) ? $_POST['XML_ID'] : '', "USER_ID" => $userId, "MODIFIED_BY" => $userId, "EMAIL" => isset($_POST["EMAIL"]) ? $_POST["EMAIL"] : '', "ISSUING_CENTER" => $ISSUING_CENTER, "SHIPPING_CENTER" => $SHIPPING_CENTER, "SITE_ID" => $_POST["SITE_ID"]);
$USER_FIELD_MANAGER->EditFormAddFields($entityId, $arFields);
if (intval($fileId) > 0) {
$arFields["IMAGE_ID"] = intval($fileId);
} elseif ($fileId === "NULL") {
$arFields["IMAGE_ID"] = "null";
}
$DB->StartTransaction();
if ($errorMessage == '') {
if ($id > 0) {
$res = CCatalogStore::Update($id, $arFields);
} else {
$res = CCatalogStore::Add($arFields);
if ($res) {
$id = (int) $res;
}
}
if (!$res) {
if ($ex = $APPLICATION->GetException()) {
$errorMessage .= $ex->GetString() . "<br>";
} else {
$errorMessage .= GetMessage('STORE_SAVE_ERROR') . '<br>';
}
} else {
$ufUpdated = $USER_FIELD_MANAGER->Update($entityId, $id, $arFields);
}
}
if ($errorMessage == '') {
示例5: ImportStores
function ImportStores($XML_STORES_PARENT)
{
$this->next_step["XML_STORES_PARENT"] = $XML_STORES_PARENT;
$ID = 0;
$arXMLStores = $this->_xml_file->GetAllChildrenArray($XML_STORES_PARENT);
foreach($arXMLStores as $arXMLStore)
{
$storeTitle = $arXMLStore[GetMessage("IBLOCK_XML2_NAME")];
$storeAddress = (isset($arXMLStore[GetMessage("IBLOCK_XML2_STORE_ADDRESS")])) ? $arXMLStore[GetMessage("IBLOCK_XML2_STORE_ADDRESS")] : "";
$storeDescription = (isset($arXMLStore[GetMessage("IBLOCK_XML2_STORE_DESCRIPTION")])) ? $arXMLStore[GetMessage("IBLOCK_XML2_STORE_DESCRIPTION")] : "";
$storeContacts = (isset($arXMLStore[GetMessage("IBLOCK_XML2_STORE_CONTACTS")])) ? $arXMLStore[GetMessage("IBLOCK_XML2_STORE_CONTACTS")] : "";
$rsStore = CCatalogStore::GetList(array(), array("XML_ID" => $arXMLStore[GetMessage("IBLOCK_XML2_ID")]));
$arStore = array(
"TITLE" => $storeTitle,
"XML_ID" => $arXMLStore[GetMessage("IBLOCK_XML2_ID")],
"ADDRESS" => $storeAddress,
"DESCRIPTION" => $storeDescription,
"PHONE" => $storeContacts,
);
$arIDStore = $rsStore->Fetch();
if(!$arIDStore)
{
$ID = CCatalogStore::Add($arStore);
}
else
{
$ID = CCatalogStore::Update($arIDStore["ID"],$arStore);
}
}
if(!$ID)
return false;
return true;
}
示例6: array
$arFields = array("TITLE" => $TITLE, "ACTIVE" => $ACTIVE, "ADDRESS" => $ADDRESS, "DESCRIPTION" => $DESCRIPTION, "GPS_N" => $GPS_N, "GPS_S" => $GPS_S, "PHONE" => $PHONE, "SCHEDULE" => $SCHEDULE, "XML_ID" => $XML_ID, "USER_ID" => $userId, "MODIFIED_BY" => $userId);
if (intval($fileId) > 0) {
$arFields["IMAGE_ID"] = intval($fileId);
} else {
$arFields["IMAGE_ID"] = "null";
}
$DB->StartTransaction();
if (strlen($errorMessage) == 0 && $ID > 0 && ($res = CCatalogStore::Update($ID, $arFields))) {
$ID = $res;
$DB->Commit();
if (strlen($_REQUEST["apply"]) <= 0) {
LocalRedirect("/bitrix/admin/cat_store_list.php?lang=" . LANG . "&" . GetFilterParams("filter_", false));
} else {
LocalRedirect("/bitrix/admin/cat_store_edit.php?lang=" . LANG . "&ID=" . $ID . "&" . GetFilterParams("filter_", false));
}
} elseif (strlen($errorMessage) == 0 && $ID == 0 && ($res = CCatalogStore::Add($arFields))) {
$ID = $res;
$DB->Commit();
if (strlen($_REQUEST["apply"]) <= 0) {
LocalRedirect("/bitrix/admin/cat_store_list.php?lang=" . LANG . "&" . GetFilterParams("filter_", false));
} else {
LocalRedirect("/bitrix/admin/cat_store_edit.php?lang=" . LANG . "&ID=" . $ID . "&" . GetFilterParams("filter_", false));
}
} else {
if ($ex = $APPLICATION->GetException()) {
$errorMessage .= $ex->GetString() . "<br>";
}
$bVarsFromForm = true;
$DB->Rollback();
}
}
示例7: ImportStores
public function ImportStores($XML_STORES_PARENT)
{
$this->next_step["XML_STORES_PARENT"] = $XML_STORES_PARENT;
$ID = 0;
$storeContact = array();
$arXMLStores = $this->_xml_file->GetAllChildrenArray($XML_STORES_PARENT);
foreach($arXMLStores as $arXMLStore)
{
$arStore = array(
"TITLE" => $arXMLStore[GetMessage("IBLOCK_XML2_NAME")],
"XML_ID" => $arXMLStore[GetMessage("IBLOCK_XML2_ID")],
);
if(isset($arXMLStore[GetMessage("IBLOCK_XML2_STORE_ADDRESS")]))
$arStore["ADDRESS"] = $arXMLStore[GetMessage("IBLOCK_XML2_STORE_ADDRESS")][GetMessage("IBLOCK_XML2_VIEW")];
if(isset($arXMLStore[GetMessage("IBLOCK_XML2_STORE_DESCRIPTION")]))
$arStore["DESCRIPTION"] = $arXMLStore[GetMessage("IBLOCK_XML2_STORE_DESCRIPTION")];
if(isset($arXMLStore[GetMessage("IBLOCK_XML2_STORE_CONTACTS")]) && is_array($arXMLStore[GetMessage("IBLOCK_XML2_STORE_CONTACTS")]))
{
foreach($arXMLStore[GetMessage("IBLOCK_XML2_STORE_CONTACTS")] as $arContact)
{
if(is_array($arContact))
{
$storeContact[] = $arContact[GetMessage("IBLOCK_XML2_VALUE")];
}
}
}
if(!empty($storeContact))
$arStore["PHONE"] = implode(", ", $storeContact);
$rsStore = CCatalogStore::GetList(array(), array("XML_ID" => $arXMLStore[GetMessage("IBLOCK_XML2_ID")]));
$arIDStore = $rsStore->Fetch();
if(!$arIDStore)
{
$ID = CCatalogStore::Add($arStore);
}
else
{
$ID = CCatalogStore::Update($arIDStore["ID"], $arStore);
}
}
if(!$ID)
return false;
return true;
}
示例8: intval
"EMAIL" => $_POST["EMAIL"],
"ISSUING_CENTER" => $ISSUING_CENTER,
"SHIPPING_CENTER" => $SHIPPING_CENTER,
"SITE_ID" => $_POST["SITE_ID"]
);
$USER_FIELD_MANAGER->EditFormAddFields($entityId, $arFields);
if (intval($fileId) > 0)
$arFields["IMAGE_ID"] = intval($fileId);
elseif ($fileId === "NULL")
$arFields["IMAGE_ID"] = "null";
$DB->StartTransaction();
if (strlen($errorMessage) == 0 && ($res = CCatalogStore::Update($id, $arFields) || ($id == 0 && $res = CCatalogStore::Add($arFields))))
{
$id = $res;
$ufUpdated = $USER_FIELD_MANAGER->Update($entityId, $id, $arFields);
if ($ufUpdated)
$DB->Query("UPDATE b_catalog_store SET DATE_MODIFY = ".$DB->CurrentTimeFunction()." WHERE ID = ".$id);
$DB->Commit();
if (strlen($_REQUEST["apply"]) <= 0)
LocalRedirect("/bitrix/admin/cat_store_list.php?lang=".LANG."&".GetFilterParams("filter_", false));
else
LocalRedirect("/bitrix/admin/cat_store_edit.php?lang=".LANG."&ID=".$id."&".GetFilterParams("filter_", false));
}
else