Jump to content

Duplicate "Private Comment" function


Recommended Posts

Hello,

 

I'd like to have another box parallel to the "Private Note" on the customer's orders so I can write things there that the customer can see in the front office on my-account.tpl. How can I do so?

 

So far, I've duplicated what it's in:

1.- root>admin>themes>default>template>controllers>orders>helpers>view>view.tpl

2.- controllers/admin/AdminCustomerControllers.php

3.- Classes/Customer.php

4.- \js\admin.js

 

But doesn't work, it doesn't save anything. When I try to save, it sends me to a blank page in miweb.com/admin/ajax.php

 

Thanks for the help!

Edited by omar2886 (see edit history)
Link to comment
Share on other sites

  • 7 months later...

Hello,

 

Can you tell me how you did it? 

I want to actually add a second "Private note" in the customer information page in the backoffice and i duplicated the same files.

To keep it simple i just created note2  and it does not work.

For me the problem is that the second value is set as "undefined"

I changed the .js file like this 

function saveCustomerNote(customerId){
	var noteContent = $('#noteContent').val();
	var noteContentform = $('#noteContentform').val();
	var data = 'token=' + token_admin_customers + '&tab=AdminCustomers&ajax=1&action=updateCustomerNote&id_customer=' + customerId + '&note=' + encodeURIComponent(noteContent) + '&note2=' + encodeURIComponent(noteContentform);
	$.ajax({
		type: "POST",
		url: "index.php",
		data: data,
		async : true,
		success: function(r) {

			if (r == 'ok') {
				$('#submitCustomerNote').attr('disabled', true);
			}
			showSuccessMessage(update_success_msg);
		}
	});
}

Do you think you can help me?

Link to comment
Share on other sites

Hello,

 

No i do not but actually i found why the data was not saved in the database.

In the AdminCustomersController.php i forgot to add 

$customer->note2 = $note2;

after 

if (!empty($note) && !Validate::isCleanHtml($note)) {
                die('error:validation');
            }

And to add

$note2 = Tools::htmlentitiesDecodeUTF8(Tools::getValue('note2'));

After

if ($this->tabAccess['edit'] === '1') {
            $note = Tools::htmlentitiesDecodeUTF8(Tools::getValue('note'));

What i wanted to do is to create a form replicating the private notes and it worked. I don't think it's the cleanest way to do it but it's in developing mode.

 

If anybody wants to make a form for the clients but to be able to see only by the employees then tell me and i will guide you as far as i got (i mean with the raw version).

I needed it for example for a company that does service checking, here is a image of what i made:

 

xNXXWZd.png

zVaks7a.png

613tXtl.png

ibEKRpx.png

 

So as you can see, one big form that has a save at the end of it.

I thank you for you help omar2886 :)

Edited by bogdan90i (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...