Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Why the osc understand which table information to retrieve?


smithveg

Recommended Posts

Hello,

 

When i do some reading in the form_check.js.php. I noticed that the php code just need to put the 'ENTRY_FIRST_NAME_MIN_LENGTH', then it seems automatically retrieve the information from configuration's ENTRY_FIRST_NAME_MIN_LENGTH value.

 

I'm really confusing. Can anyone tell me, why the osc will know it should retrieve the data from configuration table instead of others. When the program start to do the database connection?

 

Is that database connection is always made once a page is refresh. I'm really interesting in this. Hopes that i had post this thread in the correct section in this forums.

 

Smithveg

****

Hello World! ^.^ I'm a Internet naive. Browse my working profile

Malaysia Web Services - OPerion Website Marketing System

Link to comment
Share on other sites

This is the simplified explanation

 

If you look into the files you will see the initial call

require('includes/application_top.php');

and in includes/application_top.php there is this bit of code that gathers the configuration values

// set the application parameters
 $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
 while ($configuration = tep_db_fetch_array($configuration_query)) {
define($configuration['cfgKey'], $configuration['cfgValue']);
 }

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Whether or not it is the correct forum section, the issue itself, IMHO, is less interesting (in fact boring). If you are really really insterested, then here is a pointer:

Starting from header.php, which every page must have/use, then application_top.php, which the header.php requires (about the first line of code), and then the list of files goes on from application_top.php ...You will need to draw a diagram... until you find what you want, e.g. references to the configuration table.

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

Whether or not it is the correct forum section, the issue itself, IMHO, is less interesting (in fact boring). If you are really really insterested, then here is a pointer:

Starting from header.php, which every page must have/use, then application_top.php, which the header.php requires (about the first line of code), and then the list of files goes on from application_top.php ...You will need to draw a diagram... until you find what you want, e.g. references to the configuration table.

 

Ken

 

Thanks for 241. I tries to read the section of code your show me in applciation_top.php

I not really understand. Why must replace with cfgey and cfgvalue. Moreover, i never see these two words in pages.

 

Thanks for GemRock. I know this is somehow technical question. This is probably a boring thread for a non-programmer users. Thank your ideas. I know that it will first go into index.php. Then find the application_top.php. I know application_top.php is something a file that control the whole games. Then i tries to read it. Huh!!! Very very long. Very very complicated. I hard to understand it. So, that i just start to study it one part by another. That's why the question arise, when i go into form_check.js.php. I wondering how can the application understand it must retrieve the data from Configuration table. As what 241 show me that part. I totally not understand.

 

Smithveg

****

Hello World! ^.^ I'm a Internet naive. Browse my working profile

Malaysia Web Services - OPerion Website Marketing System

Link to comment
Share on other sites

The code that I showed from application_top.php is creating the defines based on the

$configuration['cfgKey']

and

$configuration['cfgValue']

taken from the configuration table of the database.

 

One of these entries in this case configuration_id 19 has a configuration_key of ENTRY_FIRST_NAME_MIN_LENGTH and a configuration_value of 2

 

as the query is written to use cfgKey for configuration_key and cfgValue for configuration_value you would end up with a define like this

define('ENTRY_FIRST_NAME_MIN_LENGTH', '2');

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

define('ENTRY_FIRST_NAME_MIN_LENGTH', '2');

 

Hi, Thank your explanation. I understand it now.

 

Another question. Does it means we can simply use the 'ENTRY_FIRST_NAME_MIN_LENGTH' in everywhere after we retrieve the '2' from database into it. I means once the application_top.php is call.

****

Hello World! ^.^ I'm a Internet naive. Browse my working profile

Malaysia Web Services - OPerion Website Marketing System

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...