Managed Server
Neuigkeiten
  • Die modified eCommerce Shopsoftware ist kostenlos, aber nicht umsonst.
    Spenden
  • Damit wir die modified eCommerce Shopsoftware auch zukünftig kostenlos anbieten können:
    Spenden
  • Thema: ANLEITUNG: Produkte mit Content kopieren/duplizieren

    timopaul

    • modified Team
    • Beiträge: 371
    • Geschlecht:
    Hallo Community,

    ob es nun ein Bugfix, Update, Feature oder Modul ist, wird sich noch heraus stellen, daher nenne ich es vorerst Anleitung.

    Es geht um das Duplizieren (nicht Verlinken) von Produkten mit eigenem Content aus dem Content-Manager. Dies nutzt ein Kunde in seinem Shop sehr intensiv, nun ist aufgefallen das dieser beim Duplizieren von Produkten vernachlässigt wird. Bisher habe ich nur Beiträge zum Duplizieren von Attributen (vor v1.06) gefunden, daher hier eine kurze Anleitung wie ich das Ganze eingebaut habe:

    Datei: /lang/german/admin/categories.php

    Suche nach Zeile
    Code: PHP  [Auswählen]
    define('TEXT_ATTRIBUTE_COPY_INFO', 'Artikelattribute mitkopieren<br/ >Nur bei Einzelkopie (1 Artikel) empfohlen');

    Füge NACH DIESER ZEILE ein
    Code: PHP  [Auswählen]
    // BOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-13 - duplicate products content
    define('TEXT_CONTENT_COPY', 'Artikel-Content mitkopieren');
    define('TEXT_CONTENT_COPY_INFO', 'Artikel-Content mitkopieren<br/ >Nur bei Einzelkopie (1 Artikel) empfohlen');
    // EOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-13 - duplicate products content

    Datei /admin/includes/classes/categories.php

    Suche nach Zeile
    Code: PHP  [Auswählen]
    } //duplicate_product ends

    Füge VOR DIESER ZEILE ein:
    Code: PHP  [Auswählen]
    // BOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-13 - duplicate products content
    if (isset($_POST['cnt_copy']) && $_POST['cnt_copy'] == 'cnt_copy') {
      $content_copy_stmt = 'SELECT * ' .
                                                    'FROM ' . TABLE_PRODUCTS_CONTENT . ' ' .
                                                    'WHERE products_id = ' . $old_products_id;
      $content_copy_query = xtc_db_query($content_copy_stmt);
      while ($content_copy_data = xtc_db_fetch_array($content_copy_query)) {
            $sql_data_array = $content_copy_data;
            //set attributes data (overrides)
            unset($sql_data_array['content_id']);
            $sql_data_array['products_id'] = $dup_products_id;
            //write attributes data to DB
            xtc_db_perform(TABLE_PRODUCTS_CONTENT, $sql_data_array);
      }
    }
    // EOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-13 - duplicate products content

    Datei /admin/includes/modules/categories_view.php

    Suche nach Zeile
    Code: PHP  [Auswählen]
    $contents[] = array('text' => '<strong>' . TEXT_ATTRIBUTE_COPY . '</strong><br />' . '<input type="checkbox" name="attr_copy" value="attr_copy"><font size="1">'.TEXT_ATTRIBUTE_COPY_INFO.'</font><br /><hr noshade>');

    Füge NACH DIESER ZEILE ein
    Code: PHP  [Auswählen]
    // BOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-13 - duplicate products content
    $contents[] = array('text' => '<strong>' . TEXT_CONTENT_COPY . '</strong><br />' . '<input type="checkbox" name="cnt_copy" value="cnt_copy"><font size="1">'.TEXT_CONTENT_COPY_INFO.'</font><br /><hr noshade>');
    // EOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-13 - duplicate products content

    Fertig.

    Hoffe damit Jemandem geholfen haben zu können.

    Besten Gruß,
    Timo

    Linkback: https://www.modified-shop.org/forum/index.php?topic=28916.0

    jannemann

    • modified Team
    • Beiträge: 6.289
    • Geschlecht:
    Re: ANLEITUNG: Produkte mit Content kopieren/duplizieren
    Antwort #1 am: 14. Januar 2014, 07:36:37
    Hallo Timo,

    herzlichen Dank fürs Teilen deiner Lösung :!:
     :thx:
    Das werde ich mir näher anschauen, sobald es meine Zeit wieder zulässt.

    Schöne Grüße,
    Jan

    timopaul

    • modified Team
    • Beiträge: 371
    • Geschlecht:
    Re: ANLEITUNG: Produkte mit Content kopieren/duplizieren
    Antwort #2 am: 17. Januar 2014, 17:01:11
    Hallo Community,

    Es ist noch nicht viel Zeit vergangen und schon kommt die erst Aktualisierung der Anleitung.

    Folgendes Problem ist beim Kopieren von Artikeln aufgefallen: Verlinkungen von Produkten in anderen Kategorien werden beim kopieren des verlinkten Produktes nicht mit berücksichtigt. Folgend die angepasste Anleitung um auch dies optional mit abzudecken:

    Datei: /lang/german/admin/categories.php

    Suche nach Zeile
    Code: PHP  [Auswählen]
    define('TEXT_ATTRIBUTE_COPY_INFO', 'Artikelattribute mitkopieren<br/ >Nur bei Einzelkopie (1 Artikel) empfohlen');

    Füge NACH DIESER ZEILE ein
    Code: PHP  [Auswählen]
    // BOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-17 - duplicate products content and links
    define('TEXT_CONTENT_COPY', 'Artikel-Content mitkopieren');
    define('TEXT_CONTENT_COPY_INFO', 'Artikel-Content mitkopieren<br/ >Nur bei Einzelkopie (1 Artikel) empfohlen');
    define('TEXT_LINKS_COPY', 'Artikel-Verlinkungen mitkopieren');
    define('TEXT_LINKS_COPY_INFO', 'Artikel-Verlinkungen mitkopieren<br/ >Nur bei Einzelkopie (1 Artikel) empfohlen');
    // EOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-17 - duplicate products content and links

    Datei /admin/includes/classes/categories.php

    Suche nach Zeile
    Code: PHP  [Auswählen]
    } //duplicate_product ends

    Füge VOR DIESER ZEILE ein:
    Code: PHP  [Auswählen]
    // BOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-17 - duplicate products content and links
    if (isset($_POST['cnt_copy']) && $_POST['cnt_copy'] == 'cnt_copy') {
      $content_copy_stmt = 'SELECT * ' .
                                                    'FROM ' . TABLE_PRODUCTS_CONTENT . ' ' .
                                                    'WHERE products_id = ' . $old_products_id;
      $content_copy_query = xtc_db_query($content_copy_stmt);
      while ($content_copy_data = xtc_db_fetch_array($content_copy_query)) {
            $sql_data_array = $content_copy_data;
            unset($sql_data_array['content_id']);
            $sql_data_array['products_id'] = $dup_products_id;
            xtc_db_perform(TABLE_PRODUCTS_CONTENT, $sql_data_array);
      }
    }
    if (isset($_POST['links_copy']) && $_POST['links_copy'] == 'links_copy') {
      $links_copy_stmt = 'SELECT * ' .
                                              'FROM ' . TABLE_PRODUCTS_TO_CATEGORIES . ' ' .
                                              'WHERE products_id = ' . $old_products_id . ' ' .
                                                    'AND categories_id <> ' . $dest_categories_id;
      while ($links_copy_data = xtc_db_fetch_array($links_copy_stmt)) {
            $sql_data_array = $links_copy_data;
            $sql_data_array['products_id'] = $dup_products_id;
            xtc_db_perform(TABLE_PRODUCTS_TO_CATEGORIES, $sql_data_array);
      }
    }
    // EOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-17 - duplicate products content and links

    Datei /admin/includes/modules/categories_view.php

    Suche nach Zeile
    Code: PHP  [Auswählen]
    $contents[] = array('text' => '<strong>' . TEXT_ATTRIBUTE_COPY . '</strong><br />' . '<input type="checkbox" name="attr_copy" value="attr_copy"><font size="1">'.TEXT_ATTRIBUTE_COPY_INFO.'</font><br /><hr noshade>');

    Füge NACH DIESER ZEILE ein
    Code: PHP  [Auswählen]
    // BOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-17 - duplicate products content and links
    $contents[] = array('text' => '<strong>' . TEXT_CONTENT_COPY . '</strong><br />' . '<input type="checkbox" name="cnt_copy" value="cnt_copy"><font size="1">'.TEXT_CONTENT_COPY_INFO.'</font><br /><hr noshade>');
    $contents[] = array('text' => '<strong>' . TEXT_LINKS_COPY . '</strong><br />' . '<input type="checkbox" name="links_copy" value="links_copy"><font size="1">'.TEXT_LINKS_COPY_INFO.'</font><br /><hr noshade>');
    // EOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-17 - duplicate products content and links

    Fertig.

    Würde mich freuen wenn Jemand vom Team diese Aktualisierung mit in den ersten Post packen und auch den Titel in "ANLEITUNG: Produkte mit Content und Verlinkungen kopieren/duplizieren" anpassen kann, sodass es übersichtlicher wird.

    Besten Gruß,
    Timo

    timopaul

    • modified Team
    • Beiträge: 371
    • Geschlecht:
    Re: ANLEITUNG: Produkte mit Content kopieren/duplizieren
    Antwort #3 am: 22. Februar 2014, 13:51:14
    Liebe Community,

    mir ist in dieser Anleitung ein Fehler unterlaufen der Entdeckt und bereits korrigiert wurde. Ich bitte um Nachsicht. Hier der korrigierte Code für die Datei /admin/includes/classes/categories.php:

    Code: PHP  [Auswählen]
    // BOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-17 - duplicate products content and links
    if (isset($_POST['cnt_copy']) && $_POST['cnt_copy'] == 'cnt_copy') {
      $content_copy_stmt = 'SELECT * ' .
                            'FROM ' . TABLE_PRODUCTS_CONTENT . ' ' .
                            'WHERE products_id = ' . $old_products_id;
      $content_copy_query = xtc_db_query($content_copy_stmt);
      while ($content_copy_data = xtc_db_fetch_array($content_copy_query)) {
        $sql_data_array = $content_copy_data;
        unset($sql_data_array['content_id']);
        $sql_data_array['products_id'] = $dup_products_id;
        xtc_db_perform(TABLE_PRODUCTS_CONTENT, $sql_data_array);
      }
    }
    if (isset($_POST['links_copy']) && $_POST['links_copy'] == 'links_copy') {
      $links_copy_stmt = 'SELECT * ' .
                          'FROM ' . TABLE_PRODUCTS_TO_CATEGORIES . ' ' .
                          'WHERE products_id = ' . $old_products_id . ' ' .
                            'AND categories_id <> ' . $dest_categories_id;
      $links_copy_query = xtc_db_query($links_copy_stmt);
      while ($links_copy_data = xtc_db_fetch_array($links_copy_query)) {
        $sql_data_array = $links_copy_data;
        $sql_data_array['products_id'] = $dup_products_id;
        xtc_db_perform(TABLE_PRODUCTS_TO_CATEGORIES, $sql_data_array);
      }
    }
    // EOF - Timo Paul (mail[at]timopaul[dot]biz) - 2014-01-17 - duplicate products content and links

    In Zeile 19 wurde eine Zeile ergänzt und in Zeile 20 die verwendete Variable aktualisiert.

    Besten Gruß,
    Timo
    3 Antworten
    1211 Aufrufe
    03. Juli 2020, 19:08:25 von Duncan
    2 Antworten
    2770 Aufrufe
    28. Juli 2014, 20:24:29 von lithoverlag
    0 Antworten
    2176 Aufrufe
    25. August 2010, 15:20:55 von riffi_at
    10 Antworten
    6346 Aufrufe
    25. Juli 2011, 13:03:39 von DokuMan
               
    anything