Page 1 of 2
Returns Have To Add Manually Back To Stock
Posted: Wed Jul 20, 2011 11:27 pm
by mandyj123
Hi guys
Is this a bug i done a test run bought the product checked out and then done a return. The return seems ok but my dashboard still says 1 sale and my stock was 12 before buy went to 11 when bought and even though i have done the return it still says 11. Do i have to manually edit the product and put it back to 12 ? Plus do i have to edit my database etc.
Please help because its the only thing i need to do before making my site live.
Re: Returns Have To Add Manually Back To Stock
Posted: Thu Jul 21, 2011 3:16 am
by uksitebuilder
I think this is the correct way to d it because the return could have been faulty and you wouldn't want to re-sell a faulty product.
So, you have to manually check the item when it is returned and if it is ok, manually add it back to stock.
Seems the correct way to do it to me.
--
Might be nice if there was a button against each item on the return to be able to add it back to stock from there though
Re: Returns Have To Add Manually Back To Stock
Posted: Thu Jul 21, 2011 3:35 am
by mandyj123
yes a button would be a nice feature, the only other thing i dont get is why does the dashboard show there was still a sale though ? If i have done a refund then surely it should show as no sale on dashboard.
Re: Returns Have To Add Manually Back To Stock
Posted: Thu Jul 21, 2011 4:05 am
by uksitebuilder
I thought that too, but the system has no way of knowing what order statuses do what, they are not fixed and can be edited/deleted.
However, as long as you know that you arent going to edit a certain order status then
edit admin/controller/common/home.php
find:
Code: Select all
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0' AND (DATE(date_added) = DATE(NOW()) AND HOUR(date_added) = '" . (int)$i . "') GROUP BY HOUR(date_added) ORDER BY date_added ASC");
replace with:
Code: Select all
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0' AND order_status_id < '6' AND (DATE(date_added) = DATE(NOW()) AND HOUR(date_added) = '" . (int)$i . "') OR order_status_id = '15' AND (DATE(date_added) = DATE(NOW()) AND HOUR(date_added) = '" . (int)$i . "') GROUP BY HOUR(date_added) ORDER BY date_added ASC");
find:
Code: Select all
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0' AND DATE(date_added) = '" . $this->db->escape($date) . "' GROUP BY DATE(date_added)");
replace with:
Code: Select all
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0' AND order_status_id < '6' AND DATE(date_added) = '" . $this->db->escape($date) . "' OR order_status_id = '15' AND DATE(date_added) = '" . $this->db->escape($date) . "' GROUP BY DATE(date_added)");
find:
Code: Select all
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0' AND (DATE(date_added) = '" . $this->db->escape($date) . "') GROUP BY DAY(date_added)");
replace with:
Code: Select all
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0' AND order_status_id < '6' AND (DATE(date_added) = '" . $this->db->escape($date) . "') OR order_status_id = '15' AND (DATE(date_added) = '" . $this->db->escape($date) . "') GROUP BY DAY(date_added)");
find:
Code: Select all
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0' AND YEAR(date_added) = '" . date('Y') . "' AND MONTH(date_added) = '" . $i . "' GROUP BY MONTH(date_added)");
replace with:
Code: Select all
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0' AND order_status_id < '6' AND YEAR(date_added) = '" . date('Y') . "' AND MONTH(date_added) = '" . $i . "' OR order_status_id = '15' AND YEAR(date_added) = '" . date('Y') . "' AND MONTH(date_added) = '" . $i . "' GROUP BY MONTH(date_added)");
This will mean only orders with the status of the following are counted:
Pending
Processing
Processed
Shipped
Complete
Alas nothing can be done about the customer count, well not unless a whole bunch of new functions are needed to check that they have ordered and that their orders are of a required status. (Over Kill)
vQmod file here if it helps:
Re: Returns Have To Add Manually Back To Stock
Posted: Thu Jul 21, 2011 6:06 pm
by mandyj123
Thankyou so much that is a great help. Still think a button should be added for the returns to go back to stock if its just an unwanted item etc that would make it complete.
Re: Returns Have To Add Manually Back To Stock
Posted: Sat Jul 23, 2011 12:01 pm
by Daniel
yes i can add a button. no need to keep repeating yourself.
Re: Returns Have To Add Manually Back To Stock
Posted: Sun Jul 24, 2011 6:59 pm
by mandyj123
lol didnt mean to repeat it so when can we expect the button to be added ?
Question about the vQmod you uploaded
Posted: Tue Jul 26, 2011 2:06 am
by opencartisalright
uksitebuilder wrote:
vQmod file here if it helps:
uksb_admin_dashboard.xml
I uploaded your vQmod but my dashboard is still counting orders towards total sales that fall outside of the 0-6 and 15 order status ID... I checked my order status IDs in phpMyAdmin to verify.
Is this vQmod supposed to stop orders that fall outside of order status 0-6 and 15 from showing up in total sales on the dashboard page? And if not what exactly does this vQmod do?
Returns Have To Add Manually Back To Stock
Posted: Tue Jul 26, 2011 2:59 am
by uksitebuilder
That is exactly wha it is supposed to do
Only test on OC 1.5.x though
Check your vQmod/vqcache folder to make sure the file is being written
Re: Returns Have To Add Manually Back To Stock
Posted: Tue Jul 26, 2011 5:01 am
by opencartisalright
uksitebuilder wrote:That is exactly wha it is supposed to do
Only test on OC 1.5.x though
Check your vQmod/vqcache folder to make sure the file is being written
I'm using OC 1.5.1.1 so maybe that's it.
However the file is being written to my vqcache folder and there is no error generated on the vqmod.log file. And I checked the cache file and verified the code was replaced with your code.
Maybe something changed in OC 1.5.1.1 that is causing this vQmod not to work...
Re: Returns Have To Add Manually Back To Stock
Posted: Wed Jul 27, 2011 10:32 pm
by uksitebuilder
HI,
Please try the attached vQmod file instead
Re: Returns Have To Add Manually Back To Stock
Posted: Wed Jul 27, 2011 10:35 pm
by ckonig
people, be careful what you are doing!
please do not bind the code to specific status ID's
rather give the statuses logical and configurable properties (is done, is cancelled, is in progress)
And while doing, think about that also order_products could have a status, so i dont have to delete an order_product a customer has ordered. I would rather cancel it!
Re: Returns Have To Add Manually Back To Stock
Posted: Wed Jul 27, 2011 11:14 pm
by uksitebuilder
Not sure what you mean.
Please read the whole thread as this is a quick fix only for people who don't edit the default order statuses
For this to be a complete fix, then yes, the order statuses as are would need to be grouped into as you say, completed, cancelled etc and any new statuses added by the user would go into one of these groups.
However, the affected code is purely for the dashboard chart which currently doesn't work exactly by default unless you delete all non-live/non-complete orders
Re: Returns Have To Add Manually Back To Stock
Posted: Wed Jul 27, 2011 11:30 pm
by ckonig
alright, as a fix this will work out alright.
in general, this is one of the largest problem i see with opencart....
Adding new features all the time is nice, but for a business application, some things might need a little more thinking.
Re: Returns Have To Add Manually Back To Stock
Posted: Thu Jul 28, 2011 3:55 am
by opencartisalright
Still not working even with your new vQmod file.
I'm not getting any errors in vqmod log file, the file is being written in my vqcache correctly, the lines of code are actually being replaced with your code, and my order status id's in mypHpAdmin are all correct.
All of my sales that fall outside of the 0-6 and 15 order ID status are still showing on my dashboard in the total sales figures. I refreshed my browser numerous times, cleared cache, F5, and all that jazz...

Re: Returns Have To Add Manually Back To Stock
Posted: Thu Jul 28, 2011 4:04 am
by uksitebuilder
Leave it with me to fully test in 1.5.1.1
Seems really weird though.
Please check back tomorrow
Re: Returns Have To Add Manually Back To Stock
Posted: Sat Jul 30, 2011 4:34 am
by opencartisalright
Did you get a chance to look over this one mate?
Re: Returns Have To Add Manually Back To Stock
Posted: Sat Jul 30, 2011 5:39 am
by uksitebuilder
I just re-read this thread over.
My vQmod only affects the chart display.
A lot more code is required to sort out the actual totals.
I have quickly looked in to it, but a lot of the methods/functions are used elsewhere within the admin.
It will take some work and if I'm going to do it, I will bear in mind the grouping of statuses mentioned above and do it properly.
Re: Returns Have To Add Manually Back To Stock
Posted: Mon Aug 01, 2011 10:55 pm
by opencartisalright
Well, if you decide you would like to take the time to develop this and turn it into a commercial mod I would totally buy it (provided it wasn't out of my budget

).
Re: Returns Have To Add Manually Back To Stock
Posted: Thu Nov 17, 2011 6:58 am
by Solan
Im also interested in this