Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32
  1. #1
    Join Date
    Nov 2009
    Location
    In beautyful New York
    Posts
    160
    Plugin Contributions
    2

    Default category specific css for different browsers

    Hi
    can anybody help me!
    i need specific css for a category so i made a file c_1.css
    the problem is that i must use browser css too for that category only,
    is this possible?

    i tried ie7_c_1.css but it loads in all categores

  2. #2
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: category specific css for different browsers

    I don't think that you can do that without a bit of coding. I might be wrong but I can't see a way.

    Firstly, I'd really have a think about why you need a IE specific stylesheet for every category. Is it possible to do this in some other way?

    If you really need this feature then you are going to need to edit:

    includes/templates/yourtemplate/common/html_header.php

    In this file there is a chunk of code that looks for the appropriate stylesheets and includes them in the page. You will need to alter this to look for the IE specific stylesheets too and possible wrap them in <-- -->. The code your looking for looks like this:

    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
                            );
      while(list ($key, $value) = each($sheets_array)) {
        //echo "<!--looking for: $value-->\n";
        $perpagefile = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . $value . '.css';
        if (file_exists($perpagefile)) echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile .'" />'."\n";
      }
    If that just confuses you then post again.

  3. #3
    Join Date
    Nov 2009
    Location
    In beautyful New York
    Posts
    160
    Plugin Contributions
    2

    Default Re: category specific css for different browsers

    thanks, I'm not confused only a bit
    i use extensive css to position options and attributes

    and all browsers do them differently, because i use position:relative
    take a look

    https://www.voucher-checks.com/quick...page-p-13.html

    i got them to work for one product type but if i use other options for a different product it will be all messed up

    i wanted to use some hack to import the styles via product descriptions, i got shunned by DR. Bytes and others for even thinking of it
    http://www.zen-cart.com/forum/showth...=158986&page=2

    i appreciate your time :)

  4. #4
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: category specific css for different browsers

    OK - well you can edit the code above to include some extra stylesheets where you need them. That is possible.

    The other thing is to add a unique id to each attribute so that you can apply code to each attribute dependent on what it is rather than it's position on the page. So 'colour' always receives its own styling. That involves a bit of an edit of attributes.php . I have outlined it a few times on the forum.

  5. #5
    Join Date
    Nov 2009
    Location
    In beautyful New York
    Posts
    160
    Plugin Contributions
    2

    Default Re: category specific css for different browsers

    how can i give an id to each option?
    it is generated dynamically on an array

  6. #6
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: category specific css for different browsers

    In tpl_modules_attributes at about line 30 look for

    Code:
    <div class="wrapperAttribsOptions">
    change it to

    Code:
    <?php $new2= strip_tags($options_name[$i]);?>
    <?php $new3=str_replace(' ', '', $new2);?>
    <?php $new3=str_replace(':', '', $new3);?>
    <?php $new4=strtolower($new3);?> 
    
    <div class="wrapperAttribsOptions" id="attributeBox-<?php echo $new4 ?>">>
    The first bit of that strips certain things out of the option name and makes it lowercase. Then this version of the option name is used as an Id. If you have other awkward characters in your option names then you might need to strip them out as well.

  7. #7
    Join Date
    Nov 2009
    Location
    In beautyful New York
    Posts
    160
    Plugin Contributions
    2

    Default Re: category specific css for different browsers

    thanks I'll try it and let you know :)

  8. #8
    Join Date
    Nov 2009
    Location
    In beautyful New York
    Posts
    160
    Plugin Contributions
    2

    Default Re: category specific css for different browsers

    thanks,
    It works wonderful
    only the swatches do not get any id, any idea
    your help is greatly appreciated

  9. #9
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: category specific css for different browsers

    Yeah, they are slightly separate. So you need to add in there too. Find this:

    Code:
    <?php
    if ($options_attributes_image[$i] != '') {
    ?>
    <?php echo $options_attributes_image[$i]; ?>
    <?php
    }
    ?>
    and wrap it in a div like this:

    Code:
    <div class="wrapperAttribsImage" id="attribute-image-<?php echo $new4 ?>">
    <?php
    if ($options_attributes_image[$i] != '') {
    ?>
    <?php echo $options_attributes_image[$i]; ?>
    <?php
    }
    ?>
    </div>
    I think that should work but I just made it up and haven't tested it

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

    Default Re: category specific css for different browsers

    Flexible Attributes in Free Addons automates an id for each attribute - essentially
    <div class="wrapperAttribsOptions">
    gets an id like
    <div class="wrapperAttribsOptions" id="<?php echo $options_wrapper_id[$i];?>">
    where $options_wrapper_id is set previously in attributes.php:
    $options_wrapper_id[] = 'wAttrib-' . $products_options_names->fields['products_options_id'];

    You can globally set styling for an attribute in all products where it appears, or in an individual product with a per-product stylesheet.

 

 
Page 1 of 4 123 ... LastLast

Similar Threads

  1. Problem with CSS in different browsers?
    By wondergirl in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 7 Dec 2008, 04:50 AM
  2. Header in CSS- different in different browsers
    By cgardner in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 14 Jun 2008, 01:49 AM
  3. Multiple stylesheets for different browsers!
    By Shotgun Front in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 18 Apr 2008, 02:26 PM
  4. Switching templates for different browsers
    By Kent in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 11 Apr 2008, 09:49 PM
  5. Different CSS for each Category
    By vulbus in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 30 May 2006, 02:41 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