News:

Support the VirtueMart project and become a member

Main Menu

Customer Order cancellation in VM3

Started by rickkh, January 14, 2015, 03:13:08 AM

Previous topic - Next topic

rickkh

Hi,

I am using VM 3.0.2 with JM 3.3.
I know that order cancellation is, unfortunately, not available in VM3 and I am trying to add it.
To do this, I added a link to the "order list" on the front end for registered users. I have also changed it so that if the order is still in "Confirmed By Customer", it adds a button called cancel.

I added an ajax call when "cancel" is clicked to call a file.php with the following:

if(!empty($_REQUEST['id'])) {
                $id= $_REQUEST['id'];
                if ($id) {

                        if (!class_exists('VirtueMartModelOrders'))
                                require( JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php' );
                        $modelOrder = new VirtueMartModelOrders();
                        $order['order_status'] = 'X';
                        $order['virtuemart_order_id'] = $id;
                        $order['customer_notified'] = 1;
                        $modelOrder->updateStatusForOneOrder($id, $order, true);
                }
        }


My ajax call is:


<script>
                jQuery(document).ready(function($) {
                        $(".can").click(function(event) {
                                var id=event.target.id;
                                $.ajax({
                                        type: 'get',
                                        url: '/orders/f.php',
                                        data: {id: id},
                                        success: function(data) {
                                                alert ('tritri');
                                        },
error: function (jqXHR, status, err) {
    alert(err);
  }
                                });
                        });
                });
</script>



Problem is that the result is always alerting the word 'tritri' and order is not getting cancelled... I have placed f.php in views/orders/tmpl...

What am I doing wrong? Is there a simpler way to achieve this?

malik0206

I'm also trying to do this.

Why is this function not available as default also when you login as customer to view the orders this whole section is a complete mess

come on guys surely you can do better

Milbo

Malik, VirtueMart is a project.

"come on guys surely you can do better"

If you use VirtueMart you are one of these "guys". It is really so funny, how people came in here and tell us what we should do. Not noticing that they address themself. Do it yourself! Actually I can cancel orders. If you want that a customer can cancel orders, then you may should first learn to label the things so that others understand you.

So you are missing the "Order cancellation by shoppers". If you want this feature. The normal way is you write it and publish the code here as patch. This is the normal way of an opensource project. If you are not able to write something, then do your part to support the project http://extensions.virtuemart.net/support/virtuemart-supporter-membership-detail.

If you are neither able to develop software, nor you have 50 bugs, then earn your respect of the community due helping people in the forum, so long I can only see you asking.

Just a hint, for this feature you just need a simple button. Order cancellation is natively in the BE and also often done by payment plugins. If only 2 people ask for this feature in 3 years, ...
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/