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: Content-Inhalte in Box anzeigen

    Bastel-Dirk

    • Neu im Forum
    • Beiträge: 20
    ANLEITUNG: Content-Inhalte in Box anzeigen
    am: 19. August 2016, 13:05:20
    Hallo...

    ist es im Shop möglich Contentinhalte (ContentManager)
    in einer Box anzuzeigen/einzufügen/darzustellen...?

    Danke

    [EDIT Tomcraft 19.08.2016: Hier geht es direkt zur Anleitung.]

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

    Tomcraft

    • modified Team
    • Gravatar
    • Beiträge: 46.178
    • Geschlecht:
    Re: ANLEITUNG: Content-Inhalte in Box anzeigen
    Antwort #1 am: 19. August 2016, 14:05:56
    Klar geht das!

    Erstelle eine Datei "/templates/<dein-template>/boxes/box_content_extra.html" mit folgendem Inhalt:

    Code: PHP  [Auswählen]
    {config_load file="$language/lang_$language.conf" section="boxes"}
    {if isset($BOX_CONTENT) && $BOX_CONTENT != ''}
      <h2 class="boxheader">{$BOX_HEADING}</h2>
      <div class="boxbody">{$BOX_CONTENT}</div>
    {/if}

    Erstelle eine Datei "/templates/<dein-template>/source/boxes/content_extra.php" mit folgendem Inhalt:

    Code: PHP  [Auswählen]
    <?php
    /* -----------------------------------------------------------------------------------------
       $Id:$  

       modified eCommerce Shopsoftware
       http://www.modified-shop.org

       Copyright (c) 2009 - 2013 [www.modified-shop.org]
       -----------------------------------------------------------------------------------------
       based on:
       (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
       (c) 2002-2003 osCommerce(content_extra.php,v 1.6 2003/02/10); www.oscommerce.com
       (c) 2003     nextcommerce (content.php,v 1.2 2003/08/21); www.nextcommerce.org
       (c) 2003 XT-Commerce
       
       Released under the GNU General Public License
       ---------------------------------------------------------------------------------------*/


    // include smarty
    $box_smarty = new smarty;
    $content_string = '';
    //$rebuild = false; //DokuMan - 2010-02-28 - fix Smarty cache error on unlink

    $box_smarty->assign('language', $_SESSION['language']);
    // set cache ID
    if (!CacheCheck()) {
            $cache=false;
            $box_smarty->caching = 0;
    } else {
            $cache=true;
            $box_smarty->caching = 1;
            $box_smarty->cache_lifetime = CACHE_LIFETIME;
            $box_smarty->cache_modified_check = CACHE_CHECK;
            $cache_id = $_SESSION['language'].$_SESSION['customers_status']['customers_status_id'];
    }

    // set cache id
    $cache_id = md5($_SESSION['language'].$_SESSION['customers_status']['customers_status_id'].(isset($coPath) ? $coPath : '0'));

    if (!$box_smarty->is_cached(CURRENT_TEMPLATE.'/boxes/box_content_extra.html', $cache_id) || !$cache) {
     
      $content_string = '';

            $content_query = xtDBquery("SELECT content_id,
                                         categories_id,
                                         parent_id,
                                         content_title,
                                         content_text,
                                         content_group
                                    FROM "
    .TABLE_CONTENT_MANAGER."
                                   WHERE languages_id='"
    .(int) $_SESSION['languages_id']."'
                                     AND file_flag='0'
                                         "
    .CONTENT_CONDITIONS."
                                     AND content_status='1'
                                     AND content_active='1'
                                     AND trim(content_title) != ''
                                     AND parent_id='0'
                                     AND content_group=1000
                                ORDER BY sort_order"
    );

      if (xtc_db_num_rows($content_query, true) > 0) {
        while ($content_data = xtc_db_fetch_array($content_query, true)) {
          $content_heading = $content_data['content_title'];
          $content_string = $content_data['content_text'];
              }
       
        if ($content_heading != '') {
          $box_smarty->assign('BOX_HEADING', $content_heading);
        }

        $box_smarty->assign('BOX_CONTENT', $content_string);
      }
    }

    if (!$cache) {
      $box_content_extra = $box_smarty->fetch(CURRENT_TEMPLATE.'/boxes/box_content_extra.html');
    } else {
      $box_content_extra = $box_smarty->fetch(CURRENT_TEMPLATE.'/boxes/box_content_extra.html', $cache_id);
    }

    $smarty->assign('box_CONTENT_EXTRA', $box_content_extra);
    ?>

    Bearbeite Datei "/templates/<dein-template>/source/boxes.php" und füge folgende Zeile hinzu:

    Code: PHP  [Auswählen]
      require_once(DIR_WS_BOXES . 'content_extra.php');

    Bearbeite Datei "/templates/<dein-template>/index.html" und füge an gewünschter Stelle folgende Zeile hinzu:

    Code: PHP  [Auswählen]
    {$box_CONTENT_EXTRA}

    Nun erstellst du im Content Manager einen neuen Content in Box "information" mit der "Sprachgruppe" 1000 und der Titel sowie der Text wird dir in der neuen Box angezeigt.

    Grüße

    Torsten

    [EDIT Tomcraft 19.08.2016: Anleitung in Beitrag 1 verlinkt.]

    Bastel-Dirk

    • Neu im Forum
    • Beiträge: 20
    Re: ANLEITUNG: Content-Inhalte in Box anzeigen
    Antwort #2 am: 19. August 2016, 15:14:32
    Hallo...
    aber das funktioniert nicht im mofifiedShop V 2.0

    Box wird nicht angezeigt...
    habe alles so erstellt wie geschrieben...

    Cache und Templatecache wurde auch geleert

    awids

    • Experte
    • Beiträge: 3.789
    • Geschlecht:
    Re: ANLEITUNG: Content-Inhalte in Box anzeigen
    Antwort #3 am: 19. August 2016, 16:35:10

    Bastel-Dirk

    • Neu im Forum
    • Beiträge: 20
    Re: ANLEITUNG: Content-Inhalte in Box anzeigen
    Antwort #4 am: 19. August 2016, 17:12:15
    Japp...
    funktioniert...

    Eine Frage noch... 
    wie bekomme ich den Text aus der Variable

    Code: PHP  [Auswählen]
    {$greeting}

    jetzt dort im Inhalt angezeigt... ??

    wenn ich diese Variable jetzt im entsprechenden Content eintrage wird aber eben nur {$greeting}  angezeigt...

    awids

    • Experte
    • Beiträge: 3.789
    • Geschlecht:
    Re: ANLEITUNG: Content-Inhalte in Box anzeigen
    Antwort #5 am: 19. August 2016, 17:38:16
    Das geht ganz einfach, wenn wir uns weiterhin auf meine Anleitung beziehen. ;-)

    Suche in der /source/boxes/miscellaneous.php (bzw. der Name der Datei, die du angelegt hast) folgende Anweisung:

    Code: PHP  [Auswählen]
    // include smarty
    include(DIR_FS_BOXES_INC . 'smarty_default.php');

    und füge danach ein:

    Code: PHP  [Auswählen]
    // include needed functions
    include(DIR_FS_INC . 'xtc_customer_greeting.inc.php');

    Anschließend suche gemäß der Vorgabe aus meiner Anleitung diese Zeile:

    Code: PHP  [Auswählen]
    $box_smarty->assign('box_text_1', $shop_content_data_2['content_text']);

    und füge danach ein:

    Code: PHP  [Auswählen]
    $box_smarty->assign('box_text_1', str_replace('{$greeting}', xtc_customer_greeting(), $shop_content_data_2['content_text']));

    Fertig! ;-)

    P.S.: Wenn die Box wie in meiner Anleitung im Footer zu finden sein sein, weise dem p-Tag aus meiner Anleitung am besten noch die Klasse "box3_sub" zu, damit der Text weiß angezeigt wird, also:

    Code: XML  [Auswählen]
    <p class="box3_sub">{$box_text_1}</p>
    12 Antworten
    5040 Aufrufe
    11. Juni 2012, 15:25:13 von d2m
    16 Antworten
    9058 Aufrufe
    13. Juli 2010, 13:18:17 von karla
    3 Antworten
    2791 Aufrufe
    14. September 2013, 09:06:08 von tradics