Results 1 to 10 of 31

Hybrid View

  1. #1
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Sorting EZ-Pages Into Sideboxes

    For the improved filter, remove the two lines described above in post 6.
    Add to the SQL query
    and pages_id in (" . EZPAGES_SIDEBOX_FILTER . ")
    or
    and pages_id in (" . EZPAGES2_SIDEBOX_FILTER . ")
    to get
    PHP Code:
        $page_query $db->Execute("select * from " TABLE_EZPAGES " where status_sidebox = 1 and sidebox_sort_order > 0 and pages_id in (" EZPAGES_SIDEBOX_FILTER ") order by sidebox_sort_order, pages_title");
        if (
    $page_query->RecordCount()>0) { 
    Make a new file /includes/datafiles/extra_datafiles/ezpages_sidebox_filters.php, with content
    PHP Code:
    define('EZPAGES_SIDEBOX_FILTER''1,3,5,7,11');
    define('EZPAGES2_SIDEBOX_FILTER''2,4,6,8,9,10'); 

  2. #2
    Join Date
    May 2010
    Posts
    67
    Plugin Contributions
    0

    Default Re: Sorting EZ-Pages Into Sideboxes

    Quote Originally Posted by gjh42 View Post
    For the improved filter, remove the two lines described above in post 6.
    Add to the SQL query
    and pages_id in (" . EZPAGES_SIDEBOX_FILTER . ")
    or
    and pages_id in (" . EZPAGES2_SIDEBOX_FILTER . ")
    to get
    PHP Code:
        $page_query $db->Execute("select * from " TABLE_EZPAGES " where status_sidebox = 1 and sidebox_sort_order > 0 and pages_id in (" EZPAGES_SIDEBOX_FILTER ") order by sidebox_sort_order, pages_title");
        if (
    $page_query->RecordCount()>0) { 
    Make a new file /includes/datafiles/extra_datafiles/ezpages_sidebox_filters.php, with content
    PHP Code:
    define('EZPAGES_SIDEBOX_FILTER''1,3,5,7,11');
    define('EZPAGES2_SIDEBOX_FILTER''2,4,6,8,9,10'); 
    Hello again!

    I know it has been around 4 days since my last reply but this weekend has been a very busy one!

    What do you mean by "add to the SQL query"?

    Thanks!

    ojhernandez

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Sorting EZ-Pages Into Sideboxes

    Find the line in /includes/modules/sideboxes/your_template/ezpages.php and ezpages2.php that starts with $page_query, and add the bit shown to end up as shown in the PHP Code box.

    Also make the new file described.

  4. #4
    Join Date
    May 2010
    Posts
    67
    Plugin Contributions
    0

    Default Re: Sorting EZ-Pages Into Sideboxes

    Quote Originally Posted by gjh42 View Post
    Find the line in /includes/modules/sideboxes/your_template/ezpages.php and ezpages2.php that starts with $page_query, and add the bit shown to end up as shown in the PHP Code box.

    Also make the new file described.
    Hello,

    I made the file that you described (I had to create the "datafiles" directory.)

    Although now I get an error in that sidebox column.

    It reads:

    Quote Originally Posted by Error
    1054 Unknown column 'EZPAGES_SIDEBOX_FILTER' in 'where clause'
    in:
    [select * from ezpages where status_sidebox = 1 and sidebox_sort_order > 0 and pages_id in (EZPAGES_SIDEBOX_FILTER) order by sidebox_sort_order, pages_title]
    I looked at my php files and I can't find anything wrong though, although I'm sure I made a silly mistake.

    ezpages.php:
    PHP Code:
    <?php
    /**
     * ezpages sidebox - used to display links to EZ-Pages content
     *
     * @package templateSystem
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: ezpages.php 6021 2007-03-17 16:34:19Z ajeh $
     */

      
    $zco_notifier->notify('NOTIFY_START_EZPAGES_SIDEBOX');

      
    // test if sidebox should display
      
    if (EZPAGES_STATUS_SIDEBOX == '1' or (EZPAGES_STATUS_SIDEBOX== '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE$_SERVER['REMOTE_ADDR'])))) {
        if (isset(
    $var_linksList)) {
          unset(
    $var_linksList);
        }
        
    $page_query $db->Execute("select * from " TABLE_EZPAGES " where status_sidebox = 1 and sidebox_sort_order > 0 and pages_id in (" EZPAGES_SIDEBOX_FILTER ") order by sidebox_sort_order, pages_title");
        if (
    $page_query->RecordCount()>0) {
          
    $title =  BOX_HEADING_EZPAGES;
          
    $box_id =  'ezpages';
          
    $rows 0;
          while (!
    $page_query->EOF) {

        

            
    $rows++;
            
    $page_query_list_sidebox[$rows]['id'] = $page_query->fields['pages_id'];
            
    $page_query_list_sidebox[$rows]['name'] = $page_query->fields['pages_title'];
            
    $page_query_list_sidebox[$rows]['altURL']  = "";
            switch (
    true) {
              
    // external link new window or same window
              
    case ($page_query->fields['alt_url_external'] != ''):
              
    $page_query_list_sidebox[$rows]['altURL']  = $page_query->fields['alt_url_external'];
              break;
              
    // internal link new window
              
    case ($page_query->fields['alt_url'] != '' and $page_query->fields['page_open_new_window'] == '1'):
              
    $page_query_list_sidebox[$rows]['altURL']  = (substr($page_query->fields['alt_url'],0,4) == 'http') ?
              
    $page_query->fields['alt_url'] :
              (
    $page_query->fields['alt_url']=='' '' zen_href_link($page_query->fields['alt_url'], '', ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL'), truetruetrue));
              break;
              
    // internal link same window
              
    case ($page_query->fields['alt_url'] != '' and $page_query->fields['page_open_new_window'] == '0'):
              
    $page_query_list_sidebox[$rows]['altURL']  = (substr($page_query->fields['alt_url'],0,4) == 'http') ?
              
    $page_query->fields['alt_url'] :
              (
    $page_query->fields['alt_url']=='' '' zen_href_link($page_query->fields['alt_url'], '', ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL'), truetruetrue));
              break;
            }

            
    // if altURL is specified, use it; otherwise, use EZPage ID to create link
            
    $page_query_list_sidebox[$rows]['link'] = ($page_query_list_sidebox[$rows]['altURL'] =='') ?
            
    zen_href_link(FILENAME_EZPAGES'id=' $page_query->fields['pages_id'] . ($page_query->fields['toc_chapter'] > '&chapter=' $page_query->fields['toc_chapter'] : ''), ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL')) :
            
    $page_query_list_sidebox[$rows]['altURL'];
            
    $page_query_list_sidebox[$rows]['link'] .= ($page_query->fields['page_open_new_window'] == '1' '" target="_blank' '');

               

        
    $page_query->MoveNext();
          }

          
    $title_link false;

          
    $var_linksList $page_query_list_sidebox;

          require(
    $template->get_template_dir('tpl_ezpages.php',DIR_WS_TEMPLATE$current_page_base,'sideboxes'). '/tpl_ezpages.php');

          
    $zco_notifier->notify('NOTIFY_END_EZPAGES_SIDEBOX');
          require(
    $template->get_template_dir($column_box_defaultDIR_WS_TEMPLATE$current_page_base,'common') . '/' $column_box_default);
        }
      } 
    // test for display

      
    $zco_notifier->notify('NOTIFY_END_EZPAGES_SIDEBOX');
    ?>
    ezpages2.php
    PHP Code:
    <?php
    /**
     * ezpages sidebox - used to display links to EZ-Pages content
     *
     * @package templateSystem
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: ezpages.php 6021 2007-03-17 16:34:19Z ajeh $
     */

      
    $zco_notifier->notify('NOTIFY_START_EZPAGES2_SIDEBOX');

      
    // test if sidebox should display
      
    if (EZPAGES_STATUS_SIDEBOX == '1' or (EZPAGES_STATUS_SIDEBOX== '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE$_SERVER['REMOTE_ADDR'])))) {
        if (isset(
    $var_linksList)) {
          unset(
    $var_linksList);
        }
        
    $page_query $db->Execute("select * from " TABLE_EZPAGES " where status_sidebox = 1 and sidebox_sort_order > 0 and pages_id in (" EZPAGES2_SIDEBOX_FILTER ") order by sidebox_sort_order, pages_title");
        if (
    $page_query->RecordCount()>0) {
          
    $title =  BOX_HEADING_EZPAGES2;
          
    $box_id =  'ezpages2';
          
    $rows 0;
          while (!
    $page_query->EOF) {
            

             
            
    $rows++;
            
    $page_query_list_sidebox[$rows]['id'] = $page_query->fields['pages_id'];
            
    $page_query_list_sidebox[$rows]['name'] = $page_query->fields['pages_title'];
            
    $page_query_list_sidebox[$rows]['altURL']  = "";
            switch (
    true) {
              
    // external link new window or same window
              
    case ($page_query->fields['alt_url_external'] != ''):
              
    $page_query_list_sidebox[$rows]['altURL']  = $page_query->fields['alt_url_external'];
              break;
              
    // internal link new window
              
    case ($page_query->fields['alt_url'] != '' and $page_query->fields['page_open_new_window'] == '1'):
              
    $page_query_list_sidebox[$rows]['altURL']  = (substr($page_query->fields['alt_url'],0,4) == 'http') ?
              
    $page_query->fields['alt_url'] :
              (
    $page_query->fields['alt_url']=='' '' zen_href_link($page_query->fields['alt_url'], '', ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL'), truetruetrue));
              break;
              
    // internal link same window
              
    case ($page_query->fields['alt_url'] != '' and $page_query->fields['page_open_new_window'] == '0'):
              
    $page_query_list_sidebox[$rows]['altURL']  = (substr($page_query->fields['alt_url'],0,4) == 'http') ?
              
    $page_query->fields['alt_url'] :
              (
    $page_query->fields['alt_url']=='' '' zen_href_link($page_query->fields['alt_url'], '', ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL'), truetruetrue));
              break;
            }

            
    // if altURL is specified, use it; otherwise, use EZPage ID to create link
            
    $page_query_list_sidebox[$rows]['link'] = ($page_query_list_sidebox[$rows]['altURL'] =='') ?
            
    zen_href_link(FILENAME_EZPAGES2'id=' $page_query->fields['pages_id'] . ($page_query->fields['toc_chapter'] > '&chapter=' $page_query->fields['toc_chapter'] : ''), ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL')) :
            
    $page_query_list_sidebox[$rows]['altURL'];
            
    $page_query_list_sidebox[$rows]['link'] .= ($page_query->fields['page_open_new_window'] == '1' '" target="_blank' '');

         
    $page_query->MoveNext();
          }

          
    $title_link false;

          
    $var_linksList $page_query_list_sidebox;

          require(
    $template->get_template_dir('tpl_ezpages2.php',DIR_WS_TEMPLATE$current_page_base,'sideboxes'). '/tpl_ezpages2.php');

          
    $zco_notifier->notify('NOTIFY_END_EZPAGES2_SIDEBOX');
          require(
    $template->get_template_dir($column_box_defaultDIR_WS_TEMPLATE$current_page_base,'common') . '/' $column_box_default);
        }
      } 
    // test for display

      
    $zco_notifier->notify('NOTIFY_END_EZPAGES2_SIDEBOX');
    ?>
    ezpages_sidebox_filters:
    PHP Code:
    define('EZPAGES_SIDEBOX_FILTER''1,3,5,7,11'); 
    define('EZPAGES2_SIDEBOX_FILTER''2,4,6,8,9,10'); 
    Thanks in Advance!

    ojhernandez

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Sorting EZ-Pages Into Sideboxes

    The SQL error message indicates that the constant definition is not being processed before the file with the SQL runs. I made an error in the folder names - it should be just /includes/extra_datafiles/ezpages_sidebox_filters.php - no /datafiles/ folder. Sorry about that.

  6. #6
    Join Date
    May 2010
    Posts
    67
    Plugin Contributions
    0

    Default Re: Sorting EZ-Pages Into Sideboxes

    Quote Originally Posted by gjh42 View Post
    The SQL error message indicates that the constant definition is not being processed before the file with the SQL runs. I made an error in the folder names - it should be just /includes/extra_datafiles/ezpages_sidebox_filters.php - no /datafiles/ folder. Sorry about that.
    I fixed the folder issue but now there is new unwanted behavior.

    The same error displays in the sidebox:

    Quote Originally Posted by Error
    1054 Unknown column 'EZPAGES_SIDEBOX_FILTER' in 'where clause'
    in:
    [select * from ezpages where status_sidebox = 1 and sidebox_sort_order > 0 and pages_id in (EZPAGES_SIDEBOX_FILTER) order by sidebox_sort_order, pages_title]
    But now, it displays "define('EZPAGES_SIDEBOX_FILTER', '1,3,5,7,11'); define('EZPAGES2_SIDEBOX_FILTER', '2,4,6,8,9,10');" at the top of my page.

    Did I overlook something?

    Thanks in Advance!

    ojhernandez

  7. #7
    Join Date
    May 2010
    Posts
    67
    Plugin Contributions
    0

    Default Re: Sorting EZ-Pages Into Sideboxes

    I've decided to go ahead with the method that you described in post 6 since it was working for me.

    Although I have one question regarding it,

    where is BOX_HEADING_EZPAGES2 defined so I can change the text that it displays for the heading on the sidebox?

    Thanks in Advance!

    ojhernandez

 

 

Similar Threads

  1. Sorting Product List pages by order popularity
    By Cozmoz in forum Code Collaboration
    Replies: 16
    Last Post: 1 Dec 2014, 11:04 AM
  2. How to add more pages into "Information"? (sideboxes/information.php)
    By n_t_r in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 27 May 2011, 01:50 PM
  3. Copyright bleeding into sideboxes
    By xavioremu in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 5 May 2010, 09:45 PM
  4. Sorting EZ_Page Footer links into columns?
    By bumba000 in forum General Questions
    Replies: 6
    Last Post: 4 Oct 2009, 05:36 AM
  5. Pulling Sideboxes into non zencart pages
    By halfwitt in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 22 Aug 2007, 02:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg