Suche |
Artikelattribute Reihenfolge sortierenAus xtc-wikiBei dem Produkten sind alle Attribute durcheinander...also zuerst Farbe, dann Größe, dann Motiv...und ich möchte das gerne sortieren...kann mir wer helfen??? Antwort von Hendrik (19.07.2009) Die Optionsnamen werden nach Name sortiert. Wenn du den Optionen entsprechende Namen gibst wird entsprechend sortiert. Farbe -> 10_Farbe Motiv -> 11_Motiv Nun ist das Präfix allerdings unschön in der Darstellung. Durch u.g. Patches wird das Präfix von der Darstellung im Frontend ausgefiltert. Beachte. Die Sortierung ist alphanumerisch, nicht numerisch. D.h. "120_" kommt vor "12_". Dem begegnest du indem du darauf achtest stets gleich viele Stellen für die Nummerierung zu verwenden. z.B. "001_", "002_", usw. includes/modules/product_attributes.php
---------------------------------------
Finde:
$selected = 0;
$products_options_array = array ();
Füge an:
$products_options_name['products_options_name']=preg_replace('/^[0-9]*_(.*)/','$1', $products_options_name['products_options_name']);
shopping_cart.php
-----------------
Finde:
$attributes_values = xtc_db_fetch_array($attributes);
Füge an:
$attributes_values['products_options_name']=preg_replace('/^[0-9]*_(.*)/','$1', $attributes_values['products_options_name']);
checkout_confirmation.php
-------------------------
Finde:
for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
Füge an:
$order->products[$i]['attributes'][$j]['option']=preg_replace('/^[0-9]*_(.*)/','$1', $order->products[$i]['attributes'][$j]['option'] );
checkout_process.php
--------------------
Finde:
$attributes_values = xtc_db_fetch_array($attributes);
Füge an:
$attributes_values['products_options_name']=preg_replace('/^[0-9]*_(.*)/','$1', $attributes_values['products_options_name']);
Alternativlösung von Anotherone Ich habe es so gelöst, das die Sortierung der Attribute verwendet werden, in dem jede Optionsgruppe ihren eigenen Nummernkreis verwendet, z.B. die erste Option 1-10, die zweite 11-20 (oder wenn nötig 100-199) usw. Vorteil dabei ist, das man dies pro Artikel individuell steuern kann. Dann noch in der includes/modules/products_attributes.php, ca. Zeile 27 folgendes suchen $products_options_name_query = xtDBquery("select distinct popt.products_options_id, popt.products_options_name from ".TABLE_PRODUCTS_OPTIONS." popt, ".TABLE_PRODUCTS_ATTRIBUTES." patrib where patrib.products_id='".$product->data['products_id']."' and patrib.options_id = popt.products_options_id and popt.language_id = '".(int) $_SESSION['languages_id']."' order by popt.products_options_name");
$products_options_name_query = xtDBquery("select distinct popt.products_options_id, popt.products_options_name from ".TABLE_PRODUCTS_OPTIONS." popt, ".TABLE_PRODUCTS_ATTRIBUTES." patrib where patrib.products_id='".$product->data['products_id']."' and patrib.options_id = popt.products_options_id and popt.language_id = '".(int) $_SESSION['languages_id']."' order by patrib.sortorder");
|
![[Hauptseite]](/skins/common/images/wiki.png)