Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Jun 2008
    Location
    UK
    Posts
    209
    Plugin Contributions
    0

    Default Adding Blank Spacer Lines between Categories in Category Box

    For a while I have found a quick and easy solution for creating blank lines in my Category box so I can group some of my categories. All I do is create a dummy category where I want a blank line.

    But this is causing me validation problems as the source code comes out as ....

    <a class="category-top" href="http://www.tidytoys.co.uk/shop/-c-299"></a><br />
    <a class="category-top" href="http://www.tidytoys.co.uk/shop/-c-300"></a><br />

    Is there a way I can insert a blank line wherever I want without causing validation errors behind the scenes that highlight coding that google doesnt like.

    I did try playing with one of the category box add-ons a while ago, but it all seemed massively complicated and I still couldnt figure out how to add something as simple as a blank line.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Adding Blank Spacer Lines between Categories in Category Box

    A small change to the template will let you control that with a stylesheet:

    1. /includes/templates/YOUR_TEMPLATE_FOLDER/sideboxes/tpl_categories.php
    Around line 22 you'll see code like this:
    Code:
          case ($box_categories_array[$i]['top'] == 'true'):
            $new_style = 'category-top';
            break;
    Change that to add the extra code as highlighted here:
    Code:
          case ($box_categories_array[$i]['top'] == 'true'):
            $new_style = 'category-top'. ' ' . str_replace('cPath=', 'catnum', $box_categories_array[$i]['path']);
            break;
    2. Add a new stylesheet specifically to control this:
    /includes/templates/YOUR_TEMPLATE_FOLDER/css/stylesheet_cat_sidebox.css
    Code:
    #categoriesContent a.catnum34, #categoriesContent a.catnum78 {
      padding-top: 10px;
      display: inline-block;
    }
    Edit the numbers to reflect the cPaths of the categories above which you want the space to display. There are 2 examples above: for category 34 and 78.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jun 2008
    Location
    UK
    Posts
    209
    Plugin Contributions
    0

    Default Re: Adding Blank Spacer Lines between Categories in Category Box

    Thank you DrByte for your help

    Im now getting this when I view my page source

    <a class="category-top catnum299" href="http://www.tidytoys.co.uk/shop/-c-299"></a><br />

    But is this right ?


    My Code in tpl_categories.php is now ....

    // 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'. ' ' . str_replace('cPath=', 'catnum', $box_categories_array[$i]['path']);
    break;
    case ($box_categories_array[$i]['has_sub_cat']):
    $new_style = 'category-subs';
    break;

    My code in stylesheet_cat_sidebox.css is ...

    #categoriesContent a.catnum299, #categoriesContent a.catnum300 {
    padding-top: 10px;
    display: inline-block;
    }

  4. #4
    Join Date
    Jun 2008
    Location
    UK
    Posts
    209
    Plugin Contributions
    0

    Default Re: Adding Blank Spacer Lines between Categories in Category Box

    The problem I am having is that when generating a sitemap for my website these blank lines are appearing as such and google webmasters is objecting.

    http://www.tidytoys.co.uk/shop/-c-299 2014-12-22 weekly 1.00 ==> not ok
    http://www.tidytoys.co.uk/shop/other...cal-vocal-toys 2014-09-03 weekly 0.99 ==> ok

  5. #5
    Join Date
    Jun 2008
    Location
    UK
    Posts
    209
    Plugin Contributions
    0

    Default Re: Adding Blank Spacer Lines between Categories in Category Box

    Sorry but I have zero understanding of the code you have given me.

    I may have copied this up incorrectly. But this doesnt look to be what I wanted.

    Im just trying to get rid of the line .... <a class="category-top catnum299" href="http://www.tidytoys.co.uk/shop/-c-299"></a><br />

    and replace it with something that is understood in the coding as being blank line ... is that </br> ?

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

    Default Re: Adding Blank Spacer Lines between Categories in Category Box

    From what appears to be described, you still have one or more "fake" categories populating your database that were added to give you your "blank" line. What Dr. Byte provided is a substitute for using the "fake" category. Further, the solution provided gives a greater flexibility in formatting than a simple space (<br />) with the extra styling information that was added, it is possible to individually customize each sidebox and on each page displayed.

    So to fix your problem, you would need to delete or preferably inactivate the category(ies) that are being displayed with no content. This can be done from the admin panel in the product/categories area, find the category numbered 299 or whatever category number(s) causing trouble, then change the green status indicator to red, and answer the question if asked that yes to disable categories/products below that category...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Jun 2008
    Location
    UK
    Posts
    209
    Plugin Contributions
    0

    Default Re: Adding Blank Spacer Lines between Categories in Category Box

    I have now inactivated (changed to red) the 2 dummy categories (cat nums = 299 and 300) - these I would like to be blank lines.

    299 blank
    2 A-Z LIST of All Soft Toys
    300 blank

    I have changed the code to be

    stylesheet_cat_sidebox.css ...

    #categoriesContent a.catnum299, #categoriesContent a.catnum300 {
    padding-top: 10px;
    display: inline-block;
    }

    But instead of blank lines above and below "A-Z LIST of All Soft Toys" the blank lines are no longer there and the categories have closed up.

    I then tried applying the code to a.catnum2 - incase the blank line is appended to either before or after an existing category. You did imply I could delete the categories where I would like a blank line, in which case I wouldnt have a category number to use in the given coding.

    Im sorry but am Im just not understanding the concept of what this code does or I havent copied it up correctly.
    Last edited by toyseller; 25 Dec 2014 at 02:51 AM.

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

    Default Re: Adding Blank Spacer Lines between Categories in Category Box

    You're close... The category numbers provided above were examples based on the information provided. So, if category 299 and category 300 do not exist, then the number in the.css file will not do anything. As suggested earlier, need to look at the category(ies) that do exist on the page(s), (right click the web page and view source), find the category that is the one above which space is desired... Look at the category number for that category. Use that number in place of 299. If more such spaces are needed, follow that pattern and the example provided above...

    In this setup, whatever category number(s) used will cause a 10px margin above that category to exist... Ie, a space. If that space should be increased, then increase the number in the .css file.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

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

    Default Re: Adding Blank Spacer Lines between Categories in Category Box

    Isn't A-Z LIST of All Soft Toys a category? It has a category number if it is. That category number would be what is to be used to replace 299 or whatever number is being used. In Dr. Byte's example: might replace 34.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #10
    Join Date
    Jun 2008
    Location
    UK
    Posts
    209
    Plugin Contributions
    0

    Default Re: Adding Blank Spacer Lines between Categories in Category Box

    Maybe Im not explaining myself correctly. Whatever number category I use in this code
    nothing at all happens. Isnt the code written to leave a blank line ? I dont know how it is supposed to all connect up because I have no knowledge of CSS, PHP or HTML.

    ------------------------------
    The first piece of given coding makes changes to my source code which I can see by right clicking and viewing the source code ...
    <a class="category-top catnum2" href="http://www.tidytoys.co.uk/shop/a-z-list-of-all-soft-toys">A-Z LIST of All Soft Toys-&gt;</a><br />
    --------------------------
    This piece of coding Im guessing, isnt being recognised (nothing is happening, no blank line is being generated).
    It simply isnt modifying the catnum that I have given it.

    #categoriesContent a.catnum2, #categoriesContent a.catnum299 {
    padding-top: 10px;
    display: inline-block;
    }

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Adding blank lines between listings
    By danaclaire in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 3 Sep 2011, 03:37 PM
  2. Divider Lines Between Categories
    By amyleew in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 30 Jan 2010, 03:22 PM
  3. Removing Lines In Between Categories
    By DCDC in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 26 Jun 2008, 08:03 PM
  4. lines in between categories?
    By MachaNeko in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 15 May 2008, 03:07 PM
  5. Adding separation lines in category box?
    By serendipities in forum Basic Configuration
    Replies: 2
    Last Post: 11 Jul 2006, 09:56 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