Page 1 of 19 12311 ... LastLast
Results 1 to 10 of 189
  1. #1
    Join Date
    Sep 2004
    Posts
    745
    Plugin Contributions
    4

    Default Show/Hide sideboxes based on page

    Not sure if anyone has written anything along these lines and a search didn't seem to turn up anything...

    My company has a need to have a contribution that permits selectively showing/hiding sideboxes based on the particular page ZC is rendering. Perhaps, by programatically selecting a different layout based on the page requested. I was considering writing such a contrib but don't want to re-invent the wheel if it has already been done...

    Anyone have any info on such a contrib?

    Thank you very much!

    Jeff

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Show/Hide sideboxes based on page

    A straightforward way of achieving this is to use page-based stylesheets to determine which pages do or do not display certain sideboxes. For example, if you only wanted the shopping cart to appear on the contact_us page (deliberately silly example) then you would set the shopping cart sidebox to be on in Admin but include the following in your stylesheet
    #shoppingcart {display:none}
    You would then create a css file called contact_us.css that contains only the line
    shoppingcart {display:block}
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Nov 2004
    Location
    Deal, Kent, UK
    Posts
    332
    Plugin Contributions
    0

    Default Re: Show/Hide sideboxes based on page

    That is very clever - often wondered about how to do it but never bothered to investigate - thanks for the tip!

  4. #4
    Join Date
    Sep 2004
    Posts
    745
    Plugin Contributions
    4

    Default Re: Show/Hide sideboxes based on page

    Thank you kuroi for your suggestion!! I will have to play with this a while to see if it will do the trick but other than efficiency (due to the fact that the sidboxes are still being processed) it is still a very clever way!

    Again, thanks!

    Jeff

  5. #5
    Join Date
    Apr 2006
    Location
    Columbus, OH
    Posts
    99
    Plugin Contributions
    0

    Default Re: Show/Hide sideboxes based on page

    I was just forwarded this thread because I have a similar situation. How would this technique work with specific product pages? More specifically, the cart generates a list of numbers to determine the product pages (at least in the URL window). How would I attach the css file for a product category, for example, books?

  6. #6
    Join Date
    Sep 2004
    Posts
    745
    Plugin Contributions
    4

    Default Re: Show/Hide sideboxes based on page

    Take a look at the top of common/tpl_main_page.php where you can specify a list of comma delimited page names to hide sideboxes on. This may be a better solution than css for your purpose.

    Jeff

  7. #7
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Show/Hide sideboxes based on page

    The common/tpl_main_page.php approach allows you to turn off whole columns based on some fairly precise criteria. The code you need is already embedded as comments in the header ready to be enabled. If you want to turn off individual sideboxes based on category, then you could wrap similar conditional php statements around the code in the relevant includes/modules/sideboxes files.

    If you're not so confident about coding, then much easier (though as Jeff rightly observes, less efficient) would be to create stylesheets with names such as c_aa.css for a category with ID aa, c_aa_bb.css for subcatory bb or category aa and p_cc.css for a product with ID cc. You can find out your category and product IDs by going to Admin > Categories/Products
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  8. #8
    Join Date
    Apr 2004
    Location
    UK
    Posts
    5,821
    Plugin Contributions
    2

    Default Re: Show/Hide sideboxes based on page

    Quote:
    #shoppingcart {display:none}

    You would then create a css file called contact_us.css that contains only the line
    Quote:
    shoppingcart {display:block}
    Tested, first part of kuroi's suggestion works fine, second part re creating
    contact_us.css with relevant command, does not for me.

  9. #9
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Show/Hide sideboxes based on page

    Could be that you've replicated my typo. The line in the contact_us.css file should be
    #shoppingcart {display:block}
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  10. #10
    Join Date
    May 2005
    Location
    Sweden
    Posts
    151
    Plugin Contributions
    0

    Default Re: Show/Hide sideboxes based on page

    Hey guys!

    This thread feels a bit overkill when it comes to me.

    What I wan't is for the reviews sidebox to appear only on the product info page just like tell a friend and manufacturer info.

    All help is appreciated..

 

 
Page 1 of 19 12311 ... LastLast

Similar Threads

  1. v150 Any way to show/hide payment modules dynamically based on order total?
    By Limitless in forum Addon Payment Modules
    Replies: 2
    Last Post: 27 Sep 2012, 03:22 PM
  2. Show/Hide INformation Sidebox based on page
    By atracksler in forum Basic Configuration
    Replies: 12
    Last Post: 17 Jun 2011, 04:21 PM
  3. Show/Hide sideboxes based on page
    By monkeyjr47906 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 29 Nov 2007, 07:25 PM
  4. Hide sideboxes on main page
    By disciple in forum Templates, Stylesheets, Page Layout
    Replies: 18
    Last Post: 11 Jan 2007, 07:38 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