I know I can extract Sales Order data in OpenCart database, in table shop_order and shop_order_product.
Is it possible to differentiate which user creates the sales order?
I don't think there's an option to identify which admin user created the order. You may need to code it yourself. The below steps may help you.
Add 2 new fields created_user_id and updated_user_id in order table - with default value as 0.
Update the admin/model/sale/order.php to insert values to those fields as $this->user->getId(); (addOrder and editOrder functions ).
Add a new field user_id in order_history table - with default value as 0.
Update the admin/model/sale/order.php to insert value to that field as $this->user->getId(); (function: addOrderHistory).
You can do these by directly modifying the files or using vqmod. If it's done via vqmod then it'll be easier for you to make changes during opencart version upgrade.
Opencart: Vqmod tutorial
Have a nice day!!
By default, there's no way to know which admin an order is created by, or even that the order isn't created by the user (other than the IP would be that of the admin). You could in theory add the user_id to the shop_order table, and pass that to the manual order editor when it creates the orders
Related
I am started using prestashop 1.6. I want to show in order list (backoffice), whether it is from admin (manual order placed by admin), or frontend (order placed by customer). Is there any way to check this. I don't find any db field to differentiate it. If i missed, please help me to solve it.
you need to check in _cart table by the join of _orders.
recognize orders from BE of two columns:
id_shop_group
id_guest
both will be 0 if they come from BE
I am working on a project where I am trying to check some validations but I find a risk of 'product_id' parameter is not properly sanitized upon submission to the index.php script, which can disclose the software's installation path resulting in a loss of confidentiality.
so after checking the format of product_id of products, its only in numeric but is there any possibility that the format may be alphanumeric and if yes then what exactly will be the behavior.
Don't change it's data type because it's relation exists in 5-6 tables, SO better create a new field for it's alphanumeric Id and control it using php..
The product id is the foriegn key for 5-6 tables eg) product option contains the product id as referance so please dont
i have a slight problem here.
i am using stock in the channel with magento, and there plugin uses magento's default tax_class_id.
but the problem we are facing is we have deleted the default magento tax class id.
we have tried to change the plugin to make it use our custom tax_class_id. but as soon we do that plugin dont work.
we have tried to create the same name tax_class but it dont work as it use the new tax_class_id which is now 11.
can we make magento retrieve the deleted tax_class_id?
I don't use Magento, but it sounds like the problem is you deleted a row of data from the tax_class_id table, and when you try to recreate it you get a different value for the auto incrementing primary key tax_class_id, which if I'm correctly reading what you wrote, is confusingly the name of both the table and one of the columns in that table. Not that it matters what they're called, you can go in the tax_class_id table, create a new row, and then double-click on the tax_class_id column to edit the value there to make it match the original value (provided you know what the original value was, of course, but looking in whatever tables reference that value should give you that answer if you don't know). So basically just create it as you've done, it will automatically assign a new counter ID but you can edit that through phpMyAdmin.
Note that, in general, messing with auto incrementing ID values and changing existing data is a good way to mess up your referential integrity, but as long as you have a good backup and understand what you're doing this should work fine for you.
I need to change the order status using mysql commands
Let me explain, I created a PHP script that automatically generates shipping labels for paid orders and I automatically inserts the generated shipping number (from script) in table ps_orders (shipping number field).
For each order I have to go in the tab orders and modify it as shipped.
How can I automate this step?
I should tell to my script to "mark the order as shipped" by sql and PHP
now i have the following steps:
PHP create shipping code
PHP and MYSQL enter it in the field shipping_number
and the next must be......
modify the item as shipped (by PHP and MYSQL)
I have seen that is also enhanced the delivery_number column and delivery_date but have not found the field "shipping State" ...
Thanks, I hope I was clear
I think what you need to update is current_state field in ps_orders DB table. Evaluates an int from ps_order_state_lang DB table.
In Magento, once Customer places Order, that data automatically goes to Sales_flat_order table or for item related information goes to sales_flat_order_item table etc.
Likewise I have selected some columns in Magento database & created 1 custom table in Magento database.
Now My requirement is, once customer places Order that data also must get copied to custom table along with Magento\’s default table.
So for that I created one mysql query through joins that will fetch all my needed data from Magento tables & insert it in my Custom table....
Now I am planning to create php file that includes my above query.
My doubt is how & where should I change My Magento code so that once customer places order, I will call to this file so that I can copy data in custom table through that query.
I get some reference as When customer places order, it will use saveOrder function in Onepage model which is at Checkout/Model/Type/Onepage.php
So can anybody tell me what exactly I need to do in this scenario....Anyone having such scenario or sample code for the same…
Or having any other idea…
Plz guide me…
Thanks..
You can follow my tip on this answer but observing the checkout_type_onepage_save_order_after event.
Why don't you use a MySQL Trigger?
# target table name target_table
# source table name Sales_flat_order table
DELIMITER $$
CREATE TRIGGER ON_INSERT_AFTER_SALES
AFTER INSERT ON Sales_flat_order
FOR EACH ROW
BEGIN
INSERT INTO target_table VALUES(field_one,field_two,...);
END $$
DELIMITER;
You can use magento's sales_order_place_after event, create an observer for this and put you code into it.