Hi there,
I am working on a wholesale shop with OpenCart. The problem I am facing is, that my clients know their customers by the company names, but not by the contact person registered to their website. Therefore we need to show the company names instead of the persons names in the admin panel.
Is there any way of achieving this, without hard coding any changes in the admin templates?
Many thanks,
Jacob
I am working on a wholesale shop with OpenCart. The problem I am facing is, that my clients know their customers by the company names, but not by the contact person registered to their website. Therefore we need to show the company names instead of the persons names in the admin panel.
Is there any way of achieving this, without hard coding any changes in the admin templates?
Many thanks,
Jacob
The problem is that company name is located in address table not customer. You can try add this in customer controller:
Code: Select all
$address_info = $this->model_customer_customer->getAddress($result['address_id']);
if ($address_info && $address_info['company']) {
$name = $address_info['company'];
} else {
$name = $result['name'];
}
$data['customers'][] = array(
'customer_id' => $result['customer_id'],
'name' => $name,
you can search in extension store, i developed an extention to do so..
Inviato dal mio Find 5 utilizzando Tapatalk
Inviato dal mio Find 5 utilizzando Tapatalk
-----------------------------------------------------------------------
My last mods: Partita IVA e CF | Pro EU VAT Number | Sales Agents | Pricelist Pro
-----------------------------------------------------------------------
Thanks for that, but the code returns the following error:daniGo wrote:The problem is that company name is located in address table not customer. You can try add this in customer controller:
Code: Select all
$address_info = $this->model_customer_customer->getAddress($result['address_id']); if ($address_info && $address_info['company']) { $name = $address_info['company']; } else { $name = $result['name']; } $data['customers'][] = array( 'customer_id' => $result['customer_id'], 'name' => $name,
Fatal error: Call to a member function getAddress() on null in /home/../public_html/admin/controller/sale/customer.php on line 478
Which OC version you use?
Try change
$this->model_customer_customer->getAddress($result['address_id']);
in
$this->model_sale_customer->getAddress($result['address_id']);
Try change
$this->model_customer_customer->getAddress($result['address_id']);
in
$this->model_sale_customer->getAddress($result['address_id']);
if you just want to display company name instead of customer first/last name on Admin->Customers->Customers(LIST)
then just modify the model file "admin/model/customer/customer.php"(use vqmod better)
search for:
replace with:
then just modify the model file "admin/model/customer/customer.php"(use vqmod better)
search for:
Code: Select all
public function getCustomers($data = array()) {
$sql = "I CAN'T PASTE DOWN THE DEFAULT CODE AS OF OPENCART WEBSITE WONT ALLOW ME TO DO IT, SEARCH ABOVE LINE INSTEAD";
Code: Select all
public function getCustomers($data = array()) {
$sql = "SELECT c.*, ad.company AS name, cgd.name AS customer_group FROM " . DB_PREFIX . "customer c LEFT JOIN " . DB_PREFIX . "customer_group_description cgd ON (c.customer_group_id = cgd.customer_group_id) LEFT JOIN " . DB_PREFIX . "address ad ON (ad.address_id = c.address_id) WHERE cgd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
You can't control the weather, but you can change your mood.
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.
OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.
OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE
Thanks, that actually worked. However the search does not seem to work anymore. When I click on the "Customer" input field it shows me the 5 first customers, but when I start typing no further predictions come up and even if I select one of the automatic predictions, it returns no results. Any idea what's wrong here?
We also needed to be able to see in a column the company name from sales list or company list and to be able to filter customers and orders by company name.
This extension works and we just happen to be using it on the same version of OC as you are.
https://www.opencart.com/index.php?rout ... _id=670060.
It is just a one file vqmod install and you can move on.
This extension works and we just happen to be using it on the same version of OC as you are.
https://www.opencart.com/index.php?rout ... _id=670060.
It is just a one file vqmod install and you can move on.
search for "C O N C A T(c.firstname, ' ', c.lastname) LIKE" and replace it with "ad.company LIKE"
please note that there are no spaces on "C O N C A T" on the real code
please note that there are no spaces on "C O N C A T" on the real code
You can't control the weather, but you can change your mood.
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.
OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.
OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE
Who is online
Users browsing this forum: No registered users and 425 guests