Results 1 to 10 of 22

Hybrid View

  1. #1
    Join Date
    Dec 2007
    Posts
    27
    Plugin Contributions
    0

    Default Hiding product images under one category but not another

    Hi,
    The product listing page displays with Image, Description, Price, etc columns.
    This is fine for most pages, but how would I go about not displaying that product image when that same product is displayed under a different category (as a linked product in admin).

    I can't provide a site URL I'm afriad, but hopefully the question is self explanatory?
    Any ideas/suggestions?

    I've hunted through the forums without success so far.
    Cheers,
    Rob

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

    Default Re: Hiding product images under one category but not another

    You could edit /includes/modules/your_template/product_listing.php to include a test for $cPath being equal to the category you wish to hide...

    Gallery Category does exactly the kind of thing you want for the price and add button; you could transfer the logic to the image case and hide that on your selected categories.

  3. #3
    Join Date
    Dec 2007
    Posts
    27
    Plugin Contributions
    0

    Default Re: Hiding product images under one category but not another

    Thanks for the speedy reply.
    Having read several threads on testing the $cPath - I have a question that relates to my main question.

    If I have a category ID=20, would checking $cPath for 20 and hiding a column in product_listing.php carry through to sub categories of category 20 (20_243 etc), or do I have to specify all those sub categories too?

    If so, I'm not sure how I might proceed, as there are a lot of categories and sub-categories within them that I want this modified product listing layout on - but it can't affect the rest of the site.

    If this is the only way to go (adding them all manually) then ok... but could you suggest a code snippet to help me on my way please?
    Cheers,
    Rob

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

    Default Re: Hiding product images under one category but not another

    There are a couple of ways to test for the top category in $cPath.
    I'll go look one up.

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

    Default Re: Hiding product images under one category but not another

    Here is one way. Replace 23 with your desired category id:
    PHP Code:
    if (ereg("(^23$|^23_)",$cPath)) { //do something in category 23 and its subcats (replace 23 with your cat id)
      
    your code;


  6. #6
    Join Date
    Dec 2007
    Posts
    27
    Plugin Contributions
    0

    Default Re: Hiding product images under one category but not another

    Thank you for looking that up for me - very much appreciated!

    I'll give it a go and post back if I have any further issues with it

    Would I be right in thinking that to have the same effect on several top level categories and their sub cats, I could just keep adding the or pipe | and another pair of numbers, one with underscore?

    i.e. (^23$|^23_|^45$|^45_) etc...
    Cheers,
    Rob

 

 

Similar Threads

  1. Can I copy all products under one category to another? in bulk?
    By 24hourDomainer in forum Templates, Stylesheets, Page Layout
    Replies: 22
    Last Post: 26 May 2025, 08:37 AM
  2. v150 Large images appear fine in one category but very tiny in another
    By ocmusic in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 19 Jun 2013, 01:31 AM
  3. Product list disappeared under one category...
    By lilrowo in forum General Questions
    Replies: 5
    Last Post: 29 Aug 2011, 10:11 PM
  4. Prices on one category, not on another
    By Chaihana Joe in forum General Questions
    Replies: 5
    Last Post: 30 Nov 2009, 12:55 AM
  5. Hiding main category name under image
    By Anneli in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 27 Mar 2008, 09:51 PM

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