@@ -906,6 +906,8 @@ public function sCreateRewriteTableArticles($lastUpdate, $limit = 1000)
906906 )
907907 );
908908
909+ $ result = $ this ->mapArticleTranslationObjectData ($ result );
910+
909911 $ result = Shopware ()->Events ()->filter (
910912 'Shopware_Modules_RewriteTable_sCreateRewriteTableArticles_filterArticles ' ,
911913 $ result ,
@@ -947,9 +949,8 @@ public function sCreateRewriteTableArticles($lastUpdate, $limit = 1000)
947949 public function getSeoArticleQuery ()
948950 {
949951 return "
950- SELECT a.*, IF(atr.name IS NULL OR atr.name='', a.name, atr.name) as name,
951- d.ordernumber, d.suppliernumber, s.name as supplier, datum as date,
952- d.releasedate, changetime as changed, metaTitle, at.attr1, at.attr2,
952+ SELECT a.*, d.ordernumber, d.suppliernumber, s.name as supplier, datum as date,
953+ d.releasedate, changetime as changed, metaTitle, ct.objectdata, at.attr1, at.attr2,
953954 at.attr3, at.attr4, at.attr5, at.attr6, at.attr7, at.attr8, at.attr9,
954955 at.attr10,at.attr11, at.attr12, at.attr13, at.attr14, at.attr15, at.attr16,
955956 at.attr17, at.attr18, at.attr19, at.attr20
@@ -968,9 +969,10 @@ public function getSeoArticleQuery()
968969 LEFT JOIN s_articles_attributes at
969970 ON at.articledetailsID=d.id
970971
971- LEFT JOIN s_articles_translations atr
972- ON atr.articleID=a.id
973- AND atr.languageID=?
972+ LEFT JOIN s_core_translations ct
973+ ON ct.objectkey=a.id
974+ AND ct.objectlanguage=?
975+ AND ct.objecttype='article'
974976
975977 LEFT JOIN s_articles_supplier s
976978 ON s.id=a.supplierID
@@ -1274,4 +1276,39 @@ private function insertStaticPageUrls($offset, $limit)
12741276 $ this ->sInsertUrl ($ org_path , $ path );
12751277 }
12761278 }
1279+
1280+ /**
1281+ * Maps the translation of the objectdata from the s_core_translations in the article array
1282+ * @param array $articles
1283+ * @return mixed
1284+ */
1285+ public function mapArticleTranslationObjectData ($ articles )
1286+ {
1287+ foreach ($ articles as &$ article ) {
1288+ if (empty ($ article ['objectdata ' ])) {
1289+ unset($ article ['objectdata ' ]);
1290+ continue ;
1291+ }
1292+
1293+ $ data = unserialize ($ article ['objectdata ' ]);
1294+ if (!$ data ) {
1295+ continue ;
1296+ }
1297+
1298+ $ data ['name ' ] = (!empty ($ data ['txtArtikel ' ])) ? $ data ['txtArtikel ' ] : $ article ['name ' ];
1299+ $ data ['description_long ' ] = (!empty ($ data ['txtlangbeschreibung ' ])) ? $ data ['txtlangbeschreibung ' ] : $ article ['description_long ' ];
1300+ $ data ['description ' ] = (!empty ($ data ['txtshortdescription ' ])) ? $ data ['txtshortdescription ' ] : $ article ['description ' ];
1301+ $ data ['keywords ' ] = (!empty ($ data ['txtkeywords ' ])) ? $ data ['txtkeywords ' ] : $ article ['keykwords ' ];
1302+
1303+ unset($ article ['objectdata ' ]);
1304+ unset($ data ['txtArtikel ' ]);
1305+ unset($ data ['txtlangbeschreibung ' ]);
1306+ unset($ data ['txtlangbeschreibung ' ]);
1307+ unset($ data ['txtkeywords ' ]);
1308+
1309+ $ article = array_merge ($ article , $ data );
1310+ }
1311+
1312+ return $ articles ;
1313+ }
12771314}
0 commit comments