News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Checkbox "Update status for all lines?" (BE) doesn`t work

Started by AmStaF, December 22, 2011, 10:13:17 AM

Previous topic - Next topic

AmStaF

FF/IE (no matter)
JS is active
J1.7.3
VM1.98, M, pre- or VM2.0 stable (no matter, everywhere is the same)

BE, Orders (list)
http://... /administrator/index.php?option=com_virtuemart&view=orders

It seems that checkbox "Update status for all lines?" (BE) doesn`t work. Is it checked or not, when you change the order status, it changes (overwrites) status of ALL items in this order.

AmStaF


Milbo

It is the day of saint nights :-) (hehe day of nights) not a lot people around
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

AmStaF

Ok, as for me, I switch off the function calling in model (orders.php):

public function updateOrderStatus (...) {
   ...
   foreach ($order_items as $order_item) {
      // $this->updateSingleItem (
            $order_item->virtuemart_order_item_id,
            $order['order_status'],
            $order['comments'],
            $virtuemart_order_id);
   }
   ...
}

so it is possible now to manage order status and items status separately. It suits me, but it is palliative.

AmStaF

Ok, nobody cares. So catch one more :)

If there are customfields:

- order`s print-view is corrupted (see attach.),
- order`s details are also corrupted (see attch.)

[attachment cleanup by admin]

gboul

I am using the VM 2.0.6 and the problem still exists.
Calling the updateOrderStatus or the updateStatusForOneOrder overwrites the status of the order items.
I have developed an new payment plugin for a local payment service that requires to send one by one the items of the order.
Each for each order item the payment can be either succesfull or cancelled. I use the updateSingleItem to update the status of the order items.
At the end I  call either the updateOrderStatus or the updateStatusForOneOrder, but both overwritten the status of the items.
The following is my latest attempt to emulate the form in the orders details that exist in the administrator.

      $virtuemart_order_id = $payments[0]->virtuemart_order_id;
      $_dataorder = array();
      $_dataorder['order_status'] = $order_status;
      $_dataorder['comments'] = "Update by Payment Service";      
      $_dataorder['customer_notified'] = 1;
      $_dataorder['include_comment'] = 1;
      $_dataorder['update_lines'] = 0;
      $_dataorder['current_order_status'] = 'P';      
      $_dataorder['virtuemart_order_id'] = $virtuemart_order_id;
      
      $dataorder = array();
      $dataorder[$virtuemart_order_id] = $_dataorder;
      $ordermodel->updateOrderStatus($dataorder);   

gboul

My solution to this issue is to change the function updateStatusForOneOrder in the models/orders.php.

I change the part of the code from this:
if ($data->store()) {
$q = 'SELECT virtuemart_order_item_id
FROM #__virtuemart_order_items
WHERE virtuemart_order_id="'.$virtuemart_order_id.'"';
$db = JFactory::getDBO();
$db->setQuery($q);
$order_items = $db->loadObjectList();
if ($order_items) {
// vmdebug('updateStatusForOneOrder',$data);
foreach ($order_items as $order_item) {

//$this->updateSingleItem($order_item->virtuemart_order_item_id, $data->order_status, $order['comments'] , $virtuemart_order_id, $data->order_pass);
$this->updateSingleItem($order_item->virtuemart_order_item_id, $data);
}
}


to this: (I added a check for update_lines and hope this does not break some other functionality)
if ($data->store()) {
$q = 'SELECT virtuemart_order_item_id
FROM #__virtuemart_order_items
WHERE virtuemart_order_id="'.$virtuemart_order_id.'"';
$db = JFactory::getDBO();
$db->setQuery($q);
$order_items = $db->loadObjectList();
if ($order_items  && ($data->update_lines==1)) {
// vmdebug('updateStatusForOneOrder',$data);
foreach ($order_items as $order_item) {

//$this->updateSingleItem($order_item->virtuemart_order_item_id, $data->order_status, $order['comments'] , $virtuemart_order_id, $data->order_pass);
$this->updateSingleItem($order_item->virtuemart_order_item_id, $data);
}
}

gboul

With further investigation, I found out that my previous solution does break the normal payment scenario (update_lines is not set, thus the default is 0).
I had to change the logic to negative, so now the update_lines is not_update_lines. Only when the not_update_lines is defined and it is set to true the order items status are not changed.

This requires to change the code in 3 places.
models/orders.php

$update_lines=true;
if (isset($data->not_update_lines)){
if ($data->not_update_lines==1) {
$update_lines=false;
}
}

if ($order_items && $update_lines) {
// vmdebug('updateStatusForOneOrder',$data);
foreach ($order_items as $order_item) {

//$this->updateSingleItem($order_item->virtuemart_order_item_id, $data->order_status, $order['comments'] , $virtuemart_order_id, $data->order_pass);
$this->updateSingleItem($order_item->virtuemart_order_item_id, $data);
}
}


administrator/components/com_virtuemart/orders/tmpl/orders.php (changed from update_lines to not_update_lines)

<?php echo VmHTML::checkbox('orders['.$order->virtuemart_order_id.'][not_update_lines]') . JText::_('COM_VIRTUEMART_ORDER_NOT_UPDATE_LINESTATUS'); ?>


administrator/components/com_virtuemart/orders/tmpl/order_editstatus.php (changed from update_lines to not_update_lines)
<td class="key"><?php echo JText::_('COM_VIRTUEMART_ORDER_NOT_UPDATE_LINESTATUS'?></td>
<td><br />
<?php echo VmHTML::checkbox('not_update_lines'false); ?>
</td>


I also added a new constant: COM_VIRTUEMART_ORDER_NOT_UPDATE_LINESTATUS
and i added in the laguage ini files

If any of the admins can confirm that this is solution to this bug, it would be nice.

frogybella

Hi,

Maybe I missed someting but the bug remaims in VM2.0.18a... Has it been reproduced by dev team?

I also noticed that the "include this comment" checkbox was not operative. The comment is always included in the user mail whaterver its state is.

Thanks in advance for dev team feedback,
Best

Fred
Frogybella

My website : www.fdbi.com

frogybella

Hi,

I am surprised that nobody seems to care about this... Maybe there is a workaround? Or I should start a new thread?

Thanks in adavance,
Frogybella

My website : www.fdbi.com

frogybella

Hi

Still not fixed in 2.0.20a...

I am getting scared... It seems to me that it's difficult to manage orders with several lines with this bug.

Any advices?

Thanks in advance,
Regards
Fred
Frogybella

My website : www.fdbi.com

Milbo

Quote from: frogybella on February 20, 2013, 14:38:39 PM
Hi,

I am surprised that nobody seems to care about this... Maybe there is a workaround? Or I should start a new thread?

Thanks in adavance,


Nobody seems to care, because it is fixed for everybody. Maybe your update went wrong somehow and you use an old version?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

frogybella

Hi Milbo,

Thank you for answering.

Discovering the bug was solved for everybody but me, we have made a clean install of Joomla 2.5.9 and VM2.0.20b from scratch.

We still have the bug in the orderpage and in the order list page.

What should I check?

Thanks in advance,

Fred
Frogybella

My website : www.fdbi.com

joophilverink

Hi Fred,
For me the same. I have placed this on this forum a long time ago. And the same happened, no reaction. So I'm clad to find someone who care's.

Virtuemart version 2.0.20a.

Joop.

frogybella

Hi Joop,

As Milbo was writting that this bug is solved for everybody you might be another exception... ;)

Best,

Fred
Frogybella

My website : www.fdbi.com