Post by craig100 » Wed Mar 16, 2011 1:01 am

Being new to MVC and fairly new to PHP I'm having a little issue with hitting a new function. Debugging isn't helping any. It just falls over as soon as findOrderInProcess is called. Can anyone help?

In catalog/controller/checkout/payment.php I have:-
//Check for first or subsequent payment
if ($this->customer->isLogged()) {
$this->data['firstPayment'] = $this->model_checkout_order->findOrderInProcess('123'); //This is line 188
}

In catalog/model/checkout/order.php I have:-

public function findOrderInProcess($customer_id) {
//Code stripped out for test purposes
return 'hello';
}

Apache Error logs tells me:-
PHP Fatal error: Call to a member function findOrderInProcess() on a non-object in /home/craig/NetBeansProjects/fabtours/catalog/controller/checkout/payment.php on line 188, referer: http://fabtours/

Have I missed a vital step elsewhere?

Cheers,

Craig

Newbie

Posts

Joined
Mon Feb 28, 2011 7:50 pm

Post by SapporoGuy » Wed Mar 16, 2011 1:43 am

Do you have a call for the model?

Code: Select all

$this->load->model('checkout/order');

930sc ... because it is fun!


User avatar
Active Member

Posts

Joined
Mon Nov 01, 2010 7:29 pm

Post by craig100 » Wed Mar 16, 2011 1:53 am

That was it. Thanks for that. I'm learning fast;)

Craig

Newbie

Posts

Joined
Mon Feb 28, 2011 7:50 pm

Post by SapporoGuy » Wed Mar 16, 2011 2:34 am

Sweet! ;D

930sc ... because it is fun!


User avatar
Active Member

Posts

Joined
Mon Nov 01, 2010 7:29 pm

Post by craig100 » Sat Mar 19, 2011 12:50 am

Thought I'd keep the same thread going as I'm having a concept learning problem again as a noob.

I'm developing a "payment by instalment" system in OpenCart for a client. All going well so far apart from I decided that for subsequent payments I would build a new payment View and Controller called checkout/new_payment.php by copying checkout/payment.php. and checkout/new_payment.tpl copied from checkout/payment.tpl.

I modified the controller's class to ControllerCheckoutNewPayment and it is called correctly, it loads the new language file but still loads the old payment.tpl instead of the new new_payment.tpl. I thought the View loading was just by virtue of the file name being the same as the Controller. Is it controlled some other way? Do I need to specifically call it somewhere? If so, where?

Any help on this would be cool as I've been banging my head against the wall for hours on this:(

Cheers,

Craig

Newbie

Posts

Joined
Mon Feb 28, 2011 7:50 pm

Post by craig100 » Sat Mar 19, 2011 2:33 am

Found it at last, sorry to bother!

Here it is, just before the $this->render call

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/checkout/new_payment.tpl')) {
$this->template = $this->config->get('config_template') . '/template/checkout/new_payment.tpl';
} else {
$this->template = 'default/template/checkout/payment.tpl';
}

$this->children = array(
'common/column_right',
'common/footer',
'common/column_left',
'common/header'
);

$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
}

Newbie

Posts

Joined
Mon Feb 28, 2011 7:50 pm
Who is online

Users browsing this forum: No registered users and 1 guest