Zen Cart Logo
Forums / Contribution-Writing Guidelines / Extra Configures file will not load configuration key values

Extra Configures file will not load configuration key values

Locked

Views: 4,858

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
6 Apr 2008, 8:55 AM
#1
mrmeech avatar

mrmeech

Zen Follower

Join Date:
Nov 2006
Location:
New York City
Posts:
248
Plugin Contributions:
0

Extra Configures file will not load configuration key values

Hello,

I am working on fixing up a PHPList mod, and one of the things i'm working on is to create functionality to be able to configure settings from within the Admin. However, for whatever reason, the auto-loading file that resides in the includes/extra_configures folder will not translate the configuration key (as set in the database) to the actual value. I can, however, echo the value of the key out on other pages on my site.

Here is a snippit of code from that file in the extra_configures folder - "ADMIN_VALUE_PHPLIST_DB" used to be filled in with a string with the database name written in and i'm trying to code this so the value is actually kept in the database in the Configurations table so it can be updated via the admin.

define('PHPLIST_DB', ADMIN_VALUE_PHPLIST_DB); //the name of the phplist database if same as Zen Cart, leave blank

The file is filled with other defines just like that and opening and closing PHP tags. And nothing else. Maybe i am missing an include/require? I can't figure it out... Any help is greatly appreciated!!

Thanks! :smile:

6 Apr 2008, 12:33 PM
#2
drbyte avatar

drbyte

Sensei

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

Re: Extra Configures file will not load configuration key values

You're trying to put this in the wrong location in terms of order of program execution. The extra-configures files are processed way before the database is even opened, let alone having any of the configuration keys loaded.

6 Apr 2008, 7:55 PM
#3
mrmeech avatar

mrmeech

Zen Follower

Join Date:
Nov 2006
Location:
New York City
Posts:
248
Plugin Contributions:
0

Re: Extra Configures file will not load configuration key values

DrByte:

You're trying to put this in the wrong location in terms of order of program execution. The extra-configures files are processed way before the database is even opened, let alone having any of the configuration keys loaded.

I have found the Zen Cart program flow (i attached it to my response here in case any one else is reads this and can use it), and unfortunately i still need a nudge in the right direction.

The contribution i'm updating is coded to use the extra-configures file to set config options. I have been studying the flow chart, but cannot figure out what i need to do with this so that i can reference the configuration keys from the database. Can i simply drop the file somewhere else that so that it can define these values early on and get the database keys? Just a little confused here, and i'm having a hard time figuring it out based on what other contributions do...

Document: http://www.zen-cart.com/index.php?main_page=product_contrib_info&cPath=40_54&products_id=378

6 Apr 2008, 9:02 PM
#4
drbyte avatar

drbyte

Sensei

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

Re: Extra Configures file will not load configuration key values

There are a few ways.
Perhaps using the initSystem would suit best.

You can hook into the initSystem by:

  1. Rename your /includes/extra_configures/xxxxx.php file to:
    /includes/init_includes/my_init_phplist.php

  2. Create a new file: /includes/auto_loader/config.myphplistsettings.php
    with this content:```

<?php $autoLoadConfig[200][] = array('autoType'=>'init_script', 'loadFile'=> 'my_init_phplist.php'); ?>

<http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials>
6 Apr 2008, 10:03 PM
#5
mrmeech avatar

mrmeech

Zen Follower

Join Date:
Nov 2006
Location:
New York City
Posts:
248
Plugin Contributions:
0

Re: Extra Configures file will not load configuration key values

DrByte:

There are a few ways.
Perhaps using the initSystem would suit best.

You can hook into the initSystem by:

  1. Rename your /includes/extra_configures/xxxxx.php file to:
    /includes/init_includes/my_init_phplist.php

  2. Create a new file: /includes/auto_loader/config.myphplistsettings.php
    with this content:```

<?php $autoLoadConfig[200][] = array('autoType'=>'init_script', 'loadFile'=> 'my_init_phplist.php'); ?>

Oh that worked like a charm. :D

Is there anything i should be aware of if i do that same process on the admin side? I have a similar situation over there too..
7 Apr 2008, 2:21 AM
#6
drbyte avatar

drbyte

Sensei

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

Re: Extra Configures file will not load configuration key values

Similar infrastructure exists on the admin side.

7 Apr 2008, 3:58 AM
#7
mrmeech avatar

mrmeech

Zen Follower

Join Date:
Nov 2006
Location:
New York City
Posts:
248
Plugin Contributions:
0

Re: Extra Configures file will not load configuration key values

Thanks so much! That was really a great help! :D