Results 1 to 10 of 10
  1. #1
    Join Date
    May 2006
    Posts
    12
    Plugin Contributions
    0

    Default Trying to locate the definition for a constant

    Hi! I'd like to reformate the date_added on my product listing pages such that the day of the week no longer appears. I'm looking for the file in which this constant is defined:

    PRODUCT_NEW_LIST_DATE_ADDED

    I've been searching through a zillion files and I have no idea where it's defined. Anyone want to point me in the right direction?

    I also tried using the developer tools to locate it, but it just found the files that called this constant, and not the one that defines it. Strange.

    Zen Cart is a great package (especially for the price!), but I gotta say that it's hell trying to figure out which file to edit in order to customize a specific page. The admin configuration is limited as to how much you can really do.

    But that's what I get for being an obsessive-compulsive web designer

  2. #2
    Join Date
    May 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: Trying to locate the definition for a constant

    Here's another one I can't find - this link isn't working on my categories menu, so I'd like to find the page where it originates:

    FILENAME_PRODUCTS_ALL

    Thanks in advance!

  3. #3
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: Trying to locate the definition for a constant

    try entering define('FILENAME_PRODUCTS_ALL into the bottom left box in the Developers Tool Kit, select All Files - Catalog and clicksearch. I guarantee you'll get a single result.

    PRODUCT_NEW_LIST_DATE_ADDED isn't defined in a file: it is a configuration key in the database. Set if from Admin > Configuration > New Listing > Display Product Date Added
    Neville
    An assumption is what you arrive at when you get tired of thinking...

  4. #4
    Join Date
    May 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: Trying to locate the definition for a constant

    Thanks, bunyip. I did search the Developer's Toolkit and I did get a result for FILENAME_PRODUCTS_ALL, but not for the file in which the constant is defined, just for those that call it.

    I don't want to turn off the Date Added display, I want to reformat it. Currently it shows the day of the week/day of the month/month/year. I want a standard American date format without the day of the week - month/day/year.

    The products_date_added field in the database is a datetime field, so in mySql it's formatted like so: 0001-01-01 00:00:00

    When you pull that data from the table, you can format it to suit your needs. I'm looking for the file in which that happens, so I can edit the date format accordingly. Thanks to you, I was able to locate a file in which a database query is made, but there is no date formatting in that file. It's really weird.

    PRODUCT_NEW_LIST_DATE_ADDED has to be defined in a file somewhere, but I sure can't find it.

  5. #5
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: Trying to locate the definition for a constant

    FILENAME_PRODUCTS_ALL is defined in includes/filenames.php - that won't help you.
    PRODUCT_NEW_LIST_DATE_ADDED is a database configuration key as I described above - it's value is used to determin if the date added column is displayed at all, and if so, in which order. Again, that won't help you achieve what you want.

    If you take a look at includes/templates/template_default/templates/tpl_modules_products_new_listing.php at line 61 you'll see this code:
    Code:
    $display_products_date_added = TEXT_DATE_ADDED . ' ' . zen_date_long($products_new->fields['products_date_added']) . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_DATE_ADDED, 3, 1));
    You can see there that the database outpur for the field products_date_added is being used by the function zen_date_long() to format it for display. So where you need to be looking is at that function.
    Plug that function name into the search field for functions in the Developers Tool Kit, search All Files - Catalog and you'll find it's contained in includes/functions/functions_general.php at line 189.
    Neville
    An assumption is what you arrive at when you get tired of thinking...

  6. #6
    Join Date
    May 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: Trying to locate the definition for a constant

    Thanks, bunyip, I'm getting warmer thanks to your help.

    I found the date_long function, which referenced another constant DATE_FORMAT_LONG in english.php. That's where the formatting is, so I can tweak that as needed.

    So many constants in so many files!

    As for FILENAME_PRODUCTS_ALL - it's not in my includes/filenames.php, maybe that's why my link is broken?

    We seem to be using different ZC versions (I'm 3.0) because none of the line numbers you've provided match mine - no big deal, since control-F does the job, but that may be why my code isn't where yours is?

  7. #7
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: Trying to locate the definition for a constant

    Quote Originally Posted by Ruby
    As for FILENAME_PRODUCTS_ALL - it's not in my includes/filenames.php, maybe that's why my link is broken?
    Yep - that'll be why

    The line numbers I gave were from 1.3.0.1, so might not quite match your version.
    Neville
    An assumption is what you arrive at when you get tired of thinking...

  8. #8
    Join Date
    May 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: Trying to locate the definition for a constant

    Yep, that was it! I just inserted:

    define('FILENAME_PRODUCTS_ALL', 'products_all');

    and it's working fine now. Yippeee!

    You're my hero

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

    Default Re: Trying to locate the definition for a constant

    Strongly recommend upgrading to v1.3.0.1 rather than run with a buggy version of v1.3 ...
    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!

  10. #10
    Join Date
    May 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: Trying to locate the definition for a constant

    Done. Thanks for the suggestion!

 

 

Similar Threads

  1. Replies: 1
    Last Post: 2 Feb 2014, 04:45 PM
  2. Replies: 2
    Last Post: 5 Dec 2013, 01:07 PM
  3. CONTACT_US_LIST, Where do i find the definition for..?
    By tcarden in forum General Questions
    Replies: 1
    Last Post: 19 Dec 2012, 12:04 AM
  4. How many is the maximum of the definition of weight/price in the Shipping and Payment
    By spine in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 11 Dec 2008, 04:48 AM
  5. Trying to Locate into which page these keywords are embedded
    By MeltDown in forum General Questions
    Replies: 2
    Last Post: 6 Jul 2006, 03:07 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