Thread: category name?

Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default category name?

    ZenCart v1.5.5e
    Apache server (Hostmatters)
    PHP 5.6.31 (Zend: 2.6.0)
    MySQL 5.6.37
    About_us page
    dbio 1.3.0
    MainImageReplacer-v1.0
    Image_Handler4_v4.3.2

    I am looking for the variable for the catalog. I found a dirty way to do it after searching trial and error on getting the category name. I put $category into the admin developer tool kit and tried ?all? the different ones I could find, but to no avail.

    I have this code inserted in the main template (index.php) @ "Load general code run before page closes".

    PHP Code:
        $this_page META_TAG_TITLE;

        
    $this_page substr($this_page0strpos($this_page":")-1);

        
    // if there is a product name //

        
    if (isset($products_name))

        {
            
    $this_page $products_name;
        }

        
    // if $this_page = 0 //

        
    elseif (!strlen($this_page))
        {
            
    $this_page "Store";
        }
        echo 
    $this_page;  // temporary for troubleshooting // 
    Just wondering if there is not a better way. (at least it is not as dirty and unstable as my product name code was)

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: category name?

    Let's back up a couple miles.

    What's the big picture of the overall project you're doing here? What's the business problem you're trying to solve?
    (I think your question is too granular, and thus any attempt at an answer will probably just lead us in circles. Need more context.)
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: category name?

    It started as a monitoring of page views and ultimately, it will be part of the subject line for the 'Contact Us' page.

    Everything is working just fine. It just seems that there should be a variable for the category as well as the product. It may ultimately be necessary to ZEN it out of an array, in which case, I will probably leave the code as is.

    And I should add. My post on re-read is somewhat ambiguous.

    I am looking to change this;

    $this_page = META_TAG_TITLE;
    $this_page = substr($this_page, 0, strpos($this_page, ":")-1);

    Into something like this;

    $this_page = $category_name;

    Attachment 17220
    Last edited by IATIA; 10 Aug 2017 at 07:22 PM. Reason: more info

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: category name?

    $cPath contains the full cPath from the URL, such as: 3_10_17

    $current_category_id is just the actual category number, such as: 17

    zen_get_category_name($current_category_id, (int)$_SESSION['languages_id']) will give you the name for that category, from the database: "Toys"
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: category name?

    Thanks!

 

 

Similar Threads

  1. Category image and category name text align problem.
    By marknew in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 21 Sep 2012, 03:02 AM
  2. How to display Category name or Product name as a tagline?
    By ttmb33 in forum General Questions
    Replies: 0
    Last Post: 19 Jan 2010, 05:47 PM
  3. How to remove category name from category page?
    By faithofgod in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 1 Mar 2008, 09:16 PM
  4. Spacing between Category Name & Category Description
    By raunharman in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 14 Dec 2007, 11:31 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