View Issue Details

IDProjectCategoryView StatusLast Update
0002731OXID eShop (all versions)4.06. Language and translationspublic2011-04-29 16:24
ReporterHelmut L. 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.5.0_beta4 
Target VersionFixed in Version4.5.0 revision 34568 
Summary0002731: long description for articles in additional languages isalways saved in main table
DescriptionIf you have an article with a long description and copy it to a language not in the main table, it is still tried to insert it into the main table.
Here the entries in all language tables of oxartextends should be created first, like it is done in oxarticles. Afterwards the oxlongdesc field in the correct table should be updated.
Additional InformationEnterprise Edition
/core/oxarticle.php, line 3049 - 3052

Added is a patch file for /svnee/branches/features/EE/eshop/core/oxarticle.php, revision 1852
TagsNo tags attached.
Theme
BrowserAll
PHP Versionany
Database Versionany

Activities

Helmut L.

2011-04-08 14:21

reporter  

patch.txt (1,493 bytes)
### Eclipse Workspace Patch 1.0
#P nailart
Index: core/oxarticle.php
===================================================================
--- core/oxarticle.php	(revision 1852)
+++ core/oxarticle.php	(working copy)
@@ -3046,10 +3046,17 @@
             $blSave = $blSave && !$this->isDerived() && $this->canUpdateField( "oxlongdesc" );
 
         if ( $blSave ) {
+            foreach (oxNew('oxDbMetaDataHandler')->getAllMultiTables('oxartextends') as $sTable) {
+                $sLongDescSQL = 'insert ignore into ' . $sTable . ' (' . $sTable . ".oxid)
+                                 values ('".$this->getId()."')";
+                oxDb::getDb()->execute( $sLongDescSQL );
+            }
+
+            $sLangTable = getLangTableName('oxartextends', $this->getLanguage());
             $sLangField = oxLang::getInstance()->getLanguageTag( (int) $this->getLanguage() );
-            $sLongDescSQL = "insert into oxartextends (oxartextends.oxid, oxartextends.oxlongdesc{$sLangField})
-                             values ('".$this->getId()."', ?) on duplicate key update oxartextends.oxlongdesc{$sLangField} = ? ";
-            oxDb::getDb()->execute( $sLongDescSQL, array( $sValue, $sValue ) );
+            $sLongDescSQL = "update " . $sLangTable . " set " . $sLangTable . ".oxlongdesc{$sLangField} = ?
+                             where " . $sLangTable . ".oxid = '".$this->getId()."'";
+            oxDb::getDb()->execute( $sLongDescSQL, array( $sValue ) );
         }
     }
 
patch.txt (1,493 bytes)

Helmut L.

2011-04-08 14:37

reporter  

patch_main_table.txt (1,568 bytes)
### Eclipse Workspace Patch 1.0
#P EE 4.5
Index: core/oxarticle.php
===================================================================
--- core/oxarticle.php	(revision 1852)
+++ core/oxarticle.php	(working copy)
@@ -3046,10 +3046,19 @@
             $blSave = $blSave && !$this->isDerived() && $this->canUpdateField( "oxlongdesc" );
 
         if ( $blSave ) {
+            $aTables = oxNew('oxDbMetaDataHandler')->getAllMultiTables('oxartextends');
+            $aTables[] = 'oxartextends';
+            foreach ($aTables as $sTable) {
+                $sLongDescSQL = 'insert ignore into ' . $sTable . ' (' . $sTable . ".oxid)
+                                 values ('".$this->getId()."')";
+                oxDb::getDb()->execute( $sLongDescSQL );
+            }
+
+            $sLangTable = getLangTableName('oxartextends', $this->getLanguage());
             $sLangField = oxLang::getInstance()->getLanguageTag( (int) $this->getLanguage() );
-            $sLongDescSQL = "insert into oxartextends (oxartextends.oxid, oxartextends.oxlongdesc{$sLangField})
-                             values ('".$this->getId()."', ?) on duplicate key update oxartextends.oxlongdesc{$sLangField} = ? ";
-            oxDb::getDb()->execute( $sLongDescSQL, array( $sValue, $sValue ) );
+            $sLongDescSQL = "update " . $sLangTable . " set " . $sLangTable . ".oxlongdesc{$sLangField} = ?
+                             where " . $sLangTable . ".oxid = '".$this->getId()."'";
+            oxDb::getDb()->execute( $sLongDescSQL, array( $sValue ) );
         }
     }
 
patch_main_table.txt (1,568 bytes)

Helmut L.

2011-04-08 14:37

reporter   ~0004344

Just realized my solution was not adding an entry in the main table. Here is the corrected patch file.

birute_meilutyte

2011-04-29 16:24

reporter   ~0004426

this problem was fixed for final 4.5.0 version