Index: branches/RC/core/units/general/cat_dbitem.php =================================================================== diff -u -N -r11368 -r11705 --- branches/RC/core/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 11368) +++ branches/RC/core/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 11705) @@ -174,24 +174,26 @@ // $this->NameCopy(); if (!isset($cat_id)) $cat_id = $this->Application->GetVar('m_cat_id'); // check if the product already exists in destination cat - $query = 'SELECT PrimaryCat FROM '.TABLE_PREFIX.'CategoryItems - WHERE CategoryId = '.$cat_id.' AND ItemResourceId = '.$this->GetDBField('ResourceId'); + $sql = 'SELECT PrimaryCat + FROM '.TABLE_PREFIX.'CategoryItems + WHERE CategoryId = '.$cat_id.' AND ItemResourceId = '.$this->GetDBField('ResourceId'); // if it's not found is_primary will be FALSE, if it's found but not primary it will be int 0 - $is_primary = $this->Conn->GetOne($query); + $is_primary = $this->Conn->GetOne($sql); $exists = $is_primary !== false; if ($exists) { // if the Product already exists in destination category if ($is_primary) return; // do nothing when we paste to primary // if it's not primary - delete it from destination category, // as we will move it from current primary below - $query = 'DELETE FROM '.TABLE_PREFIX.'CategoryItems - WHERE ItemResourceId = '.$this->GetDBField('ResourceId').' AND CategoryId = '.$cat_id; - $this->Conn->Query($query); + $sql = 'DELETE FROM '.TABLE_PREFIX.'CategoryItems + WHERE ItemResourceId = '.$this->GetDBField('ResourceId').' AND CategoryId = '.$cat_id; + $this->Conn->Query($sql); } - $query = 'UPDATE '.TABLE_PREFIX.'CategoryItems SET CategoryId = '.$cat_id. - ' WHERE ItemResourceId = '.$this->GetDBField('ResourceId').' AND PrimaryCat = 1'; - $this->Conn->Query($query); + $sql = 'UPDATE '.TABLE_PREFIX.'CategoryItems + SET CategoryId = '.$cat_id.' + WHERE ItemResourceId = '.$this->GetDBField('ResourceId').' AND PrimaryCat = 1'; + $this->Conn->Query($sql); $this->Update(); }