Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    red flag please someone with some error fixing knowledge save me

    hey guys strange error i get in logs well one of a few but could some one help me with this first one as im learning

    one i was hoping will fix most of the others as seem the same error

    Code:
    o_[11-Mar-2016 12:06:47 UTC] PHP Warning:  Missing argument 2 for trgzen_create_sort_heading_asc_des(), called in /includes/modules/trego_zen/category_row.php on line 125 and defined in ncludes/functions/extra_functions/trego_template_functions.php on line 740

    total error log

    Code:
    [11-Mar-2016 12:06:47 UTC] PHP Warning:  Missing argument 2 for trgzen_create_sort_heading_asc_des(), called in /home/anarchy2/public_html/includes/modules/trego_zen/category_row.php on line 125 and defined in /home/anarchy2/public_html/includes/functions/extra_functions/trego_template_functions.php on line 740
    [11-Mar-2016 12:06:47 UTC] PHP Warning:  Missing argument 3 for trgzen_create_sort_heading_asc_des(), called in /home/anarchy2/public_html/includes/modules/trego_zen/category_row.php on line 125 and defined in /home/anarchy2/public_html/includes/functions/extra_functions/trego_template_functions.php on line 740
    [11-Mar-2016 12:06:47 UTC] PHP Warning:  Missing argument 2 for trgzen_create_sort_heading_asc_des(), called in /home/anarchy2/public_html/includes/templates/trego_zen/templates/tpl_modules_category_product_listing.php on line 38 and defined in /home/anarchy2/public_html/includes/functions/extra_functions/trego_template_functions.php on line 740
    [11-Mar-2016 12:06:47 UTC] PHP Warning:  Missing argument 3 for trgzen_create_sort_heading_asc_des(), called in /home/anarchy2/public_html/includes/templates/trego_zen/templates/tpl_modules_category_product_listing.php on line 38 and defined in /home/anarchy2/public_html/includes/functions/extra_functions/trego_template_functions.php on line 740
    [11-Mar-2016 12:06:47 UTC] PHP Warning:  explode() expects parameter 2 to be string, object given in /home/anarchy2/public_html/includes/functions/banner.php on line 216

    trego_template_functions.php

    Code:
    // Return table heading with sorting capabilities
      function trgzen_create_sort_heading($sortby, $colnum, $heading) {
        global $PHP_SELF;
        $sort_prefix = '';
        if ($sortby) {
    		 $select=(isset($_GET['sort']) && (($_GET['sort']==$colnum.'a') || ($_GET['sort']==$colnum.'d')) )? "selected='selected'":"";
          $sort_prefix = '<option '. $select .' value="'. $colnum.'a">'.$heading.'</option>' ;
        }
    
        return $sort_prefix ;
      }
      
     this is line 740 function trgzen_create_sort_heading_asc_des($sortby, $colnum, $heading){
        global $PHP_SELF;
    
        $sort_prefix = '';
        $sort_suffix = '';
           $orderitm=(substr($sortby, 1, 1));
    	  $colnum= str_replace($orderitm,'',$sortby);
        if ($sortby) {
          $sort_prefix = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('page', 'info', 'sort')) . 'page=1&sort=' . $colnum . ($sortby == $colnum . 'a' ? 'd' : 'a')) . '" title="' . zen_output_string(TEXT_SORT_PRODUCTS . ($sortby == $colnum . 'd' || substr($sortby, 0, 1) != $colnum ? TEXT_ASCENDINGLY : TEXT_DESCENDINGLY) . TEXT_BY . $heading) . '">' ;
          $sort_suffix = (substr($sortby, 0, 1) == $colnum ? (substr($sortby, 1, 1) == 'a' ? '<span class="ascending_direction direction">'.PRODUCT_LIST_SORT_ORDER_ASCENDING.'</span>' : '<span class="descending_direction direction">'.PRODUCT_LIST_SORT_ORDER_DESCENDING.'</span>') : '') . '</a>';
        }
    
        return $sort_prefix . $sort_suffix;
      }
     function trgzen_gridlist_tab($page)
     {
    	 $cont='';
    	 $cont.= '<div class="view-mode">
    			  ';
    	
    			     (defined('PRODUCT_LISTING_LAYOUT_STYLE')? PRODUCT_LISTING_LAYOUT_STYLE: 'rows');
    				  if(isset($_GET['view']) && ($_GET['view']!='columns') )
    				   {   
    						$cont.= '<a class="grid" title="'.HEADING_VIEW_AS_GRID.'" href="'.zen_href_link($page, zen_get_all_get_params(array('view')) . 'view=columns').'" >'.HEADING_VIEW_AS_GRID.'</a>&nbsp;';
    						$cont.= '<div class="list" title="'.HEADING_VIEW_AS_GRID.'">'.HEADING_VIEW_AS_LIST.'</div>';
    				   }
    				   else
    				   {
    					 $cont.= '<div class="grid" title="'.HEADING_VIEW_AS_LIST.'">'.HEADING_VIEW_AS_GRID.'</div>';
    					 $cont.= '<a class="list" title="'.HEADING_VIEW_AS_LIST.'" href="'.zen_href_link($page, zen_get_all_get_params(array('view')) . 'view=rows').'" >'.HEADING_VIEW_AS_LIST.'</a>&nbsp;';
    				   }
    		$cont.= '</div>';  
    		return $cont;
     }
     
     function trgzen_souldout_product($product_id,$box='0')
     {
    	 global $db;
    	     $button_check = $db->Execute("select product_is_call, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
    	     $get_new_prod=trgzen_new_product($products_id);
    	     $get_discount_prod=trgzen_discount_product($products_id);
    		 $get_free_prod=zen_trg_get_productisfree($products_id);
    		 $count_fea=array();
    		 if($get_new_prod==1){$count_fea[]='new';}
    		 if($get_discount_prod==1){$count_fea[]='discount';}
    		 if($get_free_prod!=''){$count_fea[]='free';}
    		 if($button_check->fields['products_quantity'] <= 0){
    		   $count_fea[]='sould';
    	     }
    		 $count_fea=count($count_fea);
    		 if($box==0)
    		 if($count_fea==4){$top_pos=130;}elseif($count_fea==3){$top_pos=100;}elseif($count_fea==2){$top_pos=70;}elseif($count_fea==1){$top_pos=40;}else{$top_pos=10;}
    		 else
    		 if($count_fea==4){$top_pos=90;}elseif($count_fea==3){$top_pos=70;}elseif($count_fea==2){$top_pos=50;}elseif($count_fea==1){$top_pos=30;}else{$top_pos=10;}
    
        
        if($button_check->fields['products_quantity'] <= 0){
          if (SHOW_PRODUCTS_SOLD_OUT_IMAGE=='0') {
            $sould_out_tag = '<div class="sould-product-icon" style="top:'.$top_pos.'px;">'.BUTTON_SOLD_OUT_SMALL_ALT.'</div>';
          } else {
            $sould_out_tag = '<div class="sould-product-icon" style="top:'.$top_pos.'px;">'.zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALL, BUTTON_SOLD_OUT_SMALL_ALT).'</div>';
          }
    	}
    	else
    	{
    		$sould_out_tag='';	
    	}
    
        return $sould_out_tag;
    	
    	
     }
    	
    		function objectToArray($d) 
    	{
    		if (is_object($d)) {

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,691
    Plugin Contributions
    9

    Default Re: please someone with some error fixing knowledge save me

    i have found numerous problems with themeforest purchased templates. despite the templates being "quality checked", they have numerous problems.... it could be valuable to to email the author of the template.

    barring that, it would help to see the following:

    /includes/modules/trego_zen/category_row.php on line 125

    that is where the problem starts.

    include a bunch of the code from above that line.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    Default Re: please someone with some error fixing knowledge save me

    ok thanks yes this is a error that im sure been caused by there bad coding and lack of testing there support is terrible and end up having to fix thing myself or with some help from very nice people like yourself . here is the section of code from that dir .

    /includes/modules/trego_zen/category_row.php

    Code:
    //$lst_lc_text = zen_create_sort_heading($_GET['sort'], $col+1, $lc_text);
    	$list_box_contents[0][$col] = array('text' => $lc_text);
      }
    }
    
    
        $grid_sort = $list_box_contents[0];
    	if ($product_listing_layout_style == 'rows') {
    		$list_box_contents = array();
    		$list_box_contents[0] = array('text' => '');
    	}
    	if ($product_listing_layout_style == 'columns') {
           $list_box_contents = array();
    	}
    	line 125  $listing_asc_des=trgzen_create_sort_heading_asc_des($_GET['sort']);
    	$gridlist_tab='';
       if (defined('PRODUCT_LISTING_LAYOUT_STYLE_CUSTOMER') and PRODUCT_LISTING_LAYOUT_STYLE_CUSTOMER == '1') {
        //echo '<div class="view-mode">' .  array(array('id'=>'rows','text'=>PRODUCT_LISTING_LAYOUT_ROWS),array('id'=>'columns','text'=>PRODUCT_LISTING_LAYOUT_COLUMNS))) . '</div>';

  4. #4
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: please someone with some error fixing knowledge save me

    Quote Originally Posted by mydakota View Post
    hey guys strange error i get in logs well one of a few but could some one help me with this first one as im learning

    one i was hoping will fix most of the others as seem the same error

    Code:
    o_[11-Mar-2016 12:06:47 UTC] PHP Warning:  Missing argument 2 for trgzen_create_sort_heading_asc_des(), called in /includes/modules/trego_zen/category_row.php on line 125 and defined in ncludes/functions/extra_functions/trego_template_functions.php on line 740

    total error log

    Code:
    [11-Mar-2016 12:06:47 UTC] PHP Warning:  Missing argument 2 for trgzen_create_sort_heading_asc_des(), called in /home/anarchy2/public_html/includes/modules/trego_zen/category_row.php on line 125 and defined in /home/anarchy2/public_html/includes/functions/extra_functions/trego_template_functions.php on line 740
    [11-Mar-2016 12:06:47 UTC] PHP Warning:  Missing argument 3 for trgzen_create_sort_heading_asc_des(), called in /home/anarchy2/public_html/includes/modules/trego_zen/category_row.php on line 125 and defined in /home/anarchy2/public_html/includes/functions/extra_functions/trego_template_functions.php on line 740
    [11-Mar-2016 12:06:47 UTC] PHP Warning:  Missing argument 2 for trgzen_create_sort_heading_asc_des(), called in /home/anarchy2/public_html/includes/templates/trego_zen/templates/tpl_modules_category_product_listing.php on line 38 and defined in /home/anarchy2/public_html/includes/functions/extra_functions/trego_template_functions.php on line 740
    [11-Mar-2016 12:06:47 UTC] PHP Warning:  Missing argument 3 for trgzen_create_sort_heading_asc_des(), called in /home/anarchy2/public_html/includes/templates/trego_zen/templates/tpl_modules_category_product_listing.php on line 38 and defined in /home/anarchy2/public_html/includes/functions/extra_functions/trego_template_functions.php on line 740
    [11-Mar-2016 12:06:47 UTC] PHP Warning:  explode() expects parameter 2 to be string, object given in /home/anarchy2/public_html/includes/functions/banner.php on line 216

    trego_template_functions.php

    Code:
    // Return table heading with sorting capabilities
      function trgzen_create_sort_heading($sortby, $colnum, $heading) {
        global $PHP_SELF;
        $sort_prefix = '';
        if ($sortby) {
    		 $select=(isset($_GET['sort']) && (($_GET['sort']==$colnum.'a') || ($_GET['sort']==$colnum.'d')) )? "selected='selected'":"";
          $sort_prefix = '<option '. $select .' value="'. $colnum.'a">'.$heading.'</option>' ;
        }
    
        return $sort_prefix ;
      }
      
     this is line 740 function trgzen_create_sort_heading_asc_des($sortby, $colnum, $heading){
        global $PHP_SELF;
    
        $sort_prefix = '';
        $sort_suffix = '';
           $orderitm=(substr($sortby, 1, 1));
    	  $colnum= str_replace($orderitm,'',$sortby);
        if ($sortby) {
          $sort_prefix = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('page', 'info', 'sort')) . 'page=1&sort=' . $colnum . ($sortby == $colnum . 'a' ? 'd' : 'a')) . '" title="' . zen_output_string(TEXT_SORT_PRODUCTS . ($sortby == $colnum . 'd' || substr($sortby, 0, 1) != $colnum ? TEXT_ASCENDINGLY : TEXT_DESCENDINGLY) . TEXT_BY . $heading) . '">' ;
          $sort_suffix = (substr($sortby, 0, 1) == $colnum ? (substr($sortby, 1, 1) == 'a' ? '<span class="ascending_direction direction">'.PRODUCT_LIST_SORT_ORDER_ASCENDING.'</span>' : '<span class="descending_direction direction">'.PRODUCT_LIST_SORT_ORDER_DESCENDING.'</span>') : '') . '</a>';
        }
    
        return $sort_prefix . $sort_suffix;
      }
     function trgzen_gridlist_tab($page)
     {
    	 $cont='';
    	 $cont.= '<div class="view-mode">
    			  ';
    	
    			     (defined('PRODUCT_LISTING_LAYOUT_STYLE')? PRODUCT_LISTING_LAYOUT_STYLE: 'rows');
    				  if(isset($_GET['view']) && ($_GET['view']!='columns') )
    				   {   
    						$cont.= '<a class="grid" title="'.HEADING_VIEW_AS_GRID.'" href="'.zen_href_link($page, zen_get_all_get_params(array('view')) . 'view=columns').'" >'.HEADING_VIEW_AS_GRID.'</a>&nbsp;';
    						$cont.= '<div class="list" title="'.HEADING_VIEW_AS_GRID.'">'.HEADING_VIEW_AS_LIST.'</div>';
    				   }
    				   else
    				   {
    					 $cont.= '<div class="grid" title="'.HEADING_VIEW_AS_LIST.'">'.HEADING_VIEW_AS_GRID.'</div>';
    					 $cont.= '<a class="list" title="'.HEADING_VIEW_AS_LIST.'" href="'.zen_href_link($page, zen_get_all_get_params(array('view')) . 'view=rows').'" >'.HEADING_VIEW_AS_LIST.'</a>&nbsp;';
    				   }
    		$cont.= '</div>';  
    		return $cont;
     }
     
     function trgzen_souldout_product($product_id,$box='0')
     {
    	 global $db;
    	     $button_check = $db->Execute("select product_is_call, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
    	     $get_new_prod=trgzen_new_product($products_id);
    	     $get_discount_prod=trgzen_discount_product($products_id);
    		 $get_free_prod=zen_trg_get_productisfree($products_id);
    		 $count_fea=array();
    		 if($get_new_prod==1){$count_fea[]='new';}
    		 if($get_discount_prod==1){$count_fea[]='discount';}
    		 if($get_free_prod!=''){$count_fea[]='free';}
    		 if($button_check->fields['products_quantity'] <= 0){
    		   $count_fea[]='sould';
    	     }
    		 $count_fea=count($count_fea);
    		 if($box==0)
    		 if($count_fea==4){$top_pos=130;}elseif($count_fea==3){$top_pos=100;}elseif($count_fea==2){$top_pos=70;}elseif($count_fea==1){$top_pos=40;}else{$top_pos=10;}
    		 else
    		 if($count_fea==4){$top_pos=90;}elseif($count_fea==3){$top_pos=70;}elseif($count_fea==2){$top_pos=50;}elseif($count_fea==1){$top_pos=30;}else{$top_pos=10;}
    
        
        if($button_check->fields['products_quantity'] <= 0){
          if (SHOW_PRODUCTS_SOLD_OUT_IMAGE=='0') {
            $sould_out_tag = '<div class="sould-product-icon" style="top:'.$top_pos.'px;">'.BUTTON_SOLD_OUT_SMALL_ALT.'</div>';
          } else {
            $sould_out_tag = '<div class="sould-product-icon" style="top:'.$top_pos.'px;">'.zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALL, BUTTON_SOLD_OUT_SMALL_ALT).'</div>';
          }
    	}
    	else
    	{
    		$sould_out_tag='';	
    	}
    
        return $sould_out_tag;
    	
    	
     }
    	
    		function objectToArray($d) 
    	{
    		if (is_object($d)) {
    Quote Originally Posted by mydakota View Post
    ok thanks yes this is a error that im sure been caused by there bad coding and lack of testing there support is terrible and end up having to fix thing myself or with some help from very nice people like yourself . here is the section of code from that dir .

    /includes/modules/trego_zen/category_row.php

    Code:
    //$lst_lc_text = zen_create_sort_heading($_GET['sort'], $col+1, $lc_text);
    	$list_box_contents[0][$col] = array('text' => $lc_text);
      }
    }
    
    
        $grid_sort = $list_box_contents[0];
    	if ($product_listing_layout_style == 'rows') {
    		$list_box_contents = array();
    		$list_box_contents[0] = array('text' => '');
    	}
    	if ($product_listing_layout_style == 'columns') {
           $list_box_contents = array();
    	}
    	line 125  $listing_asc_des=trgzen_create_sort_heading_asc_des($_GET['sort']);
    	$gridlist_tab='';
       if (defined('PRODUCT_LISTING_LAYOUT_STYLE_CUSTOMER') and PRODUCT_LISTING_LAYOUT_STYLE_CUSTOMER == '1') {
        //echo '<div class="view-mode">' .  array(array('id'=>'rows','text'=>PRODUCT_LISTING_LAYOUT_ROWS),array('id'=>'columns','text'=>PRODUCT_LISTING_LAYOUT_COLUMNS))) . '</div>';
    Looks like if, 1) your output/screen display is fine, but you are just getting those warnings logged, then changing:
    Code:
     this is line 740 function trgzen_create_sort_heading_asc_des($sortby, $colnum, $heading){
    To:
    Code:
     this is line 740 function trgzen_create_sort_heading_asc_des($sortby, $colnum='', $heading=''){
    Will resolve those warnings. Btw, $colnum doesn't even get used so technically doesn't need to be there, but resolving that would be "more trouble than it is worth".
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,691
    Plugin Contributions
    9

    Default Re: please someone with some error fixing knowledge save me

    ok i will give you two choices. hopefully one of them works for you... replace line 125 with either one of these and let's see if something becomes acceptable:

    PHP Code:
    $listing_asc_des=trgzen_create_sort_heading_asc_des($_GET['sort'], $col+1$lc_text);

    // or try:

    $listing_asc_des=trgzen_create_sort_heading_asc_des($_GET['sort'], ''''); 
    both lines will hopefully resolve your error. the question remains as to whether the headings, columns, and sort are what you expect.

    good luck!
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  6. #6
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: please someone with some error fixing knowledge save me

    Quote Originally Posted by carlwhat View Post
    i have found numerous problems with themeforest purchased templates. despite the templates being "quality checked", they have numerous problems.... it could be valuable to to email the author of the template.
    Keep well away from Themeforest... You'll be spending more time on this forum (after pulling out most of your hair) crying your eyes out for help, than you will on selling your goods.

    There are plenty of good templates offered by zencart experts on this forum. Dump that Themeforrest rubbish.
    20 years a Zencart User

  7. #7
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    Default Re: please someone with some error fixing knowledge save me

    thanks guys for the help and info i m away for work and cant try the things you have said but thank you for this info i will give them ago asap and
    yes this trego/themeforest theme has been a nightmare full of bugs grr

  8. #8
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    Default Re: please someone with some error fixing knowledge save me

    Code:
    this is line 740 function trgzen_create_sort_heading_asc_des($sortby, $colnum='', $heading=''){
    this seems to have worked well don't get error and haven't found any side affects as yet lol ill will keep looking for any issues that may get caused
    basicaly all my errors in logs are gone except for this one lol

    Code:
    [14-Mar-2016 04:40:59 UTC] PHP Warning:  explode() expects parameter 2 to be string, object given in /home/anarchy2/public_html/includes/functions/banner.php on line 216
    Code:
    // build banner groups
      function zen_build_banners_group($selected_banners) {
     line 216   $selected_banners = explode(':', $selected_banners);
        $size = sizeof($selected_banners);
        if ($size == 1) {
          $new_banner_search = " banners_group = '" . $selected_banners[0] . "'";
        } else {
          for ($i=0, $n=$size; $i<$n; $i+=1) {
            $new_banner_search .= " banners_group = '" . $selected_banners[$i] . "'";
            if ($i+1 < $n) {
              $new_banner_search .= ' or ';
            }
          }
        }
        if ($new_banner_search != '') {
          $new_banner_search = ' and (' . $new_banner_search . ')';
        }
        return $new_banner_search;
      }
    ?>
    can i possibly do the same with it

  9. #9
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: please someone with some error fixing knowledge save me

    When trying to resolve a problem, (error log reported), one solution does not necessarily work for all fixes. Besides that there is information missing from the posted error log that would help identify what is going on for this error. It is always best to provide the complete log (obscuring any admin directory specifics and if provided any database credentials). Besides that, two things, as stated before if keeping with this template, expect to come across issues, and the other thing while the chosen solution has eliminated errors related to that function as carlwhat pointed out in one of his it could be possible to pass information to the function that could be displayed as the third parameter to the function.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #10
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    Default Re: please someone with some error fixing knowledge save me

    Quote Originally Posted by mc12345678 View Post
    When trying to resolve a problem, (error log reported), one solution does not necessarily work for all fixes. Besides that there is information missing from the posted error log that would help identify what is going on for this error. It is always best to provide the complete log (obscuring any admin directory specifics and if provided any database credentials). Besides that, two things, as stated before if keeping with this template, expect to come across issues, and the other thing while the chosen solution has eliminated errors related to that function as carlwhat pointed out in one of his it could be possible to pass information to the function that could be displayed as the third parameter to the function.
    unfortunately that is the complete log ill try again this time ill remove the info you suggested thanks ill have to change the name details now lol
    thanks for your help

    Code:
    [14-Mar-2016 17:19:00 UTC] PHP Warning:  trim() expects parameter 1 to be string, array given in  /includes/functions/functions_general.php on line 63
    [14-Mar-2016 17:19:00 UTC] PHP Warning:  explode() expects parameter 2 to be string, object given in  /includes/functions/banner.php on line 216
    Code:
    <?php
    /**
     * banner functions
     *
     * @package functions
     * @copyright Copyright 2003-2010 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: banner.php 15580 2010-02-25 15:53:36Z ajeh $
     */
    
    ////
    // Set the status of a banner
      function zen_set_banner_status($banners_id, $status) {
        global $db;
        if ($status == '1') {
          $sql = "update " . TABLE_BANNERS . "
                  set status = 1, date_status_change = now(), date_scheduled = NULL
                  where banners_id = '" . (int)$banners_id . "'";
    
          return $db->Execute($sql);
    
        } elseif ($status == '0') {
          $sql = "update " . TABLE_BANNERS . "
                  set status = 0, date_status_change = now()
                  where banners_id = '" . (int)$banners_id . "'";
    
          return $db->Execute($sql);
    
        } else {
          return -1;
        }
      }
    
    ////
    // Auto activate banners
      function zen_activate_banners() {
        global $db;
        $banners_query = "select banners_id, date_scheduled
                          from " . TABLE_BANNERS . "
                          where date_scheduled != 'NULL'";
    
        $banners = $db->Execute($banners_query);
    
        if ($banners->RecordCount() > 0) {
          while (!$banners->EOF) {
            if (date('Y-m-d H:i:s') >= $banners->fields['date_scheduled']) {
              zen_set_banner_status($banners->fields['banners_id'], '1');
            }
            $banners->MoveNext();
          }
        }
      }
    
    ////
    // Auto expire banners
      function zen_expire_banners() {
        global $db;
        $banners_query = "select b.banners_id, b.expires_date, b.expires_impressions,
                                 sum(bh.banners_shown) as banners_shown
                          from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_HISTORY . " bh
                          where b.status = 1
                          and b.banners_id = bh.banners_id
                          group by b.banners_id, b.expires_date, b.expires_impressions";
    
        $banners = $db->Execute($banners_query);
    
        if ($banners->RecordCount() > 0) {
          while (!$banners->EOF) {
            if (zen_not_null($banners->fields['expires_date'])) {
              if (date('Y-m-d H:i:s') >= $banners->fields['expires_date']) {
                zen_set_banner_status($banners->fields['banners_id'], '0');
              }
            } elseif (zen_not_null($banners->fields['expires_impressions'])) {
              if ( ($banners->fields['expires_impressions'] > 0) && ($banners->fields['banners_shown'] >= $banners->fields['expires_impressions']) ) {
                zen_set_banner_status($banners->fields['banners_id'], '0');
              }
            }
            $banners->MoveNext();
          }
        }
      }
    
    ////
    // Display a banner from the specified group or banner id ($identifier)
      function zen_display_banner($action, $identifier) {
        global $db, $request_type;
    
        switch ($request_type) {
          case ('SSL'):
            $my_banner_filter=" and banners_on_ssl= " . "1 ";
            break;
          case ('NONSSL'):
            $my_banner_filter='';
            break;
        }
    
        if ($action == 'dynamic') {
          $new_banner_search = zen_build_banners_group($identifier);
    
          $banners_query = "select count(*) as count
                            from " . TABLE_BANNERS . "
                               where status = '1' " .
                               $new_banner_search . $my_banner_filter;
    
          $banners = $db->Execute($banners_query);
    
          if ($banners->fields['count'] > 0) {
            $banner = $db->Execute("select banners_id, banners_title, banners_image, banners_html_text, banners_open_new_windows, banners_url
                                   from " . TABLE_BANNERS . "
                                   where status = 1 " .
                                   $new_banner_search . $my_banner_filter . " order by rand()");
    
          } else {
            return '<p class="alert">ZEN ERROR! (zen_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</p>';
    line 216     }
        } elseif ($action == 'static') {
          if (is_object($identifier)) {
            $banner = $identifier;
          } else {
            $banner_query = "select banners_id, banners_title, banners_image, banners_html_text, banners_open_new_windows, banners_url
                             from " . TABLE_BANNERS . "
                             where status = 1
                             and banners_id = '" . (int)$identifier . "'" . $my_banner_filter;
    
            $banner = $db->Execute($banner_query);
    
            if ($banner->RecordCount() < 1) {
              //return '<strong>ZEN ERROR! (zen_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</strong>';
            }
          }
        } else {
          return '<p class="alert">ZEN ERROR! (zen_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</p>';
        }
    
        if (zen_not_null($banner->fields['banners_html_text'])) {
          $banner_string = $banner->fields['banners_html_text'];
        } else {
          if ($banner->fields['banners_url'] == '') {
            $banner_string = zen_image(DIR_WS_IMAGES . $banner->fields['banners_image'], $banner->fields['banners_title']);
          } else {
            if ($banner->fields['banners_open_new_windows'] == '1') {
              $banner_string = '<a href="' . zen_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner->fields['banners_id']) . '" target="_blank">' . zen_image(DIR_WS_IMAGES . $banner->fields['banners_image'], $banner->fields['banners_title']) . '</a>';
            } else {
              $banner_string = '<a href="' . zen_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner->fields['banners_id']) . '">' . zen_image(DIR_WS_IMAGES . $banner->fields['banners_image'], $banner->fields['banners_title']) . '</a>';
            }
          }
        }
    
        zen_update_banner_display_count($banner->fields['banners_id']);
    
        return $banner_string;
      }
    
    ////
    // Check to see if a banner exists
      function zen_banner_exists($action, $identifier) {
        global $db, $request_type;
    
        switch ($request_type) {
          case ('SSL'):
            $my_banner_filter=" and banners_on_ssl= " . "1 ";
            break;
          case ('NONSSL'):
            $my_banner_filter='';
            break;
        }
    
        if ($action == 'dynamic') {
          $new_banner_search = zen_build_banners_group($identifier);
          return $db->Execute("select banners_id, banners_title, banners_image, banners_html_text, banners_open_new_windows, banners_url
                               from " . TABLE_BANNERS . "
                                   where status = 1 " .
                                   $new_banner_search . $my_banner_filter . " order by rand()");
        } elseif ($action == 'static') {
          $banner_query = "select banners_id, banners_title, banners_image, banners_html_text, banners_open_new_windows, banners_url
                           from " . TABLE_BANNERS . "
                           where status = 1
                           and banners_id = '" . (int)$identifier . "'" . $my_banner_filter;
    
          return $banner = $db->Execute($banner_query);
        } else {
          return false;
        }
      }
    
    ////
    // Update the banner display statistics
      function zen_update_banner_display_count($banner_id) {
        global $db;
        $banner_check = $db->Execute(sprintf(SQL_BANNER_CHECK_QUERY, (int)$banner_id));
    
        if ($banner_check->fields['count'] > 0) {
    
          $db->Execute(sprintf(SQL_BANNER_CHECK_UPDATE, (int)$banner_id));
    
        } else {
          $sql = "insert into " . TABLE_BANNERS_HISTORY . "
                         (banners_id, banners_shown, banners_history_date)
                  values ('" . (int)$banner_id . "', 1, now())";
    
          $db->Execute($sql);
        }
      }
    
    ////
    // Update the banner click statistics
      function zen_update_banner_click_count($banner_id) {
        global $db;
        $db->Execute(sprintf(SQL_BANNER_UPDATE_CLICK_COUNT, (int)$banner_id));
      }
    
    ////
    // build banner groups
      function zen_build_banners_group($selected_banners) {
        $selected_banners = explode(':', $selected_banners);
        $size = sizeof($selected_banners);
        if ($size == 1) {
          $new_banner_search = " banners_group = '" . $selected_banners[0] . "'";
        } else {
          for ($i=0, $n=$size; $i<$n; $i+=1) {
            $new_banner_search .= " banners_group = '" . $selected_banners[$i] . "'";
            if ($i+1 < $n) {
              $new_banner_search .= ' or ';
            }
          }
        }
        if ($new_banner_search != '') {
          $new_banner_search = ' and (' . $new_banner_search . ')';
        }
        return $new_banner_search;
      }
    ?>
    i think you maybe right about this theme any suggestions on good replacement ones that are responsive e.g works on phones and ipads and have a proven track record omg themeforest sucks just hope i don't have to start from scratch .

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 15 Jun 2012, 05:43 PM
  2. Please help on fixing issue display with IE6
    By solo_400 in forum General Questions
    Replies: 2
    Last Post: 17 Dec 2009, 03:59 PM
  3. Replies: 7
    Last Post: 4 Aug 2009, 12:53 PM
  4. Error with tpl_header.php file. FILE ATTACHED PLEASE SOMEONE SPOT ERROR
    By Canvas101 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 26 May 2008, 08:58 AM
  5. Can Someone please shed some light on this...
    By AndrewClarke in forum General Questions
    Replies: 6
    Last Post: 20 Jan 2007, 07:57 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR