Projekt

Allgemein

Profil

Aktionen

GX-Bug #43144

geschlossen

Fehler in "xtc_get_product_path.inc.php" (GX-2.5)

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

Status:
Erledigt
Priorität:
Normal
Zugewiesen an:
-
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 von GX-Entwicklung - GX-Bug #43143: Fehler in "xtc_get_product_path.inc.php"ErledigtMario Blokland

Aktionen
Aktionen

Auch abrufbar als: Atom PDF