Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Mar 2005
    Posts
    372
    Plugin Contributions
    0

    help question Per page stylesheets

    I found a section in the wiki that said if you use index_home.css for the home page you can change the look of the home page and you should use the page name for all the other pages.

    FIguring out what the page name might be is confusing since I would never have thought index_home.css was right for the home page.

    So I need a little help with the naming of the new style sheets. I want to rename the style sheets for the ezpage pages so they look like the homepage and have the shopping cart part with another stylesheet. Plan to use the default stylesheet for the cart.

    How do I figure out the page names for example cart/index.php?main_page=page&id=1&chapter=1

    What do I put for this stylesheet or is there one for the ezpages all of them or can there be one for all the ezpages and how would I do that???

    Thanks,

    C

  2. #2
    Join Date
    Nov 2005
    Location
    Colorado Springs, CO USA
    Posts
    7,033
    Plugin Contributions
    31

    Default Re: Per page stylesheets

    The first thing you'll need to do is open
    includes/templates/template_default/common/html_header.php

    Find the following code and add the portions highlighted in red

    Code:
    /**
     * load stylesheets on a per-page/per-language/per-product/per-manufacturer/per-category basis. Concept by Juxi Zoza.
     */
      $manufacturers_id = (isset($_GET['manufacturers_id'])) ? $_GET['manufacturers_id'] : '';
      $tmp_products_id = (isset($_GET['products_id'])) ? (int)$_GET['products_id'] : '';
      $tmp_pagename = ($this_is_home_page) ? 'index_home' : $current_page_base;
      $sheets_array = array('/' . $_SESSION['language'] . '_stylesheet', 
                            '/' . $tmp_pagename, 
                            '/' . $_SESSION['language'] . '_' . $tmp_pagename, 
                            '/c_' . $cPath,
                            '/' . $_SESSION['language'] . '_c_' . $cPath,
                            '/m_' . $manufacturers_id,
                            '/' . $_SESSION['language'] . '_m_' . (int)$manufacturers_id, 
                            '/p_' . $tmp_products_id,
                            '/' . $_SESSION['language'] . '_p_' . $tmp_products_id
                             '/chapter_' . $chapter_id,
                            '/' . $_SESSION['language'] . '_chapter_' . $chapter_id,
                            '/ezpage_' . $ezpage_id,
                            '/' . $_SESSION['language'] . '_ezpage_' . $ezpage_id  
                            );
    Save the file to includes/templates/YOUR_TEMPLATE/common/html_header.php

    and upload to your server.

    Now you can name your stylesheets as follows:

    chapter_1.css or ezpage_2.css

  3. #3
    Join Date
    Mar 2005
    Posts
    372
    Plugin Contributions
    0

    css problem Re: Per page stylesheets

    Thanks it worked. I changed all the chapter numbers on my ezpages to 0 and thus only needed one new stylesheet. I did not want to use the TOC.

    C

  4. #4
    Join Date
    Mar 2007
    Location
    Lakeland, FL, US
    Posts
    44
    Plugin Contributions
    2

    Default Re: Per page stylesheets

    Great addition that should be considered as a core update IMO.

    For anyone using this code modification, don't forget to include a comma after $tmp_products_id
    Last edited by rmullaney77; 22 Apr 2008 at 11:29 PM. Reason: Corrected spelling

  5. #5
    Join Date
    May 2008
    Posts
    7
    Plugin Contributions
    0

    Default Re: Per page stylesheets

    Hi. I was wondering what the code would be for using this technique to create stylesheets for individual categories in html_header.php?

    Also I notice an option at the top of each page on the forums to sign up for the newsletter using only your email address. I want to add this option to my site but am unsure how to do it. I've downloaded the newsletter_only subscriptions module but am not sure if it does what I want or how to get it to work like I want. It says there should be a sidebox for it in 'Layout Boxes Controller' in the admin backend but I can't find. Any help appreciated. Thanks.

  6. #6
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Per page stylesheets

    Quote Originally Posted by newy_newbie View Post
    Hi. I was wondering what the code would be for using this technique to create stylesheets for individual categories in html_header.php?
    The function for categories is already there...

    '/c_' . $cPath,
    '/' . $_SESSION['language'] . '_c_' . $cPath,

    There's a "read-me" in the CSS folder, explaining the procedure.

  7. #7
    Join Date
    May 2008
    Posts
    7
    Plugin Contributions
    0

    Default Re: Per page stylesheets

    Thanks. I've taken a look at that and while it's clearly the solution I need I'm afraid I still don't fully understand. Basically I want to put all the products in some categories in catalog-mode and the products in some other categories in shopping cart mode. I believe I can achieve this by stipulating 'display:none;' for the 'Add To Cart' button in the product description for the products in certain categories but I'm unsure what the naming convention is for that or how to target specific pages in the stylessheets or even what to name the stylesheets to target these pages/categories. I know that the answer is probably simple and I'm almost there but any help would be greatly appreciated. Thank you.

  8. #8
    Join Date
    May 2008
    Posts
    7
    Plugin Contributions
    0

    Default Re: Per page stylesheets

    Perhaps I should be a bit clearer. I want to take out the Add to Cart button in the product description of an item under the category 'Books'. According to the web developer add-on the id I want to target is '#cartAdd'. And according to the read-me file in the css directory I should create a file called 'c_??_??.css' and upload it to the 'classic>css' override directory. According to the read-me file this makes "changes to all info pages in a category".

    So I should name this file c_books.css, include '#cartAdd { display:none; }' in it and upload it and this should do what I want, take out the Add to Cart function in that product description in that category only. Thing is, I've done that but it doesn't work. Obviously I'm doing something wrong but I don't know what. Any ideas?

  9. #9
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Per page stylesheets

    You don't work with category NAMES in naming the css file:-

    c_??_??.css

    ...where ??_?? are the category ID numbers.

    There are a few places where you can see these ID numbers - in ADMIN>>>CATALOG>>>CATEGORIES/PRODUCTS

    When your table of categories displays, you can see the ID number in the left column.

    Additionally, if you call up a product in any category, look at your browser address bar:-

    index.php?main_page=product_info&cPath=24_31&products_id=300

    This line says:-

    Display the main page for the main category ID=24 and it's sub category ID=31, (and then show product with Product ID=300.)

    So, if I wanted to create a unique stylesheet for that sub-category, my CSS file would be called:-

    c_24_31.css

    (NOTE: If you don't use sub-categories, then you will only have ONE ID number for a category)

    (If I wanted to create a product-specific stylesheet for the product in that URL, I would create a stylesheet p_300.css).

  10. #10
    Join Date
    May 2008
    Posts
    34
    Plugin Contributions
    0

    Default Re: Per page stylesheets

    This technique works great. One question though. Is it possible to have a custom style sheet that applies to all categories? If so, what would I name it?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 Ignored stylesheets and page margins
    By jelly8ean in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 21 Jan 2013, 11:35 AM
  2. v139g Products display 10 per page- How do I change to 20 per page?
    By cahoca in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 15 Jan 2012, 02:04 AM
  3. Not a 'Templates, Stylesheets, Page Layout' problem?
    By pfristoe in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 13 Jun 2011, 12:28 AM
  4. setting different stylesheets per language
    By davidnelband in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 16 Mar 2011, 11:30 PM
  5. Stylesheets: How to go beyond the Main Page?
    By bluealice in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 5 Feb 2007, 01:28 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