Jump to content
Latest News: (loading..)

Search the Community

Showing results for tags 'function'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News and Announcements
    • News and Announcements
    • Partner Announcements
    • Ambassadors
  • Commercial Support
    • Developer Feedback
  • osCommerce Online Merchant v2.x
    • General Support
    • Installation and Configuration
    • Upgrading from Earlier Versions (v2.x to v2.x)
    • Add-Ons
    • Tips and Tricks
    • Security
  • Development
    • osCommerce Online Merchant v2.4
    • osCommerce Online Merchant Community Bootstrap Edition
    • osCommerce Online Merchant v3.x
    • Development Proposals
  • General
    • OSCOMMERCE.TV
    • Next Steps / Optimizations / Marketing
    • Live Shop Reviews
    • E-Commerce Laws
    • General Discussions
    • PHP / SQL / Web Design
  • Club osC's Announcements
  • PayPal's Announcements
  • Sage Pay's Announcements
  • Solomono - new level osCommerce templates's Announcements
  • German Community's OSCOM v2.x
  • German Community's Allgemein
  • German Community's OSCOM v3.x

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Real Name


Location


Interests


Website


Skype

Found 3 results

  1. I did not and don't like the recursive function tep_get_categories() and the how the categories get drawn into the categories box. So I created a function that draws the categories tree (expanded or not). It uses only one query for the categories. So its faster than the default. It uses <ul> list tags. It produces full tree code even if $drawExpanded=false, that way you can use css3 or jquery menu so to popup on hover-click the hidden subcategories, any length of subcategories. Things to be done replace that recursive function tep_count_products_in_category when displaying the number of products under each category. Hope you like it. Check images: Tree fully expanded Tree expanded only if page in categories Produced Code Code : http://pastebin.com/puCzrASC or: //tep_draw_categories_tree function tep_draw_categories_tree($drawExpanded=false,$root_id = 0,$mainUlClass='',$submenuUlClass='submenu'){ global $languages_id,$cPath_array; //GET ALL CATEGORIES $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); $items = array(); while ($categories = tep_db_fetch_array($categories_query)) { $items[$categories['categories_id']] = array('name' => $categories['categories_name'], 'parent_id' => $categories['parent_id'], 'id' => $categories['categories_id']); } $citems=count($items); if($citems<=0) return ''; elseif($citems==1) $children[] = $items; //in case we have one category item without subcategories, rare but possible else foreach( $items as $item ) $children[$item['parent_id']][] = $item; // loop will be false if the root has no children (i.e., an empty categories!) $loop = !empty( $children[$root_id] ); $parent = $root_id; $parent_stack = array(); $html=array();//store html code $stack=array();//helper array so to know the current level $pic=''; //products_in_category string $html[]='<ul class="'.$mainUlClass.'">'; while ( $loop && ( ( $option = each( $children[$parent] ) ) || ( $parent > $root_id ) ) ){ if ( $option === false ){ $parent = array_pop( $parent_stack ); $html[] = str_repeat( "\t", ( count( $parent_stack ) + 1 ) * 2 ) . '</ul>'; $html[] = str_repeat( "\t", ( count( $parent_stack ) + 1 ) * 2 - 1 ) . '</li>'; array_pop( $stack ); }elseif ( !empty( $children[$option['value']['id']] ) ){ $tab = str_repeat( "\t", ( count( $parent_stack ) + 1 ) * 2 - 1 ); $stack[]=$option['value']['id']; $rt=$root_id>0 ? $root_id.'_' : ''; $cpath_new=count($stack)<=0 ? 'cPath='.$rt.$option['value']['id'] : 'cPath='.$rt.implode('_',$stack); $html[]=$tab.'<li><a href="'.tep_href_link(FILENAME_DEFAULT, $cpath_new).'">'; if (SHOW_COUNTS == 'true') { //THIS SHOULD BE CHANGED SO NOT TO USE tep_count_products_in_category WHICH IS RECURSIVE $products_in_category = tep_count_products_in_category($option['value']['id']); if ($products_in_category > 0) { $pic=' (' . $products_in_category . ')'; } } $sm=0; if((isset($cPath_array) && in_array($option['value']['id'], $cPath_array))){ $sm=1; $html[]='<strong>'.stripslashes($option['value']['name']).'->'.$pic.'</strong>'; }else{ $html[]=stripslashes($option['value']['name']).'->'.$pic; } $html[]='</a>'; $html[] = $tab . "\t" . '<ul class="'.$submenuUlClass.'" style="'.($sm!==1 && !$drawExpanded ?'display:none;':'').'">'; $parent_stack[]=$option['value']['parent_id']; $parent = $option['value']['id']; }else{ $rt=$root_id>0 ? $root_id.'_' : ''; $cpath_new= count($stack)<=0 ? 'cPath='.$rt.$option['value']['id'] : 'cPath='.$rt.implode('_',$stack).'_'.$option['value']['id']; $html[]=str_repeat( "\t", ( count( $parent_stack ) + 1 ) * 2 - 1 ).'<li><a href="'.tep_href_link(FILENAME_DEFAULT, $cpath_new).'" >'; if (SHOW_COUNTS == 'true') { //THIS SHOULD BE CHANGED SO NOT TO USE tep_count_products_in_category WHICH IS RECURSIVE $products_in_category = tep_count_products_in_category($option['value']['id']); if ($products_in_category > 0) { $pic=' (' . $products_in_category . ')'; } } if (isset($cPath_array) && in_array($option['value']['id'], $cPath_array)) { $html[]='<strong>'.stripslashes($option['value']['name']).$pic.'</strong>'; }else{ $html[]=stripslashes($option['value']['name']).$pic; } $html[]='</a></li>'; } } $html[]='</ul>'; echo implode( "\r\n", $html ); } //tep_draw_categories_tree
  2. Hi, i found this problem Fatal error: Call to undefined function tep_gridlist_build() in /var/www/vhosts/nukua.es/httpdocs/topsellers_products.php on line 31 $best_sellers_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name, m.manufacturers_id from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_ordered desc, pd.products_name"; $best_sellers_split = new splitPageResults($best_sellers_query_raw, MAX_DISPLAY_PRODUCTS_BESTSELLER); if ($best_sellers_split->number_of_rows > 0) { echo tep_gridlist_build(); } I have not found in the original 2.3.4 gold files this function. Regards
  3. Hi all, sort_order field has no functionality in configuration table. We dont need it.. Many of installation process and addons use it for nothing. Only one place used in admin/configuration.php sql query code without any results. Change DROP TABLE IF EXISTS configuration; CREATE TABLE configuration ( configuration_id int NOT NULL auto_increment, configuration_title varchar(255) NOT NULL, configuration_key varchar(255) NOT NULL, configuration_value text NOT NULL, configuration_description varchar(255) NOT NULL, configuration_group_id int NOT NULL, sort_order int(5) NULL, last_modified datetime NULL, date_added datetime NOT NULL, use_function varchar(255) NULL, set_function varchar(255) NULL, PRIMARY KEY (configuration_id) ) CHARACTER SET utf8 COLLATE utf8_unicode_ci; to: DROP TABLE IF EXISTS configuration; CREATE TABLE configuration ( configuration_id int NOT NULL auto_increment, configuration_title varchar(255) NOT NULL, configuration_key varchar(255) NOT NULL, configuration_value text NOT NULL, configuration_description varchar(255) NOT NULL, configuration_group_id int NOT NULL, last_modified datetime NULL, date_added datetime NOT NULL, use_function varchar(255) NULL, set_function varchar(255) NULL, PRIMARY KEY (configuration_id) ) CHARACTER SET utf8 COLLATE utf8_unicode_ci; This code change require a lot of modification in oscommerce.sql and thousands of modules. Any thoughts and feedback would be appreciated.
×