Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Another minor PHP problem......


ComicWisdom

Recommended Posts

:) I am trying to clone the payment module into a storelocation module so that there will be selections for which store of a small chain will receive the sendextraemailto. They all deliver in their own local district.

 

I seem to be getting there but every once in a while, I run into something I just don't understand.

 

These lines give me the following error.

 

"Fatal error: Call to undefined function: selection() in ... catalog/includes/classes/storelocation.php on line 133"

 

These lines 132 & 133 directly correspond to lines 132 & 133 in catalog/includes/classes/payment.php.

 

line 132  if ($GLOBALS[$class]->enabled) {
line 133			  $selection = $GLOBALS[$class]->selection();

Just between us, remember there are only 10 kinds of people in the world; those who understand binary and those who don't!!

 

Remember, learning is a "do-it-yourself" experience; although, not necessarily a "do-it-BY-yourself" experience.

 

The quickest way to learn is to forget to BACKUP!

Link to comment
Share on other sites

Have you created a selection() function for the StoreLocation class yet?

 

 

I thought I had.... but.... where is that supposed to be created. I've tried to match up all the similar coding from both the shipping and the payment module. I must be over looking something. Where do I create it?

Just between us, remember there are only 10 kinds of people in the world; those who understand binary and those who don't!!

 

Remember, learning is a "do-it-yourself" experience; although, not necessarily a "do-it-BY-yourself" experience.

 

The quickest way to learn is to forget to BACKUP!

Link to comment
Share on other sites

I thought I had.... but.... where is that supposed to be created. I've tried to match up all the similar coding from both the shipping and the payment module. I must be over looking something. Where do I create it?

In the classes area. For example, see catalog/includes/classes/payment.php. Its selection() method looks like this:

 

// class methods
// .....

function selection() {
  $selection_array = array();

  if (is_array($this->modules)) {
	reset($this->modules);
	while (list(, $value) = each($this->modules)) {
	  $class = substr($value, 0, strrpos($value, '.'));
	  if ($GLOBALS[$class]->enabled) {
		$selection = $GLOBALS[$class]->selection();
		if (is_array($selection)) $selection_array[] = $selection;
	  }
	}
  }

  return $selection_array;
}

Link to comment
Share on other sites

I have it looks like character for character. Starts on line 125in classes storelocation.php

  function selection() {
  $selection_array = array();

  if (is_array($this->modules)) {
	reset($this->modules);
	while (list(, $value) = each($this->modules)) {
	  $class = substr($value, 0, strrpos($value, '.'));
	  if ($GLOBALS[$class]->enabled) {
		$selection = $GLOBALS[$class]->selection();
		if (is_array($selection)) $selection_array[] = $selection;
	  }
	}
  }

  return $selection_array;
}

Just between us, remember there are only 10 kinds of people in the world; those who understand binary and those who don't!!

 

Remember, learning is a "do-it-yourself" experience; although, not necessarily a "do-it-BY-yourself" experience.

 

The quickest way to learn is to forget to BACKUP!

Link to comment
Share on other sites

Where do you create your new storelocation class from? It is a direct replacement for the payment class?

 

You will need for the storelocation class to be required somewhere. For example, the checkout_payment.php file has the following:

 

 require(DIR_WS_CLASSES . 'payment.php');
$payment_modules = new payment($payment);

You would need something similar for storelocation.php.

 

Looking over your original post too I notice the error is actually IN the class file. ("Fatal error: Call to undefined function: selection() in ... catalog/includes/classes/storelocation.php on line 133").

line 132  if ($GLOBALS[$class]->enabled) {
line 133			  $selection = $GLOBALS[$class]->selection();

This suggests that $GLOBALS[$class] is resolving to an object that doesn't have a selection method. That object is possibly not be a storelocation object. Maybe you could post more of the code, or maybe you know already what object $GLOBALS[$class] is resolving to?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...