Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23
  1. #21
    Join Date
    Aug 2007
    Location
    Amarillo, Tx
    Posts
    1,674
    Plugin Contributions
    0

    Default Re: move Sub Categories Count

    I have put the code in where you selected here :

    Code:
    <?php
    /**
     * index category_row.php
     *
     * Prepares the content for displaying a category's sub-category listing in grid format.  
     * Once the data is prepared, it calls the standard tpl_list_box_content template for display.
     *
     * @package page
     * @copyright Copyright 2003-2006 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: category_row.php 4084 2006-08-06 23:59:36Z drbyte $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    $title = '';
    $num_categories = $categories->RecordCount();
    
    $row = 0;
    $col = 0;
    $list_box_contents = '';
    if ($num_categories > 0) {
      if ($num_categories < MAX_DISPLAY_CATEGORIES_PER_ROW || MAX_DISPLAY_CATEGORIES_PER_ROW == 0) {
        $col_width = floor(100/$num_categories);
      } else {
        $col_width = floor(100/MAX_DISPLAY_CATEGORIES_PER_ROW);
      }
    
      while (!$categories->EOF) {
        if (!$categories->fields['categories_image']) !$categories->fields['categories_image'] = 'pixel_trans.gif';
        $cPath_new = zen_get_path($categories->fields['categories_id']);
    
        // strip out 0_ from top level cats
    $cPath_new = str_replace('=0_', '=', $cPath_new);
    
    // ################################################## ################
    $myCatID = substr($cPath_new, -3);
    // $categories->fields['products_name'] = zen_get_products_name($categories->fields['products_id']);
    
    $check_categories = $db->Execute("select products_id from " . TABLE_PRODUCTS . " where
    master_categories_id = '".$myCatID."'");
    if ($check_categories->RecordCount() > 0) {
    // create number here
    $recordCount = $check_categories->RecordCount();
    }
    
    $countContent = CATEGORIES_COUNT_PREFIX . $recordCount . CATEGORIES_COUNT_SUFFIX;
    
    
    $list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories->fields['categories_name'].' '.$countContent.'</a>');
    // ################################################## ################
    $col ++;
    
    
        //    $categories->fields['products_name'] = zen_get_products_name($categories->fields['products_id']);
    
        $list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
                                               'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories->fields['categories_name'] . '</a>');
    
        $col ++;
        if ($col > (MAX_DISPLAY_CATEGORIES_PER_ROW -1)) {
          $col = 0;
          $row ++;
        }
        $categories->MoveNext();
      }
    }
    ?>
    and I am getting double listings.

  2. #22
    Join Date
    Oct 2006
    Posts
    6
    Plugin Contributions
    0

    Default Re: move Sub Categories Count

    you didn't put it in the right place. Can you see where you have col++ written twice at the bottom of the file? Your paste should have covered the second col++, replacing it with the first.

    I've noticed some other issues and I'll also perfect the category choosing thing. I'll post the entire file here for you in a couple of hours.

  3. #23
    Join Date
    Oct 2006
    Posts
    6
    Plugin Contributions
    0

    Default Re: move Sub Categories Count

    problem solved: works perfectly on my site (http://www.digitechstop.com)

    content of includes/modules/category_row.php:

    <?php
    /**
    * index category_row.php
    *
    * Prepares the content for displaying a category's sub-category listing in grid format.
    * Once the data is prepared, it calls the standard tpl_list_box_content template for display.
    *
    * @package page
    * @copyright Copyright 2003-2006 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: category_row.php 4084 2006-08-06 23:59:36Z drbyte $
    */
    if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
    }
    $title = '';
    $num_categories = $categories->RecordCount();

    $row = 0;
    $col = 0;
    $list_box_contents = '';
    if ($num_categories > 0) {
    if ($num_categories < MAX_DISPLAY_CATEGORIES_PER_ROW || MAX_DISPLAY_CATEGORIES_PER_ROW == 0) {
    $col_width = floor(100/$num_categories);
    } else {
    $col_width = floor(100/MAX_DISPLAY_CATEGORIES_PER_ROW);
    }

    while (!$categories->EOF) {
    if (!$categories->fields['categories_image']) !$categories->fields['categories_image'] = 'pixel_trans.gif';
    $cPath_new = zen_get_path($categories->fields['categories_id']);

    // strip out 0_ from top level cats
    $cPath_new = str_replace('=0_', '=', $cPath_new);

    // explode the path to extract number of levels in category tree
    $fullCatID= explode("_",$cPath_new);
    // take the final level because it is the category whose contents are being displayed at current time
    $myCatID = $fullCatID[sizeof($fullCatID)-1];

    // fixer for when category is empty and not filled with subcategories
    // check to see if myCatID is a parent category
    $parentCheckQuery = "select parent_id from " . TABLE_CATEGORIES . "
    where parent_id = '".$myCatID."'";

    $check_parent = $db->Execute($parentCheckQuery);
    if ($check_parent->RecordCount() > 0) {
    // it is a parent, so do not show total here
    $countContent = '';

    } else {

    // $categories->fields['products_name'] = zen_get_products_name($categories->fields['products_id']);
    $catQuery = "select products_id from " . TABLE_PRODUCTS . "
    where master_categories_id = '".$myCatID."'";

    $check_categories = $db->Execute($catQuery);
    if ($check_categories->RecordCount() > 0) {
    // create number of items in category here
    $recordCount = $check_categories->RecordCount();
    $countContent = CATEGORIES_COUNT_PREFIX . $recordCount . CATEGORIES_COUNT_SUFFIX;
    } else {$countContent = CATEGORIES_COUNT_PREFIX . '0' . CATEGORIES_COUNT_SUFFIX;}
    } // end else of parent check



    $list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories->fields['categories_name'].' '.$countContent.'</a>');

    $col ++;
    if ($col > (MAX_DISPLAY_CATEGORIES_PER_ROW -1)) {
    $col = 0;
    $row ++;
    }
    $categories->MoveNext();
    }
    }
    ?>

 

 
Page 3 of 3 FirstFirst 123

Similar Threads

  1. Replies: 1
    Last Post: 12 Mar 2011, 07:18 AM
  2. Sub Categories under sub categories, can that be done?
    By pebblecrossing in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 9 Feb 2011, 09:46 PM
  3. Move Product Count to Breadcrumbs Bar
    By creative_mind in forum General Questions
    Replies: 2
    Last Post: 20 Nov 2009, 05:17 AM
  4. sub-categories product count management
    By keneso in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 25 Jul 2009, 09:51 AM
  5. Show sub-sub categories underneath sub-categories on the category page?
    By tomrice in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 18 Jun 2009, 03:05 AM

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