Results 1 to 3 of 3
  1. #1
    Join Date
    May 2008
    Posts
    50
    Plugin Contributions
    0

    Default Get current cpath

    I'm writing come custom code, but I can't seem to find a way to get the current cpath. I would like to get the number for current cpath as well as current top level parent category.

    Can someone help?

    Thanks,
    TJ

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

    Default Re: Get current cpath

    $_GET[cPath]
    will deliver the current cPath.

    For the current parent category,
    (int)$_GET[cPath]
    will strip any underscores and following subcat numbers from cPath, leaving only the top cat id.

    You may want to check for the value being not null - if no category is selected, you will get null or 0.
    Last edited by gjh42; 30 Aug 2008 at 11:27 PM.

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

    Default Re: Get current cpath

    Note: to know the immediate categories path you can use:
    $current_category_id

    Often times, when you do not "see" cPath, $current_category_id will know the immediate categories_id of the immediate path that you are in ...
    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!

 

 

Similar Threads

  1. v150 How to get current language id
    By tips007 in forum General Questions
    Replies: 2
    Last Post: 15 Jan 2013, 10:17 PM
  2. How to get cPath from a product id?
    By Cindy2010 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 18 Jan 2012, 02:32 AM
  3. function to get cPath by passing the products_id?
    By rajoo.sharma in forum General Questions
    Replies: 2
    Last Post: 14 Aug 2009, 07:09 AM
  4. Quick question... Get Current Page
    By pensive612 in forum General Questions
    Replies: 1
    Last Post: 30 Nov 2006, 05:28 PM
  5. how to get the current order no?
    By wdrwc in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 14 Jul 2006, 02:46 AM

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