Thread: cPath Question

Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Dec 2011
    Posts
    287
    Plugin Contributions
    0

    Default cPath Question

    Hi There!

    I know this can be done I just dont know the proper syntax and hope someone can quickly tell me what I need, So what I want to do is have a different product listing for all the products in catagory ID 3.

    I know that I need to put something in main_template_vars.php I just dont know the proper syntax, In laymans terms I think its something like if cpath=3 then use tpl_product_listing_other.php

    Can one of you guys tell me what that is in proper language!!

    Thanks,
    Daniel

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

    Default Re: cPath Question

    Nor do I but I believe that you are looking at adding an if/else to
    tpl_modules_product_listing.php
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Dec 2011
    Posts
    287
    Plugin Contributions
    0

    Default Re: cPath Question

    Would the following work or am I doing things too complicated?

    PHP Code:
    $path_ids explode('_',$_GET['cPath']);
    if 
    $path_ids[0] = '3' then
    blah blah blah code

    This is purly something I have taken and tweaked from another thread so Im not sure if it the easiest way to go about it.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: cPath Question

    You could use:
    Code:
    if ($current_category_id == '3') {
    // blah blah blah
    }
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: cPath Question

    When you say a different listing for each product in category 3, are there sub-categories off of category 3 that each will have the same "different" product view? In other words there being a tree off of category 3 that all have the same look, but are different then the tree off of category 2?

    Ask because the above addresses the product specifically in category 3, but not product within a subcategory thereof. A good/quick and dirty solution for what seems to be the present question.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Dec 2011
    Posts
    287
    Plugin Contributions
    0

    Default Re: cPath Question

    Yup there will be a tree under category 3, So I want the product listing to be different for everything in category 3 as the master category if that makes sense.

  7. #7
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: cPath Question

    Quote Originally Posted by DannyVarley View Post
    Yup there will be a tree under category 3, So I want the product listing to be different for everything in category 3 as the master category if that makes sense.
    Then would want something more like:
    Quote Originally Posted by Ajeh View Post
    You could use:
    Code:
    if (zen_product_in_category($product_id, '3') {
    // blah blah blah
    }
    Where $product_id is the id of the current product.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: cPath Question

    In the file I referenced somewhere in here you need an if/else
    Code:
    <?php
    /**
     * load the list_box_content template to display the products
     */
    if ????????? require ??????your desired template alteration file
    else
      require($template->get_template_dir('tpl_tabular_display.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_tabular_display.php');
    ?>
    Zen-Venom Get Bitten

 

 

Similar Threads

  1. cPath
    By Soniccc in forum General Questions
    Replies: 4
    Last Post: 12 Feb 2011, 11:07 AM
  2. cpath is it needed?
    By DigitalShadow in forum General Questions
    Replies: 17
    Last Post: 19 Dec 2010, 11:39 AM
  3. Determining root category ID while in a sub-category [cPath question]
    By stealthify in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 9 May 2009, 03:22 PM
  4. cPath=
    By pwhyles in forum General Questions
    Replies: 2
    Last Post: 28 Jun 2007, 10:42 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