Results 1 to 8 of 8
  1. #1

    Default How can I display a customized tpl_product_info_display.php for a certain category

    Hi there,

    I need to use a customized tpl_product_info_display.php for a certain product category. All the products in that category will share the same modified template. The template will not be used outside that category.

    Would I have to set up a dedicated product type or is there an easier way to accomplish this?

    Thanks!

    Andreas

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: How can I display a customized tpl_product_info_display.php for a certain categor

    create your file and save it in your template folder in a folder named for the cat

    i.e. if the cat address were like this: /index.php?main_page=index&cPath=3

    Then make a folder "cPath_3" (I think this is the correct syntax), and place your custom file there
    Zen-Venom Get Bitten

  3. #3

    Default Re: How can I display a customized tpl_product_info_display.php for a certain categor

    Thanks for the quick answer.

    At first I was a bit disappointed because the proposed solution doesn't seem to do the trick.

    I saved the modified tpl_product_info_display.php into a newly created cPath_1 older like this:
    \includes\templates\MYTEMPLATE\templates\cPath_1\tpl_product_info_display.php
    but could not get the modified template beeing used this way.

    Still your answer proved to be very helpful. I was not aware of the cPath system until now. (just started last week to rebuild my shop based on zen-cart)
    I looked it up on the wiki and I am confident that I can now implement the desired behaviour by evaluting the cPath variable within the original template.
    Thanks again!

    regards

    Andreas

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: How can I display a customized tpl_product_info_display.php for a certain categor

    I saved the modified tpl_product_info_display.php into a newly created cPath_1 folder
    Well, garbage.....try naming it cPath=1 and then try cPath1

    This works for those in the common dir like for privacy. checkout etc...

    Maybe needs to be a folder inside the templaqtes folder???
    Last edited by kobra; 13 Oct 2008 at 03:19 PM.
    Zen-Venom Get Bitten

  5. #5

    Default Re: How can I display a customized tpl_product_info_display.php for a certain categor

    Quote Originally Posted by kobra View Post
    Well, garbage.....try naming it cPath=1 and then try cPath1
    I tried both and it did not work. Anyway I was able to do everything I wanted by simply evaluating the $cPath variable within the regular template:

    (...)
    if ($cPath == '1')
    // do this
    else
    // do that
    (...)

    This is very straightforward and allows any customization from replacing a single standard element to loading an entirely different page layout.

    This works for those in the common dir like for privacy. checkout etc...
    Interesting. I'll have a look a the code that loads the alternative templates once I have brought my shop into shape.

    best regards

    Andreas

  6. #6
    Join Date
    Sep 2006
    Posts
    78
    Plugin Contributions
    1

    Default Re: How can I display a customized tpl_product_info_display.php for a certain categor

    I wonder if you would be good enough to go through exactly how you acheived this,

    I am looking to load a different tpl_index_categories.php for certain categories, the reason for this is a do not want to show the subcategory links in certain categories but i do in others,

    I would think i would acheive this in a similar way you have acheived what you are looking for i am just not sure how to go about it,

    Any help would be greatly apreciated.

    Rob

  7. #7

    Default Re: How can I display a customized tpl_product_info_display.php for a certain categor

    Quote Originally Posted by flobster View Post
    I wonder if you would be good enough to go through exactly how you acheived this
    You are welcome. Here is how you hide the sub categories of a certain category:
    1. Go to your webshop and open the category page you want to modify.
    2. Look at the page url in the browsers address field. It contains a substring 'cPath=X_Y_Z' with X_Y_Z beeing a number or a couple of numbers with _ inbetween (like '1_2_3' for example).
    3. Now copy the file
      \includes\templates\template_default\templates\tpl_index_categories.php
      to
      \includes\templates\MYTEMPLATE\templates\tpl_index_categories.php
      where MYTEMPLATE is the template you are using in your shop
      (skip this step if the file already exists in the MYTEMPLATE\templates directory)
    4. open the copied tpl_index_categories.php file with a text editor and go to the part that handles the display of subcategories. It starts with the comment line:
      <!-- BOF: Display grid of available sub-categories, if any -->
    5. Now change this line:
      if (PRODUCT_LIST_CATEGORY_ROW_STATUS == 0) {
      to
      if (PRODUCT_LIST_CATEGORY_ROW_STATUS == 0 || $cPath == 'X_Y_Z') {
      (replace X_Y_Z with the substring you found in step 2)
    6. save the file and check out if the modification works.

    Note: this will only hide the subcategories on the category page. They will still be displayed in the categories sidebox.

    Andreas
    Last edited by dause; 16 Oct 2008 at 07:49 AM. Reason: typo

  8. #8
    Join Date
    Sep 2006
    Posts
    78
    Plugin Contributions
    1

    Default Re: How can I display a customized tpl_product_info_display.php for a certain categor

    Dause,
    That works a treat thank you very much, just what i have been looking for

    Rob

 

 

Similar Threads

  1. v151 Product URL on tpl_product_info_display.php to display only when user is logged in?
    By Matt Staines in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 24 Oct 2013, 09:39 AM
  2. How to diable price display and display for certain users
    By marksu in forum General Questions
    Replies: 3
    Last Post: 10 Jan 2009, 05:02 PM
  3. try to display the products_last_modified in tpl_product_info_display.php not work
    By yierhan2008 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 18 Jun 2008, 03:07 PM
  4. Replies: 0
    Last Post: 6 Mar 2008, 05:38 AM
  5. Changing the CSS for the Category link in tpl_product_info_display.php
    By bugyoutoo in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 4 Mar 2008, 05:57 PM

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