Post by klaviyojad » Sat Sep 19, 2020 7:17 am

Im using Opencart 3.0.3.6 and for catalog/controller/product/product.php

In the code here:

Code: Select all

if ($this->customer->isLogged()) {
				$data['customer_name'] = $this->customer->getFirstName() . ' ' . $this->customer->getLastName();
				$data['customer_first_name'] = $this->customer->getFirstName();
                                $data['customer_last_name'] = $this->customer->getLastName();
                                $data['customer_email'] = $this->customer->getEmail();
			} else {
				$data['customer_name'] = '';
			}
Ive added to the $data array to show customer_first_name, customer_last_name and customer_email

then in the TWIG file: catalog/view/theme/default/template/product/product.twig

I am adding code just to display these at the very top:

Code: Select all

{{ header }}
{{  customer_email }}
{{  customer_name }}
{{  customer_first_name }}
Only "customer_name" prints when I am logged in as a user. The others are blank.

Please help.

Newbie

Posts

Joined
Fri Aug 07, 2020 1:58 am

Post by klaviyojad » Sat Sep 19, 2020 7:52 am

This is so stupid, I had to go to Extensions > Modifications and click Clear and Refresh :bash:

Newbie

Posts

Joined
Fri Aug 07, 2020 1:58 am

Post by straightlight » Sat Sep 19, 2020 9:35 pm

Also use sprintf instead of adding HTML codes into PHP.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Users browsing this forum: Semrush [Bot] and 523 guests