Projekt

Allgemein

Profil

Aktionen

GX-Bug #43143

geschlossen

Fehler in "xtc_get_product_path.inc.php"

Von Torben Wark vor mehr als 8 Jahren hinzugefügt. Vor 4 Monaten aktualisiert.

Status:
Erledigt
Priorität:
Normal
Zugewiesen an:
Mario Blokland
Kategorie:
Core
Zielversion:
% erledigt:

100%

Geschätzter Aufwand:
Steps to reproduce:
Betroffene Versionen:
2.0.15.4, 2.0.16.0, 2.0.16.0 beta1, 2.0.16.1, 2.0.17.0, 2.0.17.0 beta1, 2.0.17.1, 2.0.18.0, 2.0.18.0 beta1, 2.1.0.0, 2.1.0.0 beta1, 2.1.0.0 beta2, 2.1.0.0 beta3, 2.1.0.1, 2.1.0.2, 2.1.0.3, 2.1.0.4, 2.1.0.5, 2.1.0.6, 2.1.0.7, 2.1.1.0, 2.1.1.0 beta1, 2.1.1.1, 2.1.1.2, 2.1.1.3, 2.1.2.0, 2.1.2.0 beta1, 2.1.2.1, 2.1.2.2, 2.1.3.0, 2.1.3.0 beta1, 2.1.3.1, 2.1.3.2, 2.1.3.3, 2.1.4.0, 2.1.4.0 beta1, 2.1.4.1, 2.1.4.2, 2.1.5.0, 2.1.5.0 beta1, 2.1.5.1, 2.1.5.2, 2.1.6.0, 2.1.6.0 beta1, 2.2.0.0, 2.2.0.0 beta1, 2.2.1.0, 2.2.1.0 beta1, 2.2.1.1, 2.2.1.2, 2.2.1.3, 2.2.1.4, 2.2.2.0, 2.2.2.0 beta1, 2.2.2.1, 2.3.1.0, 2.3.1.0 beta1, 2.3.1.0 beta2, 2.3.1.1, 2.3.1.2, 2.3.1.3, 2.3.1.4, 2.3.1.5, 2.3.1.6, 2.3.1.7, 2.3.2.0, 2.3.2.0 beta1, 2.3.2.1, 2.3.3.0, 2.3.3.1, 2.3.3.2, 2.4.0.0, 2.4.0.0 beta1, 2.4.0.1, 2.4.1.0, 2.4.1.0 beta1, 2.4.1.1, 2.4.1.2, 2.5.1.0, 2.5.1.0 beta1, 2.5.1.1, 2.5.1.2
Release Notes Langtext:

Beschreibung

Meldung aus dem Forum:

In Gambio wird der (erste) Kategorienpfad eines Artikels aus der "products_id" mit dieser Routine ermittelt:

function xtc_get_product_path($products_id) {
    $cPath = '';

    $category_query = "select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int)$products_id . "' and p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id != 0 limit 1";
    $category_query  = xtDBquery($category_query);
    if (xtc_db_num_rows($category_query,true)) {
      $category = xtc_db_fetch_array($category_query);

      $categories = array();
      xtc_get_parent_categories($categories, $category['categories_id']);

      $categories = array_reverse($categories);

      $cPath = implode('_', $categories);

      if (xtc_not_null($cPath)) $cPath .= '_';
      $cPath .= $category['categories_id'];
    }

    return $cPath;
  }  

Dabei wird allerdings nicht berücksichtigt, ob diese "Heimat"-Kategorie den "categories_status" "1" hat, so dass u.U. eine inaktive Kategorie als "Heimat"-Kategorie ermittelt wird.

Die folgende Version löst das Problem:

function xtc_get_product_path($products_id) {
    $cPath = '';
    $category_query = "
    SELECT DISTINCT
      p2c.categories_id
    FROM
      " . TABLE_PRODUCTS . " p,
      " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c,
      " . TABLE_CATEGORIES . " c
    WHERE
      p.products_id = '" . (int)$products_id . "' AND
      p.products_status = '1' AND
      p.products_id = p2c.products_id AND
      c.categories_id= p2c.categories_id AND
      p2c.categories_id != 0 AND
      c.categories_status=1
    LIMIT 1";
    $category_query  = xtDBquery($category_query);
    if (xtc_db_num_rows($category_query,true))
    {
      $category = xtc_db_fetch_array($category_query);
      $categories = array();
      xtc_get_parent_categories($categories, $category['categories_id']);
      $categories = array_reverse($categories);
      $cPath = implode('_', $categories);
      if (xtc_not_null($cPath)) $cPath .= '_';
      $cPath .= $category['categories_id'];
    }
    return $cPath;
  }  


Zugehörige Tickets

Kopiert nach GX-Entwicklung - GX-Bug #43144: Fehler in "xtc_get_product_path.inc.php" (GX-2.5)Erledigt

Aktionen
Aktionen #1

Von Torben Wark vor mehr als 8 Jahren aktualisiert

  • Kopiert nach GX-Bug #43144: Fehler in "xtc_get_product_path.inc.php" (GX-2.5) wurde hinzugefügt
Aktionen #2

Von Till Tepelmann vor mehr als 8 Jahren aktualisiert

  • Zielversion wurde von 59 zu 2.4.2.0 beta1 geändert
Aktionen #3

Von Daniel Wu vor mehr als 8 Jahren aktualisiert

  • Zielversion wurde von 2.4.2.0 beta1 zu 59 geändert
Aktionen #4

Von Till Tepelmann vor mehr als 8 Jahren aktualisiert

  • Zielversion wurde von 59 zu 2.4.3.0 beta1 geändert
Aktionen #5

Von Waldemar Willer vor mehr als 8 Jahren aktualisiert

  • Status wurde von Gemeldet zu In Bearbeitung geändert
  • Zugewiesen an wurde auf Waldemar Willer gesetzt
Aktionen #6

Von Waldemar Willer vor mehr als 8 Jahren aktualisiert

  • Status wurde von In Bearbeitung zu Testing geändert
  • Zugewiesen an wurde von Waldemar Willer zu Mario Blokland geändert
Aktionen #7

Von Mario Blokland vor mehr als 8 Jahren aktualisiert

  • Status wurde von Testing zu Erledigt geändert
  • % erledigt wurde von 0 zu 100 geändert
Aktionen #8

Von Waldemar Willer vor mehr als 8 Jahren aktualisiert

  • Status wurde von Erledigt zu Testing geändert
Aktionen #9

Von Mario Blokland vor mehr als 8 Jahren aktualisiert

  • Status wurde von Testing zu Erledigt geändert
Aktionen #10

Von Till Tepelmann vor 4 Monaten aktualisiert

  • Tags Forum wurde gelöscht
Aktionen

Auch abrufbar als: Atom PDF