News:

Looking for documentation? Take a look on our wiki

Main Menu

Can Not Edit Order [by Milbo: cannot add new order item]

Started by hotrod, July 24, 2023, 16:04:10 PM

Previous topic - Next topic

hotrod

 After Upgrade from 3.8  and now on 4.022  I can not edit orders.  This is very important to us since my book keeper looks at them in reports for refunds and such..

On 3.8 I could add a new line..   0 quantity   call it refunded  and enter -240.00 in Product Price (Cost)   and Product Price (Gross) it would show but not change the invoice.. I can't even duplicate....   I know this is tricky.. I have tried about 50 times.. with all different option  I'm getting this error..


vmError: vmTable store insertObject #__virtuemart_order_items Data truncated for column 'virtuemart_order_item_id' at row 1 INSERT INTO `wwdai_virtuemart_order_items` (`virtuemart_order_item_id`,`virtuemart_order_id`,`virtuemart_product_id`,`order_item_sku`,`order_item_name`,`product_quantity`,`product_item_price`,`product_basePriceWithTax`,`product_discountedPriceWithoutTax`,`product_priceWithoutTax`,`product_tax`,`product_final_price`,`product_subtotal_discount`,`product_subtotal_with_tax`,`order_status`,`paid`,`oi_hash`,`created_on`,`created_by`) VALUES ('0-96-0','10873','2359','AH500/NOR','refund','0','240','240','240','240','0','240','0','0','P','0','d5a355ca1dfa2b6019914d1faa6eab8b','2023-07-24 13:53:16','945')
vmError: vmTable store insertObject #__virtuemart_order_item_histories Data truncated for column 'virtuemart_order_item_id' at row 1 INSERT INTO `wwdai_virtuemart_order_item_histories` (`virtuemart_order_item_history_id`,`virtuemart_order_item_id`,`virtuemart_order_id`,`virtuemart_product_id`,`order_item_sku`,`order_item_name`,`product_quantity`,`product_item_price`,`product_basePriceWithTax`,`product_discountedPriceWithoutTax`,`product_priceWithoutTax`,`product_tax`,`product_final_price`,`product_subtotal_discount`,`product_subtotal_with_tax`,`order_status`,`paid`,`oi_hash`,`created_on`,`created_by`,`modified_by`,`action`) VALUES ('0','0-96-0','10873','2359','AH500/NOR','refund','0','240','240','240','240','0','240','0','0','P','0','f14e973f1a1b24fc872b14eaeb85785f','2023-07-24 13:53:16','945','0','new')

attached is an image on how i use to do it...
Bronze Member
VirtueMart 4.2.4 10922
Joomla!  ‎4.3.4
PHP 8.0

pinochico

Quote from: hotrod on July 24, 2023, 16:04:10 PM
This is very important to us since my book keeper looks at them in reports for refunds and such..

So if it's so important, why do you put dashes in the field - virtuemart_order_item_id, which (if I'm not mistaken) should be only integer?
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

hotrod

#2
I don't do anything with order ID. ? not sure what your referring to..

When she pulls the reports from VM reporter..  say for status refunded.. the   -  shows her how much was refunded from the total..  Leaving the quantity at 0 stops is from adjusting the invoice...

Well sell parts with a core charge..  when the old part is returned I add a line..   Core Refund and how much was refunded..

been doing it that way for 13 years... 

The below Image the part comes in at  $2400  with a core charge added to it..
Then I ad a line and break it down..  the product price   and a new line for the core charge
when we refund I add a refund line with 0  Quanity and the - so billing can see it. and we mark it as refunded
Bronze Member
VirtueMart 4.2.4 10922
Joomla!  ‎4.3.4
PHP 8.0

pinochico

You don't understand me - Im speaking about virtuemart_order_item_id, not about virtuemart_order_id :)

Look at the DB table structure and look at the vmerror - you can see all why order is not saved, you have to only little bit thinking.
virtuemart_order_item_id is only field with automatic increment one.

You can use value '0-96-0' with automatic increment one?

I think no.

sorry, but we are solving the impossibility of saving an order to DB after editing in the administration - you can always ask a new question here on the forum or order a speshitpillt for money, don't combine multiple questions into one, you make it difficult for others to find a similar problem and its solution.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

hotrod

  I'm sorry.. I am Confused with your reply...   I am not a developer and I don't under stand how I fix this or what I am doing wrong..

it was one question..

Why can I update an order in VM 3.8   but not in VM 4 ?   as far as I see I'm doing everything the same..   If I need to be doing something different.. Please share..

Bronze Member
VirtueMart 4.2.4 10922
Joomla!  ‎4.3.4
PHP 8.0

GJC Web Design

As @pinochico points out the assigned id given to the new row when you create it is wrong .. it should be an integer but it is always in the form  0-xx-0

item_id[0-96-0][product_quantity]: 1  etc

it appears to be a random number created by the JS at the end of the administrator\components\com_virtuemart\views\orders\tmpl\order.php

Maybe someone who has worked in this area knows more?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

hotrod

#6
THANK YOU!!   So it's not anything I'm doing wrong..  Yea  this is my brickwall stopping me from going live with the new site..  I would have thought becoming a supporter and purchasing the latest Program would have it's benefits... :)   But i feeling pretty lost here..   No issues with my current 3.8 Version..

Am I the only one that can't edit orders?

  Attached are images of an order I just edited on my live site running 3.8 that came in with a core charge I had to break up..

1)  with no edits

2) add new product with cost of core. and reduce cost of product on line one

3) after I hit save...
Bronze Member
VirtueMart 4.2.4 10922
Joomla!  ‎4.3.4
PHP 8.0

GJC Web Design

I have never had cause to use Order editing so have never worked in this code

it appears the JS in administrator\components\com_virtuemart\assets\js\dynotable.js when u click new item clones the row, removes the values and replaces any ids - it's getting this bit wrong?

Re membership - I do know Max is on holiday at the moment
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

hotrod

#8
Yea.. I get basically the same error when cloning and saving..    I have time..   Define "vacation"  not like a hiatus  :)

max has always helped me in the past.. I'm sure this will work out somehow...


vmError: vmTable store insertObject #__virtuemart_order_items Data truncated for column 'virtuemart_order_item_id' at row 1 INSERT INTO `wwdai_virtuemart_order_items` (`virtuemart_order_item_id`,`virtuemart_order_id`,`virtuemart_product_id`,`order_item_sku`,`order_item_name`,`product_quantity`,`product_item_price`,`product_basePriceWithTax`,`product_discountedPriceWithoutTax`,`product_priceWithoutTax`,`product_tax`,`product_final_price`,`product_subtotal_discount`,`product_subtotal_with_tax`,`order_status`,`paid`,`oi_hash`,`created_on`,`created_by`) VALUES ('0-22-14432','10868','4762','830724-5001S/DAW','17201E0654 Turbo','1','2875','2875','2875','2875','0','2875','0','2875','X','0','7418700b059056ecaf3d27f135e9cb4b','2023-07-25 18:25:39','945')
vmError: vmTable store insertObject #__virtuemart_order_item_histories Data truncated for column 'virtuemart_order_item_id' at row 1 INSERT INTO `wwdai_virtuemart_order_item_histories`
(`virtuemart_order_item_history_id`,`virtuemart_order_item_id`,`virtuemart_order_id`,`virtuemart_product_id`,`order_item_sku`,`order_item_name`,`product_quantity`,`product_item_price`,`product_basePriceWithTax`,`product_discountedPriceWithoutTax`,`product_priceWithoutTax`,`product_tax`,`product_final_price`,`product_subtotal_discount`,`product_subtotal_with_tax`,`order_status`,`paid`,`oi_hash`,`created_on`,`created_by`,`modified_by`,`action`) VALUES ('0','0-22-14432','10868','4762','830724-5001S/DAW','17201E0654 Turbo','1','2875','2875','2875','2875','0','2875','0','2875','X','0','481850355b30f285e8a9c3c404d6f232','2023-07-25 18:25:39','945','0','new')
Bronze Member
VirtueMart 4.2.4 10922
Joomla!  ‎4.3.4
PHP 8.0

Milbo

Quote from: hotrod on July 25, 2023, 20:27:31 PM
Yea.. I get basically the same error when cloning and saving..    I have time..   Define "vacation"  not like a hiatus  :)
hahaha, no it was not holidays, not even vacation. My children have vacation. But I always try the impossible, being back and on hiatus ;-P .

Quote from: hotrod on July 25, 2023, 20:27:31 PM
max has always helped me in the past.. I'm sure this will work out somehow...

Hahah, you know how to catch me. Here it is, the solution is quite simpel, and dont ask me why it was changed. I cannot check that currently, because the svn is down.

depending on the used template go to

administrator/components/com_virtuemart/views/orders/tmpl/order.php line 867
or
administrator/templates/vmadmin/html/com_virtuemart/orders/order.php line 114

and remove

var randomNumber = Math.floor(Math.random() * 100);
            $(newTr).find("*").addBack().filter("[name]").each(function () {
            var name=this.name;
            var needle = "item_id["
var newname = name.replace(needle, needle+randomNumber);
                    //this.name = newname;
                    this.id += randomNumber;
});

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hotrod

I found it in administrator/templates/vmadmin/html/com_virtuemart/orders/order.php line 114      But my code didn't have the 0 var randomNumber = 0;//Math.floor(Math.random() * 100);     with out the 0.  I know i was using the latest Admin Temple..  but when I reloaded the files from my package folder..  I now see the = 0;   No rush here for me....  prob something that should just be checked in the latest version..

I was able to hit clodne product and save.  but nothing was there.  but no error..

When adding a new line  and inputting the data to break the one order into 2.. I got this error.

vmError: vmTable store insertObject #__virtuemart_order_items Incorrect decimal value: '' for column 'product_subtotal_with_tax' at row 1 INSERT INTO `wwdai_virtuemart_order_items` (`virtuemart_order_item_id`,`virtuemart_order_id`,`order_item_sku`,`order_item_name`,`product_quantity`,`product_item_price`,`product_basePriceWithTax`,`product_discountedPriceWithoutTax`,`product_priceWithoutTax`,`product_tax`,`product_final_price`,`product_subtotal_discount`,`product_subtotal_with_tax`,`order_status`,`paid`,`oi_hash`,`created_on`,`created_by`) VALUES ('0','10874','','Core Charge','1','55.00','55.00','0','0','0.00','55.00','0.00','','P','0','30cee3071b663d56d1b58eeb123d37a9','2023-08-11 21:34:49','945')
vmError: vmTable store insertObject #__virtuemart_order_item_histories Incorrect decimal value: '' for column 'product_subtotal_with_tax' at row 1 INSERT INTO `wwdai_virtuemart_order_item_histories` (`virtuemart_order_item_history_id`,`virtuemart_order_item_id`,`virtuemart_order_id`,`order_item_sku`,`order_item_name`,`product_quantity`,`product_item_price`,`product_basePriceWithTax`,`product_discountedPriceWithoutTax`,`product_priceWithoutTax`,`product_tax`,`product_final_price`,`product_subtotal_discount`,`product_subtotal_with_tax`,`order_status`,`paid`,`oi_hash`,`created_on`,`created_by`,`modified_by`,`action`) VALUES ('0','0','10874','','Core Charge','1','55.00','55.00','0','0','0.00','55.00','0.00','','P','0','75ffaca5be90c566d9e0e8508a4795bd','2023-08-11 21:34:49','945','0','new')


I installed the 4.2  and the code looks like this..   No chage in erros.

var randomNumber = Math.floor(Math.random() * 100);
               $(newTr).find("*").addBack().filter("[name]").each(function () {
                  var name=this.name;
                  var needle = "item_id["
               var newname = name.replace(needle, needle+"0-"+randomNumber+"-");
                    this.name = newname;
                    this.id += randomNumber;
            });
Bronze Member
VirtueMart 4.2.4 10922
Joomla!  ‎4.3.4
PHP 8.0

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hotrod

Bronze Member
VirtueMart 4.2.4 10922
Joomla!  ‎4.3.4
PHP 8.0

hotrod

I think you fixed it!!!...    All good with 4.2.2 10908   I can add a line and edit Lines..  just can't clone..  No error it just doesn't show.. but I don't use that...

Thank You Man!!!   I'll pick away at the new site.. looks I'll be good to go..
Bronze Member
VirtueMart 4.2.4 10922
Joomla!  ‎4.3.4
PHP 8.0