[eluser]kaedus[/eluser]
[quote author="CroNiX" date="1330469795"]When loading libraries, leave off the .php ($this->load->library('shopify');
In your _assign_libraries() method, you load the config and use the 2nd parameter set to TRUE, which assigns the config to a variable, but you don't assign it to a variable so it doesn't do anything.
Code:
$config = $this->load->config('shopify', TRUE);
Maybe you should assign it to a class variable, like $this->_config = $this->load->config('shopify', TRUE);
and then in your __construct() use $this->_config when retrieving the variables and assigning them to _api_key and _shared_secret.[/quote]
I went ahead an implemented your suggestions, so it now looks like this:
Code:
public function __construct ()
{
$this->_assign_libraries();
$this->_api_key = $this->_config->item('api_key', 'shopify');
$this->_shared_secret = $this->_config->item('shared_secret', 'shopify');
}
And the _assign_libraries() function looks like this:
Code:
public function _assign_libraries()
{
if($CI =& get_instance())
{
$this->load = $CI->load;
$this->config = $CI->config;
$this->_config = $this->load->config('shopify', TRUE);
return;
}
}
However I am now getting this error:
Fatal error: Call to a member function item() on a non-object in /Applications/XAMPP/xamppfiles/htdocs/CI/application/libraries/Shopify.php on line 27
where line 27 is
Code:
$this->_api_key = $this->_config->item('api_key', 'shopify');
Any ideas? I also fixed the shopify.php issue on loading the library.