Jump to content
Sign in to follow this  
Olof Larsson

[Contribution] U HTML Emails, Support and error reporting

Recommended Posts

This contribution will save you from writing the same order comments over and over in orders.php. It will add a drop down from which you can choose prewritten order comments that suits the order status you selected. The standard order comments can contain variables from the current order. This means you for example can have the name of your customer in a standard order comment, or the telephone number or the shipping address etc.!

 

Very effective and time saving ;)

 

Screenshots included.

Share this post


Link to post
Share on other sites

first of all i want to ask, the jquery is exactly the same as the oscommerce standard, why did you put it on package then? second what is the status id ?

i installed the contribution but it doesn't work for me.. It doesn't appear the options in the orders.php, it looks like i didn't add any options in the mysql.. I am using only one language (greek) and i saw that it has id 4, so i put on the language id 4 but didn't work too..

any idea?


I am Maintaining :

Product_Short_Description (i added it on specials.php and in shopping_cart.php)

City Shipping Rates With Admin (fixed the error that was giving wrong total shipping charges)

I had Created :

UTF bug fix on standard reviews system (admin & block)

Corrupted character on mysql with utf-8

Share this post


Link to post
Share on other sites
first of all i want to ask, the jquery is exactly the same as the oscommerce standard, why did you put it on package then? second what is the status id ?

i installed the contribution but it doesn't work for me.. It doesn't appear the options in the orders.php, it looks like i didn't add any options in the mysql.. I am using only one language (greek) and i saw that it has id 4, so i put on the language id 4 but didn't work too..

any idea?

 

See http://jquery.com/

OSCommerce does not include that javascript library as a default in OSCommerce MS2 rc2a, right? (I'm quiet sure that's the case)

 

The status_id is the status_id of the status id... For example in a non modified shop this would be the status id's:

1 = Pending

2 = Processing

3 = Delivered

 

1 is a status id

2 is a status id

3 is a status id

 

To fix your error. Make sure you have installed the contribution correctly. All new files must be there and the orders.php file must have the php part added to it which is new.

 

Also the database entries must be correct. To begin with: Modify the examples provided. Change language_id to 4 for all examples and test if it works. The example uses the status_id's 1, 2 and 3.

 

Also: if there is ANY error in any of the comments_text entries in the database this will make the contribution crash. I think you can see this as nothing of the page orders.php is loaded after the position the module standard_order_comments.php is required/included.

 

Good luck. :) Ask ahead if you have any other questions.

Share this post


Link to post
Share on other sites

i tried everything.. have a look!

 

mysql.jpg


I am Maintaining :

Product_Short_Description (i added it on specials.php and in shopping_cart.php)

City Shipping Rates With Admin (fixed the error that was giving wrong total shipping charges)

I had Created :

UTF bug fix on standard reviews system (admin & block)

Corrupted character on mysql with utf-8

Share this post


Link to post
Share on other sites

Some thoughts:

Can javascript handle those letters?

 

Try to install the contribution on a vanilla rc2a store and see if you can manage to do that.

 

To get something in the standard comments drop down you have to choose a new order status from the order status drop down. It is always empty to begin with.

 

i tried everything.. have a look!

 

mysql.jpg

Share this post


Link to post
Share on other sites

i made it finally, thank you.. there wasn't any problem.. just the status id had to be bigher:) great contrib..


I am Maintaining :

Product_Short_Description (i added it on specials.php and in shopping_cart.php)

City Shipping Rates With Admin (fixed the error that was giving wrong total shipping charges)

I had Created :

UTF bug fix on standard reviews system (admin & block)

Corrupted character on mysql with utf-8

Share this post


Link to post
Share on other sites

It really is a great contribution, and a long time coming too. Do you think a comment adding/editing interface will be in the works soon?

 

Anthony

Share this post


Link to post
Share on other sites
It really is a great contribution, and a long time coming too. Do you think a comment adding/editing interface will be in the works soon?

 

Anthony

 

Thank you :)

I doubt I will create one soon because I don't need one. I use phpMyAdmin and that works great for me. So I think I will leave the work to create a comment adding/editing interface to someone else. However I might suddenly create one just because the fun of it :D . But I can't say if and when on beforehand.

Share this post


Link to post
Share on other sites

Hi Olof:

 

I've got just the same problem than draculakos. Comments combo box appears empty. I just installed the contribution changing nothing but adding my own spanish comments to the table:

 

INSERT INTO standard_order_comments VALUES (5,3, 3, 1, 'Recogida', '"Su Pedido será enviado a:\\n\\n" . tep_address_format($order->customer[''format_id''], $order->delivery, 0, '''', ''\\n''). "\\n\\n."');
INSERT INTO standard_order_comments VALUES (6, 3, 3, 2, 'Envío por Correo', '"Su pedido será enviado por correo"');
INSERT INTO standard_order_comments VALUES (7, 3, 2, 1, 'Su pedido está siendo gestionado...', '"Estamos gestionando su pedido que será enviado a la mayor bravedad."');
INSERT INTO standard_order_comments VALUES (8, 3, 2, 2, 'Prepago ', '"Su pedido será enviado tan pronto recibamos su pago.\\n\\nUse \\"".$payment_reference."\\" como referencia para el pago.\\n\\nSi tiene cualquier pregunta, por favor responda a este e-mail."');

 

Mi orders status_id values, where I want to insert standard comments are 2 and 3, as I tried to do.

 

I have also tried to change the standard texts to be like that "Words without code"... trying to see if the mistake was the embed php... but it changes nothing...

 

First time I edit the order, the combo is empty, then I change the order status from pending (0) to proccess(1), and combo stays empty... What am I doing wrong?

 

Thanks a lot!!! Regards from Spain...

 

Ana

Share this post


Link to post
Share on other sites
Hi Olof:

 

I've got just the same problem than draculakos. Comments combo box appears empty. I just installed the contribution changing nothing but adding my own spanish comments to the table:

 

INSERT INTO standard_order_comments VALUES (5,3, 3, 1, 'Recogida', '"Su Pedido será enviado a:\\n\\n" . tep_address_format($order->customer[''format_id''], $order->delivery, 0, '''', ''\\n''). "\\n\\n."');
INSERT INTO standard_order_comments VALUES (6, 3, 3, 2, 'Envío por Correo', '"Su pedido será enviado por correo"');
INSERT INTO standard_order_comments VALUES (7, 3, 2, 1, 'Su pedido está siendo gestionado...', '"Estamos gestionando su pedido que será enviado a la mayor bravedad."');
INSERT INTO standard_order_comments VALUES (8, 3, 2, 2, 'Prepago ', '"Su pedido será enviado tan pronto recibamos su pago.\\n\\nUse \\"".$payment_reference."\\" como referencia para el pago.\\n\\nSi tiene cualquier pregunta, por favor responda a este e-mail."');

 

Mi orders status_id values, where I want to insert standard comments are 2 and 3, as I tried to do.

 

I have also tried to change the standard texts to be like that "Words without code"... trying to see if the mistake was the embed php... but it changes nothing...

 

First time I edit the order, the combo is empty, then I change the order status from pending (0) to proccess(1), and combo stays empty... What am I doing wrong?

 

Thanks a lot!!! Regards from Spain...

 

Ana

 

 

It is hard to help others without sitting in front of their computer XD

Test if the javascript that is generated contains errors. I think "web developers toolbar" or "firebug" (firefox plugins) can help you with this. If nothing changes in the box there might be a javascript error somehow.

Share this post


Link to post
Share on other sites

Hi,

I have the same [problem. It is maybe something to do with languages: English works but Dutch does not.

There is an error to be found in the javascript console:

<b>Parse error</b>: syntax error, unexpected '"' in <b>/sites/sleepcool.nl/www/admin/includes/modules/standard_order_comments.php(49) : eval()'d code</b> on line <b>3</b><br />

 

Hope this helps to sort out the problem.

Regards,martina

Share this post


Link to post
Share on other sites
Hi,

I have the same [problem. It is maybe something to do with languages: English works but Dutch does not.

There is an error to be found in the javascript console:

<b>Parse error</b>: syntax error, unexpected '"' in <b>/sites/sleepcool.nl/www/admin/includes/modules/standard_order_comments.php(49) : eval()'d code</b> on line <b>3</b><br />

 

Hope this helps to sort out the problem.

Regards,martina

 

That straight away tells us you have done something wrong with quotation in the database :)

Find out why the parser is not expecting that quote :)

Share this post


Link to post
Share on other sites
That straight away tells us you have done something wrong with quotation in the database :)

Find out why the parser is not expecting that quote :)

 

THX. I now understand that it is all my fault: the quotes are all mixed up and sometimes spaces do matter...

Sorry about the trouble. I should be more careful.

Share this post


Link to post
Share on other sites
THX. I now understand that it is all my fault: the quotes are all mixed up and sometimes spaces do matter...

Sorry about the trouble. I should be more careful.

 

THANKS A LOT Olof and Martina!!!

 

Same error for me. My translation to spanish was wrong made...

 

I deleted the spanish rows and set Olof's english rows, language_id = 3...

 

I obtained this error:

<br />
<b>Warning</b>:  Missing argument 6 for tep_address_format(), called in /home/cmbaratas/domains/.../standard_order_comments.php(49) : eval()'d code on line 1 and defined in <b>/home/cmbaratas/domains/../general.php</b> on line <b>376</b><br />
<br />
<b>Warning</b>:  Missing argument 7 for tep_address_format(), called in /home/cmbaratas/domains/..modules/standard_order_comments.php(49) : eval()'d code on line 1 and defined in <b>/home/cmbaratas/domains/../general.php</b> on line <b>376</b><br />

 

That's very easy to solve changing

 

 tep_address_format($order->customer[''format_id''], $order->delivery, 0, '''', ''\\n'')

 

to

 

tep_address_format($order->customer[''format_id''], $order->delivery, 0, '''', ''\\n'','''','''')

 

Thank you both!!!

 

Ana

Edited by ajuaristi

Share this post


Link to post
Share on other sites

great contribution. i just wanted to add a tip for others:

 

I am using creloaded 6.3 with this. it initially broke the javascript on the page due to conflicts with the prototype javascript which was already there.

i just had to modify standard_order_comments.php to use jquery's noconflict mode, and it was all good

Share this post


Link to post
Share on other sites

Hey great contrib.

 

How do I include customers first name in the comments?

 

Thanks

Share this post


Link to post
Share on other sites

Seems to be very great.

 

Is it possible to make a order comment like:

 

Hello xxx, (automatic)

 

You order has been delivered xxx (date) (automatic)

 

We would be happy if you could write a review about our company at xxcsdf.com

 

Regards

Company name

Share this post


Link to post
Share on other sites

Great contribution saves a lot of work.

But have same questions as supplementler.

when I use \\n\\n" . tep_address_format($order->customer[''format_id''], $order->delivery, 0, '''', ''\\n''). "\\n\\n I get the whole adres

and I want only the first and last name.

 

How can a get automatic date?

 

Is it possible to make a order comment like:

 

Hello xxx, (automatic)

 

You order has been delivered xxx (date) (automatic)

 

We would be happy if you could write a review about our company at xxcsdf.com

 

Regards

Company name

Share this post


Link to post
Share on other sites

Great contribution.

I don't know why it happens but when I run in local server (XAMPP) goes fine but when it runs in net server all area in order.php below the tag require(DIR_WS_MODULES . 'standard_order_comments.php'); simply desappeared.

:(

Share this post


Link to post
Share on other sites
Great contribution.

I don't know why it happens but when I run in local server (XAMPP) goes fine but when it runs in net server all area in order.php below the tag require(DIR_WS_MODULES . 'standard_order_comments.php'); simply desappeared.

:(

 

Fixed.

Sorry guys, but i had run sql code into the wrong database.

Share this post


Link to post
Share on other sites

Working offline with xammp

 

I have added this contribution to my website, but I had / have a problem with it. I have already installed it a few times, it's very easy.

 

I followed the instruction to add standard_order.... to orders.php, run the .sql file, copied the files to the server.

 

Then I started to check, yes it works! I can see the example text when I changed order status, as it should be.

I also tried to work out soms status text with my status Id, and also have checked it. That's working fine.

 

But then I shutdown my computer, a few hours later I started my computer and browser again, went to orders.php and tried to change the order status, that works but the dropdown list with standard order comment stays empty. Also there is no auto fill in anymore. Looking in the sql database, table is still filled.

 

Anyone an idea?

Share this post


Link to post
Share on other sites

I have also tried the no conflict code mentioned a few post before, like this:

<?php 
/*
Here you can fix some diverse variables you would like to exist for use in your standard comments in you database. 
The $payment_reference is an example. If the customers name is "John Doe" and the order_id is 125, then $payment_reference will be "John D 125". In my webshop I ask my customers to use that as their payment refference.
*/
$payment_reference = substr($order->delivery['name'],0,strpos($order->delivery['name'],' ')+2) . ' ' .(int)$oID;
?>

<script type="text/javascript" src="../includes/jquery.js"></script>
<script type="text/javascript"><!--    
var $j = jQuery.noConflict();

$j(document).ready(function(){
   // Here we will use jquery to alter some html with javascript after the page is loaded.
   //This will make the contribution very easy to install obviously.
   $j("[name=status]").filter("select").attr("id","theStatusDropDown"); //Give theStatusDropDown a propper id. 
   $j("[name=comments]").filter("textarea").attr("id","theCommentTextArea"); //Give theCommentTextArea a propper id. 
   $j("#theStatusDropDown").change(onSelectStatusChange); //Define the onChange function for theStatusDropDown
});

function onSelectStatusChange(){
   //We will now uppdate the theCommentsDropDown by giving it the different the standard order comments avaliable
   $j("#theCommentsDropDown").children("option").remove();//This will remove all options from the drop down.

   var ChoosenStatusID = $j("#theStatusDropDown").attr("value"); //Get the order status ID currently choosen in the drop down.
   //Here follows if-statements that will addCommentsOptions depending on what ChoosenStatusID is.
   //These if statements are generated by php in combination with database entries.

<?php
$standard_order_comments_query = tep_db_query("SELECT status_id, comments_name, comments_id FROM standard_order_comments WHERE languages_id='" . (int)$languages_id . "' ORDER BY sort_order");
while ($standard_order_comment = tep_db_fetch_array($standard_order_comments_query)) {
   echo '    if(ChoosenStatusID == \'' . $standard_order_comment['status_id'] . '\'){addCommentsOption(\'' . $standard_order_comment['comments_name'] . '\',\'' . $standard_order_comment['comments_id'] . '\');}'."\n";
}

?>

   //set the text in it to the first one in theCommentsDropDown. In case something was there the user did not want to be overwritten, it can be revived using ctrl-z
   setComment();
}

function setComment(){
   var ChoosenCommentsID = $j("#theCommentsDropDown").attr("value"); //Get the ID of the choosen standard order comment. This ID is the same id as in the database (comments_id)
   //Here follows a case statement that will set the textarea depending on what ChoosenCommentsID is.
   //the statement is generated by php that takes the standard order comment from the database.

   switch (ChoosenCommentsID){
<?php 
$comments_query = tep_db_query("SELECT comments_id, comments_text FROM standard_order_comments WHERE languages_id='" . (int)$languages_id . "'");
while ($comment = tep_db_fetch_array($comments_query)) {
   eval('$temp_comments_text='.$comment['comments_text'].';');
   $temp_comments_text = str_replace(array('"',"'", "\r", "\n", "\0"), array('\"','\\\'','\r', '\n', '\0'), $temp_comments_text); //Make the string a javascript one by fixing the newlines and special chars etc..
   echo '        case \'' . $comment['comments_id'] . '\':setCommentText(\'' . $temp_comments_text . '\');break;'."\n";
}
?>
   }
}

function setCommentText(text){
   document.getElementById('theCommentTextArea').value = text;
}

function addCommentsOption(text,value)
{
   var optn = document.createElement("OPTION");
   optn.text = text;
   optn.value = value;
   document.getElementById('theCommentsDropDown').options.add(optn);
}
//--></script>

     <tr>
       <td class="main" style="padding:0px 6px;"><?php echo '<b>Standard Comments: </b>' . tep_draw_pull_down_menu('theCommentsDropDown',array(),'monkey','id="theCommentsDropDown" onChange="setComment()"'); ?></td>
     </tr>

 

But even that seems not working, are I did make the wrong changes...

and I have also copied jquery.js in both includes maps, but no change

Share this post


Link to post
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
Sign in to follow this  

×