@@ -906,6 +906,8 @@ public function sCreateRewriteTableArticles($lastUpdate, $limit = 1000)
906
906
)
907
907
);
908
908
909
+ $ result = $ this ->mapArticleTranslationObjectData ($ result );
910
+
909
911
$ result = Shopware ()->Events ()->filter (
910
912
'Shopware_Modules_RewriteTable_sCreateRewriteTableArticles_filterArticles ' ,
911
913
$ result ,
@@ -947,9 +949,8 @@ public function sCreateRewriteTableArticles($lastUpdate, $limit = 1000)
947
949
public function getSeoArticleQuery ()
948
950
{
949
951
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,
953
954
at.attr3, at.attr4, at.attr5, at.attr6, at.attr7, at.attr8, at.attr9,
954
955
at.attr10,at.attr11, at.attr12, at.attr13, at.attr14, at.attr15, at.attr16,
955
956
at.attr17, at.attr18, at.attr19, at.attr20
@@ -968,9 +969,10 @@ public function getSeoArticleQuery()
968
969
LEFT JOIN s_articles_attributes at
969
970
ON at.articledetailsID=d.id
970
971
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'
974
976
975
977
LEFT JOIN s_articles_supplier s
976
978
ON s.id=a.supplierID
@@ -1274,4 +1276,39 @@ private function insertStaticPageUrls($offset, $limit)
1274
1276
$ this ->sInsertUrl ($ org_path , $ path );
1275
1277
}
1276
1278
}
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
+ }
1277
1314
}
0 commit comments