Page 9 of 9 FirstFirst ... 789
Results 81 to 85 of 85
  1. #81
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: Help with some PHP editing a new template (Picaflor)

    Perhaps this should be moved to the "BetterCategories" support thread so that anyone using that mod will also benefit from the answer..
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

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

    Default Re: Help with some PHP editing a new template (Picaflor)

    Yes, definitely do that. The only support thread I can find is here:
    http://www.zen-cart.com/showthread.p...ib-amp-ezpages

  3. #83
    Join Date
    Jan 2013
    Posts
    104
    Plugin Contributions
    0

    Default Re: Help with some PHP editing a new template (Picaflor)

    Quote Originally Posted by gjh42 View Post
    You have the BetterCategories version of tpl_categories.php, not the stock version as kobra was working from in his advice, so the organization may be different. We would need to see the whole links section of the file (before your modifications) to be sure of a safe way of moving links.
    Hmm, I thought I was using the correct one, where is the stock version kept?

    Here is the entire code:

    Code:
    <?php
    /**
     * Side Box Template
     *
     * @package templateSystem
     * @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: tpl_categories.php 4162 2006-08-17 03:55:02Z ajeh $
     *
     * BetterCategoriesEzInfo v1.3.5 added  2006-09-19  gilby
     */
    
      $spacer = '';
      // uncomment next line to add 1 space between image & text
      // $spacer .= '&nbsp;';
    
    
      $content = "";
      
       $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";
        if (SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
          $content .= '<a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_ALL) . '">' . CATEGORIES_BOX_HEADING_PRODUCTS_ALL . '</a>' . "\n";
        }
    	$content .= '' . "\n";
      for ($i=0;$i<sizeof($box_categories_array);$i++) {
        switch(true) {
    // to make a specific category stand out define a new class in the stylesheet example: A.category-holiday
    // uncomment the select below and set the cPath=3 to the cPath= your_categories_id
    // many variations of this can be done
    //      case ($box_categories_array[$i]['path'] == 'cPath=3'):
    //        $new_style = 'category-holiday';
    //        break;
          case ($box_categories_array[$i]['top'] == 'true'):
            $new_style = 'category-top';
            break;
          case ($box_categories_array[$i]['has_sub_cat']):
            $new_style = 'category-subs';
            break;
          default:
            $new_style = 'category-products';
          }
         if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
            // skip if this is for the document box (==3)
          } else {
           $content .= '<div class="betterCategories"><a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
    	  if ($box_categories_array[$i]['current']) {
            if ($box_categories_array[$i]['has_sub_cat']) {
              $content .= '<span class="category-subs-parent">';
              $content .= cat_with_pointer($box_categories_array[$i]['name'], 'down', $spacer);
              $content .= '</span>';
            } else {
              $content .= '<span class="category-subs-selected">';
              $content .= cat_with_pointer($box_categories_array[$i]['name'], 'nosub', $spacer);
              $content .= '</span>';
            }
          } else {
            if ($box_categories_array[$i]['has_sub_cat']) { 
            $content .= cat_with_pointer($box_categories_array[$i]['name'], 'right', $spacer); }
            else { 
            $content .= cat_with_pointer($box_categories_array[$i]['name'], 'nosub', $spacer); }
          }
    
          if ($box_categories_array[$i]['has_sub_cat']) {
            $content .= CATEGORIES_SEPARATOR;
          }
          //$content .= '</a>';
    
          if (SHOW_COUNTS == 'true') {
            if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
              $content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
            }
          }
    
          $content .= '</a></div>';
        }
      }
    
      if (SHOW_CATEGORIES_BOX_SPECIALS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true' or SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
    // display a separator between categories and links
        if (SHOW_CATEGORIES_SEPARATOR_LINK == '1') {
    //      $content .= '<br />' . zen_draw_separator('pixel_silver.gif') . '<br />';
    //      $content .= '<hr id="catBoxDivider" />' . "\n";
          $content .= '<br style="line-height: 0;" />' . '<hr id="catBoxDivider" />' . '<br style="line-height: 0;" />';
        }
        if (SHOW_CATEGORIES_BOX_SPECIALS == 'true') {
          $show_this = $db->Execute("select s.products_id from " . TABLE_SPECIALS . " s where s.status= 1 limit 1");
          if ($show_this->RecordCount() > 0) {
            $content .= '<div class="betterCategories"><a class="category-links" href="' . zen_href_link(FILENAME_SPECIALS) . '">';
            $content .= zen_image(DIR_WS_TEMPLATE_IMAGES . 'bc_cat_boxes.gif') . $spacer;
            $content .= CATEGORIES_BOX_HEADING_SPECIALS . '</a></div>';
          }
        }
        if (SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true') {
          // display limits
    //      $display_limit = zen_get_products_new_timelimit();
          $display_limit = zen_get_new_date_range();
    
          $show_this = $db->Execute("select p.products_id
                                     from " . TABLE_PRODUCTS . " p
                                     where p.products_status = 1 " . $display_limit . " limit 1");
          if ($show_this->RecordCount() > 0) {
            $content .= '<div class="betterCategories"><a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">';
            $content .= zen_image(DIR_WS_TEMPLATE_IMAGES . 'bc_cat_boxes.gif') . $spacer;
            $content .= CATEGORIES_BOX_HEADING_WHATS_NEW . '</a></div>';
          }
        }
        if (SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true') {
          $show_this = $db->Execute("select products_id from " . TABLE_FEATURED . " where status= 1 limit 1");
          if ($show_this->RecordCount() > 0) {
            $content .= '<div class="betterCategories"><a class="category-links" href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">';
            $content .= zen_image(DIR_WS_TEMPLATE_IMAGES . 'bc_cat_boxes.gif') . $spacer;
            $content .= CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS . '</a></div>';
          }
        }
        
      }
      
      //this is the function that inserts the 'pointer' (or 'disclosure triangle')
      //before the name of the category, in the 'Categories' sidebox.
      //$categoryName should be a string as contained in 
      //$box_categories_array[$i]['name'] above, which already includes
      //the category name with all the necessary subcategory indents up front,
      //as specified by the user in the Admin Panel.
      //$categoryType will be either 'down', 'right' or 'nosub', which 
      //specifies which picture appears next to the category name:
      function cat_with_pointer( $categoryName, $categoryType, $spacer) {
      
      	//picking the appropriate pointer image:
      	switch ($categoryType) {
      		case "down":
      			$pointer = zen_image(DIR_WS_TEMPLATE_IMAGES . 'bc_cat_pointer_down.gif');
      			break;
      		case "right":
      			$pointer = zen_image(DIR_WS_TEMPLATE_IMAGES . 'bc_cat_pointer_right.gif');
      			break;
      		default:
      			$pointer = zen_image(DIR_WS_TEMPLATE_IMAGES . 'bc_cat_no_sub.gif');
      	}
      	
        $pointer .= $spacer;
      	
      	switch (true) {
      		//if the user has left the 'subcategories indent' empty, or
      		//if this is a 'top-level' category (there are no subcategory indents),
      		//then, we just prepend the pointer image:
      		case (CATEGORIES_SUBCATEGORIES_INDENT == ''):
      		case (strpos($categoryName, CATEGORIES_SUBCATEGORIES_INDENT) !== 0):
      			$pointer .= $categoryName;
      			break;
      		default:
      			//removing the subcategory indents from the beginning of the name:
      			$indentLength = strlen(CATEGORIES_SUBCATEGORIES_INDENT);
      			$pos = 0;
      			for ($i = 0; $pos === 0; $i++) {
      				$categoryName = substr($categoryName, $indentLength);
      				$pos = strpos($categoryName, CATEGORIES_SUBCATEGORIES_INDENT);
      			}
      			//placing the pointer image:
      			$pointer .= $categoryName;
      			//adding back the subcategory indents to the beginning of the name:
      			for (;$i > 0; $i--) {
      				$pointer = CATEGORIES_SUBCATEGORIES_INDENT . $pointer;
      			}
      	}
      	
      	return $pointer;
      
      }
      $content .= '</div>';
    ?>
    And I'm trying to modify it (having "Featured Products" directly under "All Products" at the top) with the following in red, I thought I did it exactly the way Kobra had helped me do the "All Products"

    What am I doing wrong?

    Thanks.

    Code:
    $content = "";
      
       $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";
        if (SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
          $content .= '<a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_ALL) . '">' . CATEGORIES_BOX_HEADING_PRODUCTS_ALL . '</a>' . "\n";
        }
    	if (SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true') {
          $show_this = $db->Execute("select products_id from " . TABLE_FEATURED . " where status= 1 limit 1");
          if ($show_this->RecordCount() > 0) {
            $content .= '<div class="betterCategories"><a class="category-links" href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">';
            $content .= zen_image(DIR_WS_TEMPLATE_IMAGES . 'bc_cat_boxes.gif') . $spacer;
            $content .= CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS . '</a></div>';
          }
    	$content .= '' . "\n";
      for ($i=0;$i<sizeof($box_categories_array);$i++) {
        switch(true) {
    Last edited by JohnnyScience; 16 Jun 2013 at 04:59 AM.

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

    Default Re: Help with some PHP editing a new template (Picaflor)

    You didn't move the closing } for
    PHP Code:
    if (SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true') { 
    There should be two of them here:
    PHP Code:
            $content .= CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS '</a></div>';
          }
        } 

  5. #85
    Join Date
    Jan 2013
    Posts
    104
    Plugin Contributions
    0

    Default Re: Help with some PHP editing a new template (Picaflor)

    Quote Originally Posted by gjh42 View Post
    You didn't move the closing } for
    PHP Code:
    if (SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true') { 
    There should be two of them here:
    PHP Code:
            $content .= CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS '</a></div>';
          }
        } 
    YES! Thank you! You've been so much help.

 

 
Page 9 of 9 FirstFirst ... 789

Similar Threads

  1. Replies: 3
    Last Post: 2 Mar 2012, 02:10 PM
  2. Help with editing php files
    By goldnuggetsales.com in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 10 Dec 2009, 11:46 AM
  3. Help with editing NEW PRODUCTS page
    By kevinmc3 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 27 Oct 2006, 10:56 AM

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