Post by emanjackson » Wed Feb 27, 2019 8:46 pm

Hi Everyone,
Please forgive me if this is posted in the wrong place, I am new to this Forum.
Can anyone tell me if it is possible to display "Points Earned" in a customers account overview page? I cannot seem to find anywhere to show this. I need our customers to be able to see at a glance when they log in, how many points they have earned. OC version 1.5.5.1
TIA

Newbie

Posts

Joined
Mon Apr 09, 2018 9:23 pm

Post by straightlight » Wed Feb 27, 2019 9:57 pm

In more recent OC versions, this has been added already. In your catalog/model/account/customer.php file, see if you have this method:

Code: Select all

public function getRewardTotal($customer_id) {
		$query = $this->db->query("SELECT SUM(points) AS total FROM " . DB_PREFIX . "customer_reward WHERE customer_id = '" . (int)$customer_id . "'");

		return $query->row['total'];
	}
	
If not, you'll need to add it in.

Then, in your catalog/controller/account/account.php file, you'll need to add this line before the end of the index() method:

Code: Select all

$this->data['reward'] = $this->url->link('account/reward', '', true);

$this->data['text_reward'] = $this->language->get('text_reward');
Then, in your catalog/language/account/account.php file, add at the bottom:

Code: Select all

$_['text_reward']         = 'Your Reward Points';
Then, in your catalog/view/theme/<your_theme>/template/account/account.tpl file,

add:

Code: Select all

<?php if ($reward) { ?>
    <?php echo $text_reward; ?>: <?php echo $reward; ?>
<?php } ?>
Where you see fit.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by emanjackson » Wed Feb 27, 2019 10:23 pm

Hi Straighlight,
Thank you for the reply, I will look into doing this.
Is there any other way,except for upgrading the OC version? Speaking of upgrading, how easy or difficult would it be to upgrade the OC ver? And do you have to do it progressively, or will one upgrade cover all?

Much appreciated.

emanjackson

Newbie

Posts

Joined
Mon Apr 09, 2018 9:23 pm

Post by straightlight » Wed Feb 27, 2019 10:31 pm

Is there any other way,except for upgrading the OC version? Speaking of upgrading, how easy or difficult would it be to upgrade the OC ver? And do you have to do it progressively, or will one upgrade cover all?
FAQ: viewtopic.php?f=176&p=739789#p730051

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 2 guests