Jump to content

Fatal error: Using $this when not in object context


chrism2011

Recommended Posts

I get the error code "Fatal error: Using $this when not in object context in /home/feenetwo/public_html/language/english/mails/sale_third_party_notification.php on line 7" when I complete the form from the link in the screenshot atached...

 

the site is feenetwork.com and im getting really fustrated with it....

 

Can anyone help?

 

[attachment deleted by admin]

sorry here is the file thats getting the error...

 

<?
## Email File -> notify buyer on a successful purchase
## called only from the $item->assign_winner() function!

if ( !defined('INCLUDED') ) { die("Access Denied"); }

$sale_details = $this->get_sql_row("SELECT w.*, u.name, u.email 
a.name AS item_name, a.currency FROM " . DB_PREFIX . "winners w 
LEFT JOIN " . DB_PREFIX . "applications_details u ON u.application_id=w.application_id
LEFT JOIN " . DB_PREFIX . "auctions a ON a.auction_id=w.auction_id
WHERE w.winner_id='" . $mail_input_id . "'");

$send = true;

## text message - editable
$text_message = 'Dear %1$s,

You have successfully purchased %2$s.

Purchase Details:

- price: %3$s
- quantity purchased: %4$s
- auction url: %7$s

For more details about the purchase, please access the "Won Items" page, by clicking on the link below:  

%5$s

After you have accessed the page above, click on the "Message Board" link next to each item won.
This message board is your direct communication board with the seller. Please use this board to ask 
any post sale questions you might have.

Important: To help resolve any possible disputes ensure you use the board for all queries and updates.

Best regards,
The %6$s staff';

## html message - editable
$html_message = 'Dear %1$s, <br>
<br>
You have successfully purchased %2$s. <br>
<br>
Purchase Details: <br>
<ul>
<li>Price: <b>%3$s</b> </li>
<li>Quantity Purchased: <b>%4$s</b> </li>
<li>Auction URL: [ <a href="%7$s">Click to View</a> ] </li>
</ul>
For more details about the purchase, please access the [ <a href="%5$s">Won Items</a> ] page. <br>
<br>
After you have accessed the page above, click on the "Message Board" link next to each item won. <br>
This message board is your direct communication board with the seller. Please use this board to ask 
any post sale questions you might have. <br>
<br>
Important: To help resolve any possible disputes ensure you use the board for all queries and updates. <br>
<br>
Best regards, <br>
The %6$s staff';


$items_won_link = SITE_PATH . 'login.php?redirect=' . process_link('members_area', array('page' => 'bidding', 'section' => 'won_items'));
$auction_link = process_link('auction_details', array('name' => $sale_details['item_name'], 'auction_id' => $sale_details['auction_id']));

$this->fees = new fees();
$this->fees->setts = $this->setts;
$sale_price = $this->fees->display_amount($sale_details['bid_amount'], $sale_details['currency']);

$text_message = sprintf($text_message, $sale_details['name'], $sale_details['item_name'], $sale_price, $sale_details['quantity_offered'], $items_won_link, $this->setts['sitename'], $auction_link);
$html_message = sprintf($html_message, $sale_details['name'], $sale_details['item_name'], $sale_price, $sale_details['quantity_offered'], $items_won_link, $this->setts['sitename'], $auction_link);

send_mail($sale_details['email'], 'Auction ID: ' . $sale_details['auction_id'] . ' - Successful Purchase', $text_message, 
$this->setts['admin_email'], $html_message, null, $send);
?>

I think the issue starts here:

 

<?php
...
$this->fees = new fees();
$this->fees->setts = $this->setts;
...
?>

 

When creating an instance of a class, it should be more like:

 

<?php
...
fees = new fees();
fees->setts = 'some value';
...
?>

 

 

 

It might be helpful to review the PHP manual section for classes:

http://www.php.net/manual/en/language.oop5.basic.php

The question is whether this file is included in another.  What little context we can see leads me to believe so.

 

Regardless, it's quite clearly a 3rd party script, and a bad one at that.  Whoever wrote it clearly doesn't understand basic OO principles.

Thanks for all your help...

 

I think it was written by one of my past collegues but not quite sure...

 

Its part of a site thats built on php probid.

 

Ill keep cracking on with it, im sure i will come up with something.

 

if anyone can shed some light on it please let me know.

 

Thanks again. 

 

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.