Esempio n. 1
0
 public static function Update($lang, $arFields)
 {
     global $DB;
     $DB->Query("SELECT * FROM `" . self::$table . "` WHERE `SID` = '" . sSql($lang) . "'");
     if (!$DB->numRows()) {
         return false;
     } else {
         $sql = updSql(self::$table, $arFields) . " WHERE `SID` = '" . sSql($lang) . "';";
         if ($DB->Query($sql)) {
             return true;
         } else {
             dbError($DB->Error());
             return false;
         }
     }
 }
Esempio n. 2
0
 public static function Update($ID, $arFields)
 {
     global $DB;
     $DB->Query("SELECT * FROM `" . self::$table . "` WHERE `ID` = '" . sSql($ID) . "'");
     if (!$DB->numRows()) {
         return false;
     } else {
         $arFieldsTable_1 = array();
         $arFieldsTable_2 = array();
         $tbl_1 = array("ID", "SORT");
         $tbl_2 = array("CATALOG_TYPE_ID", "SID", "NAME", "SECTION_NAME", "ELEMENT_NAME");
         $arFieldsTable_2["CATALOG_TYPE_ID"] = $arFields["ID"];
         foreach ($arFields as $key => $value) {
             if (in_array($key, $tbl_1)) {
                 $arFieldsTable_1[$key] = $value;
             }
             if (in_array($key, $tbl_2)) {
                 $arFieldsTable_2[$key] = $value;
             }
         }
         $sql1 = updSql(self::$table, $arFieldsTable_1) . " WHERE `ID` = '" . sSql($ID) . "';";
         $sql2 = updSql(self::$table_lang, $arFieldsTable_2) . " WHERE `CATALOG_TYPE_ID` = '" . sSql($ID) . "';";
         if ($DB->Query($sql1) and $DB->Query($sql2)) {
             return true;
         } else {
             dbError($DB->Error());
             return false;
         }
     }
 }
Esempio n. 3
0
 /**
  * Обновление осн. св-ва элемента каталога
  * @param int $ID
  * @param string $propertyCODE
  * @param string $propertyValue
  */
 public function setFieldValue($ID, $propertyCODE, $propertyValue)
 {
     global $DB;
     $sql = updSql(self::$table, array($propertyCODE => $propertyValue)) . " WHERE `ID` = '" . intVal($ID) . "';";
     if ($DB->Query($sql)) {
         return true;
     } else {
         dbError($DB->Error());
         return false;
     }
 }
Esempio n. 4
0
 public function setPropertyValue($elementID, $propertyCODE, $propertyValue)
 {
     global $DB;
     $arUpd = array("VALUE" => $propertyValue);
     if (is_numeric($propertyCODE)) {
         $propID = intVal($propertyCODE);
     } else {
         $propID = self::GetPropIDByCODE($propertyCODE);
     }
     $sql_props = updSql(self::$table_props_values, $arUpd) . " WHERE `CATALOG_ELEMENT_ID` = '" . intVal($elementID) . "' AND `CATALOG_PROPERTY_ID` = " . intVal($propID) . ";";
     if ($DB->Query($sql_props)) {
         return true;
     } else {
         dbError($DB->Error());
         return false;
     }
 }