VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Development Projects, Modifications, Hacks & Tweaks. VM1.1 => Topic started by: Mr_Smurf on January 30, 2006, 16:08:52 pm

Title: Order Edit Addon
Post by: Mr_Smurf on January 30, 2006, 16:08:52 pm
Mod Note: this topic deals with an earlier version of the Order Edit Addon. You can find an active project dealing with this on our project management tools: Order Edit Addon (http://virtuemart.net/index.php?option=com_smf&Itemid=71&do=details&task_id=27&histring=edit%20order&pagenum=4&option=com_flyspray&Itemid=83).


This addon will enable you to edit orders in the adminpages

It will show up as a new tab right beside "Order Status Change" and "Order History".

It will allow you to Change Shpping rate, Shipping tax, Change Discount, Coupon Discount and the qunatity of the order items.

It will not allow you to add new items to the order, because of limitations in the virtuemart database.

Installtion:

1. Download the attached file
2. Gunzip it
3. Put it in your administrator/components/com_virtuemart/classes directory
4. Edit administrator/components/com_virtuemart/html/order.order_print.php
5. Replace the line

$tab->endPane();

with

require_once(CLASSPATH.'ps_order_edit.php');
$tab->endPane();   

6. Done..


Report bugs here.. Use with caution.. I have not fully tested it yet... So consider it a beta release..

[attachment cleanup by admin]
Title: Re: Order Edit Addon
Post by: webgobe on January 31, 2006, 19:14:37 pm
Seems to working ;) Thanks, I just needed it!
Title: Re: Order Edit Addon
Post by: deneb on February 02, 2006, 06:26:50 am
This is a nice addon.
Super easy to install! I like the logic of the class file. It also updates the tables for use in the print view.

Allow me to critique:
you did use 'jos_vm' in some of your SQL statements...what if my db prefix is different? (which mine is: mos_)
it should be '#__{vm}' to account for this?

1)Item Quantity: changing the item quantity works good for that line item only. it updates the quantity and the line item total. it does not update the cart subtotal, nor the grand total. even with zero entered.

2)Shipping and Handling Fee shipping fee add or change works good and updates the grand total, except for the following: a) if a non-numeric is entered it updates the order with zero amount for shipping. can you make it so the shipping stays the same as it was before the false entry? b) minor item: It does not update the db with the new shipping_rate_id. so the Shipping Information portion of the report is not correct. And how does this affect the shipping tax?

3)Shipping Taxshipping tax add or change works good and updates the grand total.

4)Coupon Discount does not seem to work...maybe due to SQL table prefix issue? does it add one if there was not an original coupon on the order?

5)Discount does not seem to work...maybe due to SQL table prefix issue? how is the discount applied again? cart grand total percentage or flat amt?

Okay, i'm so curious at this point ...i try replacing  'jos_vm' with '#__{vm}'

* now the Item Quantity update works but tax is not updated.
* Shipping Fee works but no shipping tax update, if applicable. i guess this would be entered manually.
* somehow i've managed to erase the tax (not shipping tax) from view, yet it is still in the grand total.
* oooooh nice coupon discount add on, ok it works now. this will be handy!
* the regular discount does not seem to work.

All in all, it needs more work but, This is promising!
Title: Re: Order Edit Addon
Post by: Mr_Smurf on February 02, 2006, 10:14:40 am
Allow me to critique:
you did use 'jos_vm' in some of your SQL statements...what if my db prefix is different? (which mine is: mos_)
it should be '#__{vm}' to account for this?

I have attached a new version where this is fixed.

1)Item Quantity: changing the item quantity works good for that line item only. it updates the quantity and the line item total. it does not update the cart subtotal, nor the grand total. even with zero entered.

This is a jos_vm bug.. If you edit the file and change to #__{vm} it should work.

2)Shipping and Handling Fee shipping fee add or change works good and updates the grand total, except for the following: a) if a non-numeric is entered it updates the order with zero amount for shipping. can you make it so the shipping stays the same as it was before the false entry? b) minor item: It does not update the db with the new shipping_rate_id. so the Shipping Information portion of the report is not correct. And how does this affect the shipping tax?

Good point, will fix so that the old value is used insted of 0 when I get som spare time.
Well the way it works is that you set your own shipping and tax in the order table.. shipping info is not change.
I should probably use a dropdown menu of shipping rates insted of two input text boxes.. I'll have a look at that too later on when I get some spare time (I would guess this weekend)

3)Shipping Taxshipping tax add or change works good and updates the grand total.

This should not be a text input box, it should use the value of the comming dropdownbox.

4)Coupon Discount does not seem to work...maybe due to SQL table prefix issue? does it add one if there was not an original coupon on the order?

This is a jos_vm bug.. If you edit the file and change to #__{vm} it should work.

5)Discount does not seem to work...maybe due to SQL table prefix issue? how is the discount applied again? cart grand total percentage or flat amt?

This is a jos_vm bug.. If you edit the file and change to #__{vm} it should work.

The largest problem with editing a order is that there is no information stored about the discounts of an order exept the value.. So I have no way of knowing if it was a 5% discount or a 10%.. or even a fixed value..
So I can never recalculate the discounts when the order is changed.. so the discouonts remain the same fixed value. (Unless you change it by hand)
Title: Re: Order Edit Addon
Post by: Mr_Smurf on February 02, 2006, 22:25:07 pm
I have now changed so if standard shipping is used then a dropdown box with all shipping rates will show up..
Title: Re: Order Edit Addon
Post by: deneb on February 03, 2006, 20:20:11 pm
Hey Mr_Smurf,

I have applied the latest version of this addon. Just to try and debug this sucker. I know it is difficult to account for all possible scenarios...I am having issues with the tax stuff; shipping tax and order tax.

shipping tax
============
On orders with standard_shipping where the shipping drop-down displays, came up as blank form (no selections available.)

order tax
==============
when adjusting the quantity of a product, the order tax is not recalculated and updated. Actually it removes tax from the orders table field: order_tax, but leaves the original tax in the grand total.


My configuration
-----------------------
My store is set to base tax off of the ship-to address, AND, I do NOT charge tax on shipping...only the cart items total after discounts are applied.

My one and only Tax Rate has a tax_rate_id='2', with tax_rate='.0725'. I believe this is how VM comes setup. I just changed the rate, country, and state.

All my products have a product_tax_id='2' set.

All of my shipping rates have a shipping_rate_vat_id='0' set. You have to change this manually in the db anyway, each shipping rate has no place to change the tax id in the VM form.

So, no shipping rates show up because it can't match the tax ids.

debugging attempts
------------------------------
I created an additional tax rate: id: 0, state: FOO, country: FOO, and rate:0

now the shipping rates come up in the form. when selecting one and submit, it properly adjusts shipping charges, but shipping tax is added: shipping rate * my tax rate (.0725). I do not want shipping tax.
Title: Re: Order Edit Addon
Post by: Mr_Smurf on February 04, 2006, 10:33:15 am
now the shipping rates come up in the form. when selecting one and submit, it properly adjusts shipping charges, but shipping tax is added: shipping rate * my tax rate (.0725). I do not want shipping tax.

You can always edit the query and remove all references to shpping tax and taxrates.
Title: Re: Order Edit Addon
Post by: UWiX on February 17, 2006, 23:47:32 pm
Followed all the install instructions and the tab appears correctly (had to adjust the pane name in order.order_print.php to prevent javascript error though).

But when I change the quantaty of a product it just doesn't change at all. Cannot seem to find the problem.

Any suggestions? Anyone?
Title: Re: Order Edit Addon
Post by: Mr_Smurf on February 19, 2006, 22:15:05 pm
Followed all the install instructions and the tab appears correctly (had to adjust the pane name in order.order_print.php to prevent javascript error though).

But when I change the quantaty of a product it just doesn't change at all. Cannot seem to find the problem.

Any suggestions? Anyone?


Does any of the other updates work like tax and discoount?
Title: Re: Order Edit Addon
Post by: UWiX on February 19, 2006, 23:49:16 pm
Now that you mention it... No nothing updates at all. What step did I miss in the installation?
Title: Re: Order Edit Addon
Post by: Mr_Smurf on February 20, 2006, 09:49:04 am
The installation is so simple that if the tab shows up, then the installation is ok..

What version of php anv virtuemart are you using?
Title: Re: Order Edit Addon
Post by: UWiX on February 20, 2006, 10:57:39 am
Testing under PHP 4.3.3 and VirtueMart 1.0.2.

I'll try later this day the pages with the debug function on. Just thought of that possibility...  ::)
I'll let ya know...

Tried the debug option:

Change a quantity from 250 to 260, when pushing the update-button I can see the following variables are given (according to the debug function):

Code: [Select]
$vars: product_quantity=>260
edit_pane=>1
page=>order.order_print
option=>com_virtuemart
func=>
order_item_id=>7
order_id=>5
update_quantity_x=>8
update_quantity_y=>11
8fc79ea3d3d9be91018e834de89c552b=>622daa9eecff57991395877bccad724b
virtuemart=>88bb89bfd554cddea6106f7313292f1d
a97e03ad184a3622b5de2f812c33d28c=>644a464c33741fc2741ad2bcdf44379d
keyword=>
user_info_id=>0

But..... Nothing is changed, really. The quantity still remains on 250! Maybey it's a user-right problem...  does the storeadmin has enough rights? Hmmm... I'll try it with a full administrator account...

Shoot, doesn't make any difference with the administrator account... Now I'm stuck....
Title: Re: Order Edit Addon
Post by: UWiX on February 20, 2006, 12:46:53 pm
Did a lot of debugging the last hour... It seems the function update_quantity isn't started. I've added several checklines in the function but they don't display at all!

Very weird, everything should be okay in the source. One thing I noticed; the <form> statement points to \administrator\index2.php. Is that correct? It confuses me a bit 'cause the source is working with order.order_print.php and ps_order_edit.php. Well, maybey I'm just staring blind on the <from> line...
Title: Re: Order Edit Addon
Post by: Mr_Smurf on February 20, 2006, 12:57:11 pm
What browser are you using?

it seems that your browser does not send the value of the Update button, it only sends the coordiates of where on the image you pressed..

Modifiy the the lines

                if( mosgetparam( $_REQUEST, 'update_quantity' ) != '' )
                        $this->update_quantity();
                elseif( mosgetparam( $_REQUEST, 'update_coupon_discount' ) != '' )
                        $this->update_coupon_discount();
                elseif( mosgetparam( $_REQUEST, 'update_discount' ) != '' )
                        $this->update_discount();
                elseif( mosgetparam( $_REQUEST, 'update_standard_shipping' ) != '' )
                        $this->update_standard_shipping();
                elseif( mosgetparam( $_REQUEST, 'update_shipping' ) != '' )
                        $this->update_shipping();
                elseif( mosgetparam( $_REQUEST, 'update_shipping_tax' ) != '' )
                        $this->update_shipping_tax();         

to


                if( mosgetparam( $_REQUEST, 'update_quantity_x' ) != '' )
                        $this->update_quantity();
                elseif( mosgetparam( $_REQUEST, 'update_coupon_discount_x' ) != '' )
                        $this->update_coupon_discount();
                elseif( mosgetparam( $_REQUEST, 'update_discount_x' ) != '' )
                        $this->update_discount();
                elseif( mosgetparam( $_REQUEST, 'update_standard_shipping_x' ) != '' )
                        $this->update_standard_shipping();
                elseif( mosgetparam( $_REQUEST, 'update_shipping_x' ) != '' )
                        $this->update_shipping();
                elseif( mosgetparam( $_REQUEST, 'update_shipping_tax_x' ) != '' )
                        $this->update_shipping_tax();         



Title: Re: Order Edit Addon
Post by: UWiX on February 20, 2006, 13:02:47 pm
Thanx Man, that fixed the problem...  Strange, I'm still trying to understand  :D
Title: Re: Order Edit Addon
Post by: Mr_Smurf on February 20, 2006, 13:19:58 pm
What browser are you using?
It does not seem to be W3C compatible..
Title: Re: Order Edit Addon
Post by: UWiX on February 20, 2006, 13:23:57 pm
Maxthon 1.5.2 (build 21). It's a internet explorer shell-like browser.

I'm thinking maybey I've set some wrong options in the PHP.INI file. I'm running VirtueMart on a local server to test the software to the max.
I'll check my PHP settings - could be a global enviroment thingie.

Thanx for your help so far....
Title: Re: Order Edit Addon
Post by: Mr_Smurf on February 20, 2006, 13:25:29 pm
Looks very mush like a browser thingy to me...
It might be possible that other browsers don't work any more with this fix.
Title: Re: Order Edit Addon
Post by: UWiX on February 20, 2006, 13:31:14 pm
I'll test that too, than... IExplorer seems to work fine with it....

So if it is a browser problem, it looks like the IE is having troubles with it, than. I'll test later this week with Firefox and Netscape or so.
Title: Re: Order Edit Addon
Post by: fidel on March 08, 2006, 10:31:12 am
Great work, again!!!!

In order to make it easier for me to perform future installs of such add ons, I have compiled a zip that contains the modified files and instructions. All that is needed is to FTP files per instructions.

Fidel

[attachment cleanup by admin]
Title: Re: Order Edit Addon
Post by: Andrew on March 15, 2006, 03:29:37 am
will this work for a mambo-php shop as well?
Title: Re: Order Edit Addon
Post by: fidel on March 15, 2006, 03:45:36 am
I was just about to ask the same question, since I have a relatively large site that makes use of Mambo PHPshop.
Title: Re: Order Edit Addon
Post by: mambo_no5 on May 06, 2006, 01:09:07 am
I've just tried this in VM1.04 and Mambo 4.5.3h but I can't see the tab to edit the order. I used the last attachment on the thread, and ftp'd over both the files. Any ideas on what may be wrong here, tried with both IE and FF.
Title: Re: Order Edit Addon
Post by: dusk187 on May 07, 2006, 04:10:47 am
i would really like to see the "add item" function.
is this possible, maybe? please, sugar on top? ;D

regards dusk187

Title: Re: Order Edit Addon
Post by: asgard on June 21, 2006, 23:56:12 pm
i would really like to see the "add item" function.
is this possible, maybe? please, sugar on top? ;D

regards dusk187



ohhh yes me too
Title: Re: Order Edit Addon
Post by: rxalex on June 26, 2006, 06:46:46 am
I installed this order edit, I see the tab for it but when I make a change and press the update key it doesnt change anything and reverts back to original quantity or price :( anyone know how to fix this?
Title: Re: Order Edit Addon
Post by: rsilvestre on June 30, 2006, 02:43:03 am
I have this mistake :
Notice: Undefined property: reload_from_db in c:\srv\www\latinthunder\administrator\components\com_virtuemart\classes\ps_order_edit.php on line 447
Title: Re: Order Edit Addon
Post by: nfischer on July 06, 2006, 17:41:52 pm
Very good job !!

I'm a french developper and I would like to ask Mr_Smurf if he need help in développing this addon and make it better.

Nico
Title: Re: Order Edit Addon
Post by: noone on July 07, 2006, 04:36:12 am
Very good job !!

I'm a french developper and I would like to ask Mr_Smurf if he need help in développing this addon and make it better.

Nico

I liked this addon too. However, much needs to be done for the calculations. I have spotted several problems that haven't been able to correct completely. However, if we had some more documentation about the different ways virtuemart calculates taxes, tax_order_details, etc, we could have this addon really work.

Be aware that many calculations involving taxes, discount, shipping, etc are plain wrong. I managed to make it work for me beacuse I only needed shipping based tax, virtual, and didnt care about discount, coupons or any other thing.

noone
Title: Re: Order Edit Addon
Post by: nfischer on July 12, 2006, 18:07:05 pm
What kind of problems did you notice exactly ?
Title: Re: Order Edit Addon
Post by: nfischer on July 21, 2006, 09:55:38 am
I worked on this script and now you can add a new item to an existing order.
All the people can test this script and say me remarks or bugs.

The script is attached to this post. To install it you have to :
1. Download the attached file
2. Unzip it
3. Put it in your administrator/components/com_virtuemart/classes directory
4. Edit administrator/components/com_virtuemart/html/order.order_print.php
5. Replace the line

$tab->endPane();

with

$tab->startTab( $VM_LANG->_PHPSHOP_ORDER_EDIT, "order_edit_page" );
require_once(CLASSPATH.'ps_order_edit.php');
$tab->endTab();

Here are the elements to add in the language file (administrator/components/com_virtuemart/languages/). It's the french version :
   var $_PHPSHOP_ORDER_EDIT_ACTIONS = 'Actions';
   var $_PHPSHOP_ORDER_EDIT = 'Modifier Commande';
   var $_PHPSHOP_ORDER_EDIT_ADD = 'Ajouter';
   var $_PHPSHOP_ORDER_EDIT_ADD_PRODUCT = 'Ajouter un Produit';
   var $_PHPSHOP_ORDER_EDIT_EDIT_ORDER = 'Modifier la commande';
   var $_PHPSHOP_ORDER_EDIT_ERROR_QUANTITY_MUST_BE_HIGHER_THAN_0 = 'La quantité doit être supérieure à 0';
   var $_PHPSHOP_ORDER_EDIT_PRODUCT_ADDED = 'Produit ajouté à la commande';
   var $_PHPSHOP_ORDER_EDIT_PRODUCT_DELETED = 'Produit supprimé de la commande';
   var $_PHPSHOP_ORDER_EDIT_QUANTITY_UPDATED = 'Quantité mise à jour';
   var $_PHPSHOP_ORDER_EDIT_RETURN_PARENTS = 'Retour aux produits parents';

[attachment cleanup by admin]
Title: Re: Order Edit Addon
Post by: djreason on July 29, 2006, 10:12:34 am
seems like parts of this modification are showing up in french.  anyway to convert it to english for us dumb Americans?  LOL


seriously...English only request for this add-on
Title: Re: Order Edit Addon
Post by: djreason on July 29, 2006, 10:29:22 am
i also noticed that this does not update tax on the order.  I charge tax for those customers in my state and when I add items to their order, the tax does not update, nor is there a field to do so.  May want to work on this too.  It doesnt matter on orders where tax is not included, but local sales, it will wind up costing me money

Thanks in advance
Title: Re: Order Edit Addon
Post by: nfischer on July 29, 2006, 11:19:28 am
This addon will be integrated in Virtuemart. The translation in english will be available (and German)
You have to wait a little bit ...

For the tax problem, I don't understand exactly. It occurs when you add an item or when you modify the shipping tax ?
Title: Re: Order Edit Addon
Post by: djreason on July 29, 2006, 11:29:12 am
I dont use a shipping tax.  In the United States, each state has their own unique sales tax.  I am in Arizona so all order from people who are in Arizona add a 7.8% sales tax to the order total.  For example, if an item costs $139, then it would reflect a total cost around $147 or so.  When I add new items using this new modification, it does not recalculate the tax on those additional items...it keeps the same tax as if I only had one item in there.  Ultimately, there should be a code for a tax multiplier, i.e.  1 x 7.8%, 2 x 7.8%, etc....  Or it can be one multiplier for the total order cost.  so if the total cost line reads $150 it would take total order cost x 7.8% for a newly calculated grand total.  I hope this makes sense.

Thanks,

Brad


p.s...I already did the english translation on my own.  not that hard to search for words in the php file and change them to english
Title: Re: Order Edit Addon
Post by: nfischer on July 31, 2006, 13:34:27 pm
That's strange because I've tested this functionnality and on my VM there is no problem the tax total is ok after I've added a new item.
Could you post snapshots before and after you add a new product ?
Title: Re: Order Edit Addon
Post by: djreason on July 31, 2006, 19:32:55 pm
okay...here is a before and after.  if you notice, the first part of the order is for a tippman 98 at 147 which includes tax.  when I add on more of the same item, it defaults back to the outside of Arizona cost of 139. 

what do you think may be the problem?



[attachment deleted by admin]
Title: Re: Order Edit Addon
Post by: nfischer on July 31, 2006, 20:29:30 pm
ok, I will test this on my VM installation tomorrow.
Title: Re: Order Edit Addon
Post by: djreason on August 03, 2006, 19:55:03 pm
any luck on this yet?

Thanks for working on it

Brad
Title: Re: Order Edit Addon
Post by: HulaQueen on August 04, 2006, 12:25:19 pm
This project is being tracked in the development section of the site and has an estimated delivery timeline of the end of August.

When you're ready for beta testers let me know - I would love to help.

Here's the link to the project for those of you that want to volunteer! This thread here looks happening too. I'm so excited for this functionality to come in.
http://virtuemart.net/index.php?option=com_flyspray&do=details&id=27&histring=order%20edit&pagenum=3&Itemid=83

Cheers,
Hula

Title: Re: Order Edit Addon
Post by: Virtue Monkey on August 05, 2006, 14:46:26 pm
Yes Siree,

This is one juicy, well needed mod, congrats to all working on it and let me know when it's ready to be tested by the most ruthless, unforgiving type of beta tester there is... a clueless newbie! (yes, scream my little ones! ;) )
Title: Re: Order Edit Addon
Post by: hanhand on August 07, 2006, 11:49:52 am
Hello
This add-on is marvellous and it is essential for store owners thanks to all of you that worked on it, but i believe that this hack should have the capability to add to the cart of the customer and not only to orders that are placed by customers.

also it will be a good feature to allow admins to start a new order not only modify orders.

Thanks for the work
Title: Re: Order Edit Addon
Post by: onsitenet on August 15, 2006, 00:06:49 am
Another good hack!

correction: (VM_1.0.6)

replace this code arround line 132 to 133

Code: [Select]
$tab->endTab();
$tab->endPane();

with this one:

Code: [Select]
$tab->endTab();
// MODIFICATION --- Manage orders (edit) from Back-End
$tab->startTab( $VM_LANG->_PHPSHOP_ORDER_EDIT, "order_edit_page" );
require_once(CLASSPATH.'ps_order_edit.php');
$tab->endTab();
// END OF MOD
$tab->endPane();

Additional language update must be made for "choose a product" (to add to the order)
which is in French... but I don't know where to find it!

Still is a "best of" hack,
George.
Title: Re: Order Edit Addon
Post by: nfischer on August 16, 2006, 11:26:41 am
Hi djreason,

I understand your problem and I have tested the same process on my Virtuemart 1.0.6.
There is no problem for me, when I add a new item to an existing order, the Total Tax is updated. I don't know why this problem occurs because it seems that I have the same configuration as you. I'm french and in France there is a 19,6% tax on each product.

Could you tell me what is your Tax configuration ? (Virtual Tax, Tax mode, ...)
Title: Re: Order Edit Addon
Post by: Troubleshooter on August 23, 2006, 20:14:22 pm
for the translation of the Dropdown Menu check ps_order_edit.php at line 810 and it means choose an articel or somthing like that...  8)
Title: Re: Order Edit Addon
Post by: HulaQueen on October 13, 2006, 09:25:41 am
For those of you that would like the functionality to edit orders look no further. This is AMAZING. I have been using it on my live site for weeks now and it's simply a must!!!

Here's the link: http://virtuemart.net/index.php?do=details&task_id=27&histring=edit%20order&pagenum=4&option=com_flyspray&Itemid=83 (http://virtuemart.net/index.php?do=details&task_id=27&histring=edit%20order&pagenum=4&option=com_flyspray&Itemid=83)
Title: Re: Order Edit Addon
Post by: Azzam on January 10, 2007, 12:02:06 pm
this one modification alone has just saved me losing out on a £100 order.
Thanks VM team
Title: Re: Order Edit Addon
Post by: crackdaddy on January 12, 2007, 18:15:42 pm
For those of you that would like the functionality to edit orders look no further. This is AMAZING. I have been using it on my live site for weeks now and it's simply a must!!!


um ok, yes this helps as a starting point, but there are many things to update and integrate to not look further...
ie like th eperson asked for add new item, that mod sux if you have product options...you cant choose them....again its a start....
the shipping needs to be a form field- select a method- ie ups ground or whatever,
 then a form field(not drop down) to enter new shipping amount
needs a tax amount field etc etc etc.. dont have time to bash it. gotta code.. still tons o work to do
Title: Re: Order Edit Addon
Post by: Stonedfury on May 08, 2013, 22:58:39 pm
Links broken