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: Neue Box erscheint nicht

    NeKo

    • Neu im Forum
    • Beiträge: 14
    Neue Box erscheint nicht
    am: 14. Dezember 2017, 12:37:25
    Guten Tag liebe Community,

    momentan versuche ich eine Box zu erstellen, der man Einträge im Content-Manager zuweisen kann, die diese dann als Liste+Links anzeigen soll.

    Dabei habe ich mich an diese Anleitung gehalten:
    https://www.modified-shop.org/wiki/Tutorial:_Erstellung_Box

    Stecke bei "Einfügung in Layout" fest: Nach einfügen des require_once(DIR_WS_BOXES . 'nav.php'); erscheint die Box, die ich "Nav" genannt habe, nicht auf der Seite. In der Smarty Debug-Konsole wird meine neue Box auch nicht aufgeführt.

    Über einen Richtungshinweis wäre ich überaus dankbar! :)

    Mein Code in <template>/source/boxes.php:
    (Habe ich die Zeile vielleicht an die falsche Stelle gesetzt? Das Tutorial ist da nicht sehr klar)
    Code: PHP  [Auswählen]
    <?php
    /* -----------------------------------------------------------------------------------------
       $Id: boxes.php 10541 2016-12-21 08:43:33Z Tomcraft $

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

       Copyright (c) 2009 - 2013 [www.modified-shop.org]
       -----------------------------------------------------------------------------------------
       based on:
       (c) 2006 XT-Commerce
       
       Released under the GNU General Public License
       ---------------------------------------------------------------------------------------*/


    // css buttons
    if (file_exists(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/source/inc/css_button.inc.php')) {
      require_once ('templates/'.CURRENT_TEMPLATE.'/source/inc/css_button.inc.php');
    }

    // define full content sites
    $fullcontent = array(FILENAME_CHECKOUT_SHIPPING,
                         FILENAME_CHECKOUT_PAYMENT,
                         FILENAME_CHECKOUT_CONFIRMATION,
                         FILENAME_CHECKOUT_SUCCESS,
                         FILENAME_CHECKOUT_SHIPPING_ADDRESS,
                         FILENAME_CHECKOUT_PAYMENT_ADDRESS,
                         FILENAME_ACCOUNT,
                         FILENAME_ACCOUNT_EDIT,
                         FILENAME_ACCOUNT_HISTORY,
                         FILENAME_ACCOUNT_HISTORY_INFO,
                         FILENAME_ACCOUNT_PASSWORD,
                         FILENAME_ACCOUNT_DELETE,
                         FILENAME_ACCOUNT_CHECKOUT_EXPRESS,
                         FILENAME_CREATE_ACCOUNT,
                         FILENAME_CREATE_GUEST_ACCOUNT,
                         FILENAME_ADDRESS_BOOK,
                         FILENAME_ADDRESS_BOOK_PROCESS,
                         FILENAME_PASSWORD_DOUBLE_OPT,
                         FILENAME_ADVANCED_SEARCH_RESULT,
                         FILENAME_ADVANCED_SEARCH,
                         FILENAME_SHOPPING_CART,
                         FILENAME_GV_SEND,
                         FILENAME_NEWSLETTER,
                         FILENAME_LOGIN,
                         FILENAME_CONTENT,
                         FILENAME_REVIEWS,
                         FILENAME_WISHLIST,
                         FILENAME_CHECKOUT_PAYMENT_IFRAME,
                         );

    // -----------------------------------------------------------------------------------------
    //      full content
    // -----------------------------------------------------------------------------------------
      if (!in_array(basename($PHP_SELF), $fullcontent)) {
        require_once(DIR_FS_BOXES . 'categories.php');
        require_once(DIR_FS_BOXES . 'manufacturers.php');
        require_once(DIR_FS_BOXES . 'last_viewed.php');
            require_once(DIR_WS_BOXES . 'nav.php');
      } else {
        // smarty full content
        $smarty->assign('fullcontent', true);  
      }

    // -----------------------------------------------------------------------------------------
    //      always visible
    // -----------------------------------------------------------------------------------------
      require_once(DIR_FS_BOXES . 'search.php');
      require_once(DIR_FS_BOXES . 'content.php');
      require_once(DIR_FS_BOXES . 'information.php');
      require_once(DIR_FS_BOXES . 'miscellaneous.php');
      require_once(DIR_FS_BOXES . 'languages.php');
      require_once(DIR_FS_BOXES . 'infobox.php');
      require_once(DIR_FS_BOXES . 'loginbox.php');
      if (!defined('MODULE_NEWSLETTER_STATUS') || MODULE_NEWSLETTER_STATUS == 'true') {
        require_once(DIR_FS_BOXES . 'newsletter.php');
      }
      if (defined('MODULE_TS_TRUSTEDSHOPS_ID')
          && (MODULE_TS_WIDGET == '1'
              || (MODULE_TS_REVIEW_STICKER != '' && MODULE_TS_REVIEW_STICKER_STATUS == '1'))
          )
      {
        require_once(DIR_FS_BOXES . 'trustedshops.php');
      }
    // -----------------------------------------------------------------------------------------
    //      only if show price
    // -----------------------------------------------------------------------------------------
      if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
        require_once(DIR_FS_BOXES . 'add_a_quickie.php');
        require_once(DIR_FS_BOXES . 'shopping_cart.php');
        if (defined('MODULE_WISHLIST_SYSTEM_STATUS') && MODULE_WISHLIST_SYSTEM_STATUS == 'true') {
          require_once(DIR_FS_BOXES . 'wishlist.php');
        }
      }
    // -----------------------------------------------------------------------------------------
    //      hide in search
    // -----------------------------------------------------------------------------------------
      if (substr(basename($PHP_SELF), 0,8) != 'advanced' && WHATSNEW_CATEGORIES === false) {
        require_once(DIR_FS_BOXES . 'whats_new.php');
      }
    // -----------------------------------------------------------------------------------------
    //      admins only
    // -----------------------------------------------------------------------------------------
      if ($_SESSION['customers_status']['customers_status'] == '0') {
        require_once(DIR_FS_BOXES . 'admin.php');
        $smarty->assign('is_admin', true);
      }
    // -----------------------------------------------------------------------------------------
    //      product details
    // -----------------------------------------------------------------------------------------
      if ($product->isProduct() === true) {
        require_once(DIR_FS_BOXES . 'manufacturer_info.php');
      } else {
        require_once(DIR_FS_BOXES . 'best_sellers.php');
        if ($_SESSION['customers_status']['customers_status_specials'] == '1' && SPECIALS_CATEGORIES === false) {
          require_once(DIR_FS_BOXES . 'specials.php');
        }
      }
    // -----------------------------------------------------------------------------------------
    //      only logged id users
    // -----------------------------------------------------------------------------------------
      if (isset($_SESSION['customer_id'])) {
        require_once(DIR_FS_BOXES . 'order_history.php');
      }
    // -----------------------------------------------------------------------------------------
    //      only if reviews allowed
    // -----------------------------------------------------------------------------------------
      if ($_SESSION['customers_status']['customers_status_read_reviews'] == '1') {
        require_once(DIR_FS_BOXES . 'reviews.php');
      }
    // -----------------------------------------------------------------------------------------
    //      hide during checkout
    // -----------------------------------------------------------------------------------------
      if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {
        require_once(DIR_FS_BOXES . 'currencies.php');
      }
    // -----------------------------------------------------------------------------------------

    // -----------------------------------------------------------------------------------------
    // Smarty home
    // -----------------------------------------------------------------------------------------
    $smarty->assign('home', ((basename($PHP_SELF) == FILENAME_DEFAULT && !isset($_GET['cPath']) && !isset($_GET['manufacturers_id'])) ? 1 : 0));

    // -----------------------------------------------------------------------------------------
    // Smarty bestseller
    // -----------------------------------------------------------------------------------------
    $smarty->assign('bestseller', strpos($PHP_SELF, FILENAME_LOGOFF)
                               || strpos($PHP_SELF, FILENAME_CHECKOUT_SUCCESS)
                               || strpos($PHP_SELF, FILENAME_SHOPPING_CART)
                               || strpos($PHP_SELF, FILENAME_NEWSLETTER));
    // -----------------------------------------------------------------------------------------

    $smarty->assign('tpl_path', DIR_WS_BASE.'templates/'.CURRENT_TEMPLATE.'/');
    ?>

    In <template>/source/boxes/nav.php:
    Habe ich einfach erstmal aus der Info-Box kopiert, da ich ja etwas ähnliches machen möchte und Information mit nav ersetzt. Ich hoffe das passt soweit?
    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(information.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
    include(DIR_FS_BOXES_INC . 'smarty_default.php');

    // 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_nav.html', $cache_id) || !$cache) {

      // include needed functions
      require_once (DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/source/inc/xtc_show_content.inc.php');
      require_once (DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/source/inc/close_ul_tags.inc.php');
     
      $content_array = array();
      $content_string = '';

            $content_query = xtDBquery("SELECT content_id,
                                         categories_id,
                                         parent_id,
                                         content_title,
                                         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'
                                ORDER BY sort_order"
    );

      if (xtc_db_num_rows($content_query, true) > 0) {
                    unset ($prev_cid);
                    unset ($first_content_element);
        while ($content_data = xtc_db_fetch_array($content_query, true)) {
          $content_array[$content_data['content_id']] = array(
              'name' => $content_data['content_title'],
              'parent' => $content_data['parent_id'],
              'level' => 0,
              'coID' => $content_data['content_group'],
              'path' => $content_data['content_id'],
              'next_id' => false
            );

          if (isset ($prev_cid)) {
            $content_array[$prev_cid]['next_id'] = $content_data['content_id'];
          }

          $prev_cid = $content_data['content_id'];

          if (!isset ($first_information_element)) {
            $first_information_element = $content_data['content_id'];
          }
              }

        if (isset($coPath)) {
          $new_path = '';
          $coid = explode('_', $coPath);
          reset($coid);
          while (list ($key, $value) = each($coid)) {
            unset ($prev_cid);
            unset ($first_cid);
            $content_query = xtDBquery("SELECT content_id,
                                               parent_id,
                                               content_title,
                                               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='"
    .$value."'
                                      ORDER BY sort_order"
    );

            if (xtc_db_num_rows($content_query, true) > 0) {
              $new_path .= $value;
              while ($content = xtc_db_fetch_array($content_query, true)) {
                $content_array[$content['content_id']] = array(
                    'name' => $content['content_title'],
                    'parent' => $content['parent_id'],
                    'level' => $key +1,
                    'coID' => $content['content_group'],
                    'path' => $new_path.'_'.$content['content_id'],
                    'next_id' => false
                  );
                if (isset ($prev_cid)) {
                  $content_array[$prev_cid]['next_id'] = $content['content_id'];
                }
                $prev_cid = $content['content_id'];
                if (!isset ($first_cid)) {
                  $first_cid = $content['content_id'];
                }
                $last_cid = $content['content_id'];
              }

              $content_array[$last_cid]['next_id'] = isset($content_array[$value]['next_id']) ? $content_array[$value]['next_id'] : 0;
              $content_array[$value]['next_id'] = $first_cid;
              $new_path .= '_';
            } else {
              break;
            }
          }
        }
     
        if(!empty($first_information_element)) {
         xtc_show_content($first_information_element);
        }
     
        $box_smarty->assign('BOX_CONTENT', $content_string);
      }
    }

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

    $smarty->assign('box_NAV', $box_nav);
    ?>

    In box_nav.html in <template>/boxes/
    steht bisher einfach nur
    Code: PHP  [Auswählen]
    {config_load file="$language/lang_$language.conf" section="boxes"}
    <h2 class="boxheader">{#heading_nav#}</h2>
    <div class="boxbody">{$BOX_CONTENT}</div>

    Freundliche Grüße

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

    awids

    • Experte
    • Beiträge: 3.803
    • Geschlecht:
    Re: Neue Box erscheint nicht
    Antwort #1 am: 14. Dezember 2017, 12:53:37
    Hast du vielleicht schon gemacht, aber ich werfe es mal in den Raum.

    Für die Zuweisung über den Content-Manager braucht die neue Box eine eigene File-Flag, anzulegen per SQL in phpMyAdmin (o. ä.):

    Code: SQL  [Auswählen]
    INSERT INTO cm_file_flags VALUES (9, 'nav')

    Die Query (es gibt 2) in der Datei <template>/source/boxes/nav.php müsste dementsprechend angepasst werden, dass sie die Einträge zu der neuen File-Flag abholt:

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

    Andernfalls sucht deine Box alle Zuweisungen in der Flag "information" ( = 0 ).

    Und dann könntest du deine neuen Dateien gerne alle mal zippen/packen und hier mit anhängen, damit wir uns die besser anschauen können.

    hpzeller

    • Experte
    • Beiträge: 4.129
    • Geschlecht:
    Re: Neue Box erscheint nicht
    Antwort #2 am: 14. Dezember 2017, 13:00:50
    Hast du die Box auch an geeigneter Stelle in der 'templates/dein_template/index.html' eingefügt und allenfalls in Erw. Konfiguration -> Cache Optionen den Templatecache geleert?

    Gruss
    Hanspeter

    NeKo

    • Neu im Forum
    • Beiträge: 14
    Re: Neue Box erscheint nicht
    Antwort #3 am: 14. Dezember 2017, 14:39:45
    awids,
    vielen Dank das hatte ich tatsächlich noch nicht gemacht! Jetzt erscheint mein "nav" zumindest als Auswahl im Backend, schön.

    hpzeller,
    beides schon gemacht, bringt leider nichts. isset($box_NAV) gibt auch false zurück.

    Wie gewünscht zur besseren Lesbarkeit hier ein ZIP.

    hpzeller

    • Experte
    • Beiträge: 4.129
    • Geschlecht:
    Re: Neue Box erscheint nicht
    Antwort #4 am: 14. Dezember 2017, 15:41:29
    Wieso hast du in <template>/source/boxes.php

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

    und nicht

    Code: PHP  [Auswählen]
    require_once(DIR_FS_BOXES . 'nav.php');

    eingetragen?

    Gruss
    Hanspeter

    NeKo

    • Neu im Forum
    • Beiträge: 14
    Re: Neue Box erscheint nicht
    Antwort #5 am: 14. Dezember 2017, 16:00:28
    Weil es im Tutorial so steht. ;) Ist ja, muss man zugeben, auch stark updatebedürftig.

    Nachdem ich es jetzt aber geändert habe und mal testweise nach "//   always visible" verschoben habe, erscheint die Box im Frontend - aber der Inhalt ist quasi leer.

    Das gibt der Platzhalter {$box_NAV} aus:
    Code: PHP  [Auswählen]
    <li class="level1"><a href="<domain>/shop_content.php?coID=" title=""></a></li>

    Im Backend sind jedoch zwei Punkte/Seiten dem Nav zugewiesen. Ideen? Irgendwo noch was in der nav.php vergessen?

    Modulfux

    • Experte
    • Beiträge: 3.590
    • Geschlecht:
    Re: Neue Box erscheint nicht
    Antwort #6 am: 14. Dezember 2017, 16:43:45
    Hast du bei den jeweiligen Inhalten auch die Sichtbarkeit als Link in der neuen Box auf "Ja" gestellt?

    NeKo

    • Neu im Forum
    • Beiträge: 14
    Re: Neue Box erscheint nicht
    Antwort #7 am: 14. Dezember 2017, 16:47:45
    Jip, das ist alles auf "ja".

    awids

    • Experte
    • Beiträge: 3.803
    • Geschlecht:
    Re: Neue Box erscheint nicht
    Antwort #8 am: 14. Dezember 2017, 21:53:57
    So sollte es klappen:

    <template>/source/boxes/nav.php
    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(information.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
    include(DIR_FS_BOXES_INC . 'smarty_default.php');

    // 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_nav.html', $cache_id) || !$cache) {

      // include needed functions
      require_once (DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/source/inc/xtc_show_content.inc.php');
      require_once (DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/source/inc/close_ul_tags.inc.php');
     
      $content_array = array();
      $content_string = '';

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

      if (xtc_db_num_rows($content_query, true) > 0) {
            unset ($prev_cid);
            unset ($first_content_element);
        while ($content_data = xtc_db_fetch_array($content_query, true)) {
          $content_array[$content_data['content_id']] = array(
              'name' => $content_data['content_title'],
              'parent' => $content_data['parent_id'],
              'level' => 0,
              'coID' => $content_data['content_group'],
              'path' => $content_data['content_id'],
              'next_id' => false
            );

          if (isset ($prev_cid)) {
            $content_array[$prev_cid]['next_id'] = $content_data['content_id'];
          }

          $prev_cid = $content_data['content_id'];

          if (!isset ($first_nav_element)) {
            $first_nav_element = $content_data['content_id'];
          }
          }

        if (isset($coPath)) {
          $new_path = '';
          $coid = explode('_', $coPath);
          reset($coid);
          while (list ($key, $value) = each($coid)) {
            unset ($prev_cid);
            unset ($first_cid);
            $content_query = xtDBquery("SELECT content_id,
                                               parent_id,
                                               content_title,
                                               content_group
                                          FROM "
    .TABLE_CONTENT_MANAGER."
                                         WHERE languages_id='"
    .(int) $_SESSION['languages_id']."'
                                           AND file_flag='9'
                                               "
    .CONTENT_CONDITIONS."
                                           AND content_status='1'
                                           AND content_active='1'
                                           AND trim(content_title) != ''
                                           AND parent_id='"
    .$value."'
                                      ORDER BY sort_order"
    );

            if (xtc_db_num_rows($content_query, true) > 0) {
              $new_path .= $value;
              while ($content = xtc_db_fetch_array($content_query, true)) {
                $content_array[$content['content_id']] = array(
                    'name' => $content['content_title'],
                    'parent' => $content['parent_id'],
                    'level' => $key +1,
                    'coID' => $content['content_group'],
                    'path' => $new_path.'_'.$content['content_id'],
                    'next_id' => false
                  );
                if (isset ($prev_cid)) {
                  $content_array[$prev_cid]['next_id'] = $content['content_id'];
                }
                $prev_cid = $content['content_id'];
                if (!isset ($first_cid)) {
                  $first_cid = $content['content_id'];
                }
                $last_cid = $content['content_id'];
              }

              $content_array[$last_cid]['next_id'] = isset($content_array[$value]['next_id']) ? $content_array[$value]['next_id'] : 0;
              $content_array[$value]['next_id'] = $first_cid;
              $new_path .= '_';
            } else {
              break;
            }
          }
        }
     
        if(!empty($first_nav_element)) {
         xtc_show_content($first_nav_element);
        }
     
        $box_smarty->assign('BOX_CONTENT', $content_string);
      }
    }

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

    $smarty->assign('box_NAV', $box_nav);
    ?>

    NeKo

    • Neu im Forum
    • Beiträge: 14
    Re: Neue Box erscheint nicht
    Antwort #9 am: 15. Dezember 2017, 09:02:08
    Wunderbar, vielen vielen Dank! :) Jetzt klappts.
    19 Antworten
    7576 Aufrufe
    19. Januar 2013, 16:31:08 von Kirsten
    6 Antworten
    4778 Aufrufe
    06. März 2012, 18:30:15 von Charly76
    8 Antworten
    3393 Aufrufe
    22. April 2009, 21:09:00 von tom.f
    6 Antworten
    3486 Aufrufe
    16. Juni 2012, 22:47:56 von jannemann