Results 1 to 9 of 9
  1. #1
    Join Date
    May 2007
    Posts
    139
    Plugin Contributions
    0

    Default Excluding categories from certain attribs

    Hi, I had to hardcode my 'View Size Chart' because I couldn't find a better way to do this. Please check it out:

    http://www.wolfandrabbit.com/index.p...roducts_id=205

    It looks good and I like it that it's a subtle button to view the size chart, but I want to exclude the link on categories that don't require a size chart, such as Toys and Bath and Body products.

    Please let me know if anyone can help me figure this out.
    I tried going about it the 'attribute' way and have no idea how to do it...I'm open for suggestions.
    Thanks,
    Tatiana

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

    Default Re: Excluding categories from certain attribs

    In tpl_product_info_display.php, wrap your size chart link code in an "if" test that triggers based on either the list of categories to include or to exclude (depending on which list is easier).
    PHP Code:
    <!--bof Size chart link -->
    <?php if (ereg("(^23$|^23_)",$cPath)) { //replace 23 with your categories' cPaths per instructions ?>
    <br class="clearBoth" /><br/>
    <a href="javascript:popupDetails('http://www.wolfandrabbit.com/includes/templates/WR/images/sizechart.gif')"><img src="http://www.wolfandrabbit.com/includes/templates/WR/images/attributes/viewoursizechart.gif"/></a>
    <?php ?><!--eof Size chart link -->
    This is written to display the link for categories in the list.
    To *not* display for categories in the list, add a ! before ereg:

    if (!ereg("(^23$|^23_)",$cPath)) {

    To add your categories to the list:

    if (ereg("(^23$|^23_)",$cPath)) {

    ^23$ means "exactly 23", | means "or", and ^23_ means "begins with 23_".
    To add category 2 and subcat 7_13, the list would look like this:
    (^23$|^23_|^2$|^2_|^7_13$) and the whole line would look like this:

    if (ereg("(^23$|^23_|^2$|^2_|^7_13$)",$cPath)) {

  3. #3
    Join Date
    May 2007
    Posts
    139
    Plugin Contributions
    0

    Default Re: Excluding categories from certain attribs

    Hi Glenn thanks for the quick reply,

    Do you mean I should do this in tpl_modules_attributes.php?

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

    Default Re: Excluding categories from certain attribs

    If that is where the output code is, then yes. Which file has the <!--bof Size chart link --> tag?

  5. #5
    Join Date
    May 2007
    Posts
    139
    Plugin Contributions
    0

    Default Re: Excluding categories from certain attribs

    This is my new code:

    <!--bof Size chart link -->
    <?php if (!ereg("(^68_|^77_)",$cPath)) { //replace 23 with your categories' cPaths per instructions ?>
    <br class="clearBoth" /><br/>
    <a href="javascriptopupDetails('http://www.wolfandrabbit.com/includes/templates/WR/images/sizechart.gif')"><img src="http://www.wolfandrabbit.com/includes/templates/WR/images/attributes/viewoursizechart.gif"/></a>
    <?php } ?>
    <!--eof Size chart link -->

    It doesn't seem to make any difference... did I do something wrong?
    Thanks for your help.

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

    Default Re: Excluding categories from certain attribs

    Try it with the "positive" - (without ! ) just to see if that works. I know sometimes the direct negative doesn't give the desired results, but it's been a while since I dealt with that and I don't remember offhand exactly how I solved the problem.

    Another possibility is your phrasing of the categories.
    (^68_|^77_)
    will affect only subcategories of 68 and 77, not the top categories. The ereg function is very strict in how it looks for patterns, which allows for great specificity, but you need to specify every possibility.
    Last edited by gjh42; 26 Sep 2007 at 07:41 PM.

  7. #7
    Join Date
    May 2007
    Posts
    139
    Plugin Contributions
    0

    Default Re: Excluding categories from certain attribs

    Hm nope, I get this error message on the product page:

    Parse error: parse error, unexpected $ in /homepages/44/d205662926/htdocs/includes/templates/WR/templates/tpl_modules_attributes.php on line 89

    Again, here's my code for your reference:

    <!--bof Size chart link -->
    <?php if (ereg("(^68$|^77$)",$cPath)) { ?>
    <br class="clearBoth" /><br/>
    <a href="javascriptopupDetails('http://www.wolfandrabbit.com/includes/templates/WR/images/sizechart.gif')"><img src="http://www.wolfandrabbit.com/includes/templates/WR/images/attributes/viewoursizechart.gif"/></a>
    <!--eof Size chart link -->

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

    Default Re: Excluding categories from certain attribs

    Your edit lost the
    <?php } ?>
    in front of
    <!--eof Size chart link -->.

  9. #9
    Join Date
    May 2007
    Posts
    139
    Plugin Contributions
    0

    Default Re: Excluding categories from certain attribs

    Aaah bee-oo-tee-full!

    Thank you Glenn. I tested it on the bath and body and no size chart, but works perfectly on the clothing categories!!

    Yay!



    PS The ! for unwanted categories did the trick too

 

 

Similar Threads

  1. v154 Excluding certain states
    By CabinetGuy in forum Managing Customers and Orders
    Replies: 3
    Last Post: 7 Jun 2015, 06:44 PM
  2. Remove certain categories/sub categories from sitemap
    By moesoap in forum General Questions
    Replies: 4
    Last Post: 30 Mar 2012, 08:52 PM
  3. Replies: 1
    Last Post: 14 Feb 2009, 04:22 AM
  4. Excluding a category from the Categories sidebox
    By Heather88 in forum Basic Configuration
    Replies: 5
    Last Post: 23 Apr 2007, 09:48 PM
  5. excluding categories from bestseller list
    By CreativeWitch in forum General Questions
    Replies: 0
    Last Post: 21 Feb 2007, 05:41 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