Forums / General Questions / How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

Locked

Views: 2,562

Results 1 to 18 of 18
This thread is locked. New replies are disabled.
24 Apr 2008, 5:30 AM
#1
karma_lab avatar

karma_lab

Zen Follower

Join Date:
Apr 2008
Posts:
135
Plugin Contributions:
0

How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

OK, so I'm looking in some templates, and trying to achieve some behavior that I want. If you see something like:

if (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS == 0)

...how can you find out where in the admin interface this variable actually is?

I mean, I already searched all the code for it, and it is only used in a number of places, never actually set, so I am assuming it is set from the admin interface - but there are so many possible locations, and the names don't necessarily match these constants.

Thanks!

24 Apr 2008, 6:50 AM
#2
colemanpa avatar

colemanpa

Zen Follower

Join Date:
Oct 2007
Location:
Fairbanks, Alaska
Posts:
423
Plugin Contributions:
0

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

Did you try admin-tools-developers tool kit try under Look up Constant.

24 Apr 2008, 2:18 PM
#3
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

If it's not there, it is defined in db. You will want to check the table configuration I think, and search for that specific constant in the field configuration_key

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

24 Apr 2008, 9:16 PM
#4
karma_lab avatar

karma_lab

Zen Follower

Join Date:
Apr 2008
Posts:
135
Plugin Contributions:
0

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

Thank you, I managed to find it by searching in the database, in the config table. Then, by laboriously going through each configuration page in the zencart/admin, looking for something that sounded like it and had the same value setting as the database (1). This took nearly a half hour.

It would be so nice if there were an easier way to correlate CONSTANTS and the places that they exist in the admin interface. Perhaps the database's configuration_group_id relates to which page they are on, but again, there's no list that I know of that lists this info.

For example, here's the correlation:

SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS = Index Listing > New Products Columns per Row

This was not obvious at all. But thanks for the tips. :smile:

24 Apr 2008, 9:21 PM
#5
karma_lab avatar

karma_lab

Zen Follower

Join Date:
Apr 2008
Posts:
135
Plugin Contributions:
0

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

Actually, I did figure out somewhat of a method for anyone who is interested.

  1. Search in the database configuration table, and find the variable name, such as SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCT.

  2. Check the database entry's configuration_group_id. In this case, it is '24'.

  3. In zencart/admin, choose any of the configuration pages, such as the first one 'My Store'.

  4. Check the URL at the top of the browser. It will say something like: http://yourdomain.com/zencart/admin/configuration.php?gID=1

  5. The end part is the Group Id. Change this to 24, and then hit enter. Voila, you are now on the page containing that variable. It's somewhere in the list. :smartalec:

25 Apr 2008, 2:32 AM
#6
karma_lab avatar

karma_lab

Zen Follower

Join Date:
Apr 2008
Posts:
135
Plugin Contributions:
0

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

Actually, another way is:

Once you lookup the parameter in the configuration table and find out what the Group_id is (i.e. 24), you can go to the configuration_group table, hit browse, and lookup the number - it tells you the page title for that group, i.e. "Index Listing".

25 Apr 2008, 6:52 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

If you'd followed colemanpa's suggestion to use the built-in Developers Toolkit, you would have found it in 15 seconds.
And then in another 20 seconds you would have a listing of all files where the constant is ever used, just by telling it which subset of files to look in.

.
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.

25 Apr 2008, 9:41 AM
#8
karma_lab avatar

karma_lab

Zen Follower

Join Date:
Apr 2008
Posts:
135
Plugin Contributions:
0

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

DrByte:

If you'd followed colemanpa's suggestion to use the built-in Developers Toolkit, you would have found it in 15 seconds.
And then in another 20 seconds you would have a listing of all files where the constant is ever used, just by telling it which subset of files to look in.

I'm sorry, but I used that, it told me nothing useful. Please try it, with this variable, and see what you get. You will get the fact that it is used, but never set in many files. Please try it and show me how you can determine where that variable is set based on the results, and what config page it is actually set on.

Not only that, I have many developer's tools here on my computer, I can search all of the source code and template code with many different approaches.

I'm not sure what your point is, but I believe the info I have posted here can be useful to someone else who is new to zencart.

25 Apr 2008, 3:55 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

karma-lab:

I'm sorry, but I used that, it told me nothing useful. Please try it, with this variable, and see what you get. You will get the fact that it is used, but never set in many files. Please try it and show me how you can determine where that variable is set based on the results, and what config page it is actually set on.

Not only that, I have many developer's tools here on my computer, I can search all of the source code and template code with many different approaches.

I'm not sure what your point is, but I believe the info I have posted here can be useful to someone else who is new to zencart.
Okay, I'll indulge for a moment.

You're making it way more difficult than you need to, and I would not recommend your approach for newbies ... the tools are already provided. For example:

karma-lab:

Actually, I did figure out somewhat of a method for anyone who is interested.

  1. Search in the database configuration table, and find the variable name, such as SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCT.

  2. Check the database entry's configuration_group_id. In this case, it is '24'.

  3. In zencart/admin, choose any of the configuration pages, such as the first one 'My Store'.

  4. Check the URL at the top of the browser. It will say something like: http://yourdomain.com/zencart/admin/configuration.php?gID=1

  5. The end part is the Group Id. Change this to 24, and then hit enter. Voila, you are now on the page containing that variable. It's somewhere in the list. :smartalec:

  1. Go to Admin->Tools->Developers Toolkit.
  2. In the first input box, paste in the constant you're looking for: SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS
  3. Click search (without touching the pulldowns).
  4. Bam ... you are given a screen which shows you:
    a) the constant name
    b) its description
    c) where to set it
    d) a button to click to take you to the page where it can be changed
    e) a reference to the section in which it is configured if you wanted to navigate manually.

Takes longer to type out how it works than to actually use it.

No need to muss with the database.

... and if you want to see every place where the constant is used, simply paste the constant name in the appropriate input box and choose the grouping of files you want to search. In a couple seconds you'll see all the search results including filenames and line numbers.

.
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.

25 Apr 2008, 4:59 PM
#10
karma_lab avatar

karma_lab

Zen Follower

Join Date:
Apr 2008
Posts:
135
Plugin Contributions:
0

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

Thank you! You are, of course, right. However, let's examine why I never found this info in the first place.

When you go to developer's toolkit, the page is confusing. Why would I enter the variable in the first box and leave the files menu set to "None"? That doesn't seem to make sense. I don't want to search "no" files, I want to search something.

Secondly, when I looked at this page, and read the various options, I chose the last item on the page: "search all files". I figured I didn't want to search any specific groups, I wanted to search all of the files. And using this option indeed presents you with a listing of all the places in the files where it is used, but nothing useful about where you can find it. Also, you have this message about CONSTANTS under each search option; it makes it look like you can search for a constant with any of the methods.

Perhaps this is explained somewhere; I am not anti-documentation reading; I've read many things in the last week or so, but I can't say I'm overly impressed with the scattered organization of the documentation here.

Now that I know this, of course your method gives all the needed info and takes you directly to it. But I don't think this page makes it clear, at all, how it should best be used - especially to a zen-cart newbie. I think you should have the option to search for a constant and find where to set it more separate from the rest of the options on that page. Just a simple text box with no drop down menu, with a line divider after it, simply "search for CONSTANT in database" or something, clearly offset from the rest of the options, so that it is obviously the first thing to be tried. Thanks for listening.

25 Apr 2008, 5:12 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

I'm glad you follow it now!

We'll work on improving the usability of the page.

.
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.

25 Apr 2008, 5:31 PM
#12
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

DrByte:

  1. Go to Admin->Tools->Developers Toolkit.
  2. In the first input box, paste in the constant you're looking for: SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS
  3. Click search (without touching the pulldowns).
  4. Bam ... you are given a screen which shows you:
    a) the constant name
    b) its description
    c) where to set it
    d) a button to click to take you to the page where it can be changed
    e) a reference to the section in which it is configured if you wanted to navigate manually.

Is the above Browser dependent?

Using the above with SeaMonkey & FF returned 0 results.

However, using the last input box (my favorite) and selecting anything but 'none' from the dropdown list, returned:

Searching 924 files ... for:
SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCT

/home/username/public_html/shop/includes/modules/new_products.php

Zen Cart v1.3.8a

d) a button to click to take you to the page where it can be changed << this would be GREAT, if I could get it to work that way. :smile:

The learning is in the doing.

Potent Products

25 Apr 2008, 5:36 PM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

No, it's not browser-dependent.
Did you spell the key name correctly?
Did you follow step 3 correctly? ie: leave the pulldown alone?

Is this the first time you've used this tool? I figured this isn't the first you've seen it, given that you've been around the forums for some time.

.
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.

25 Apr 2008, 6:51 PM
#16
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

I can Copy & Paste with the best of them! :wink:
SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS

But... as with Steven300, the first time it did not work; multiple attempts actually. Then, after a time-out and having to log back in -- it now works -- with both Browsers???

Would be interesting to know if first time attempts at this by others also products 0 results. Then, upon logging back (not sure if Steven300 did that) see if it works.

The learning is in the doing.

Potent Products

25 Apr 2008, 7:07 PM
#17
steven300 avatar

steven300

Totally Zenned

Join Date:
Jan 2008
Posts:
1,564
Plugin Contributions:
1

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

Website Rob:

Would be interesting to know if first time attempts at this by others also products 0 results. Then, upon logging back (not sure if Steven300 did that) see if it works.

No, I definitely didn't log off at all. It said 0 results. Then a few minutes later, I had another go and it suddenly worked. I'm quite certain I didn't do anything different the second time. I definitely didn't do anything in admin in between the two attempts.

27 Apr 2008, 4:04 PM
#18
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How can you find where a value like SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS is set?

Be careful on cutting and pasting ...

There are times when cutting and pasting results in picking up those mysterious invisible characters that we cannot see but the code does and that will not be able to find what you are looking for if you want to search for something and there is a mystery character tacked onto the front or back of something that you cannot see ...

Isn't that something?! :cool:

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!