Magento: Edit existing line items in an order - php

Can we edit existing lineitems in an order (Change Status, quantities ordered, quantities processed, Price, Discount amount) ?

There is no way to edit it manually in the Back Office.
You can change them through action in BO
You can write your code loading models from Mage_Sales_Model_* (Mage_Sales_Model_Order, Mage_Sales_Model_Order_Item etc.) and operate on them
You can change manually data in PHPMyAdmin in the tables
sales_flat_order
sales_flat_order_item

Related

MySQL DB design for a products rental with pricing history

I'm designing a database for product rental. I'm using Laravel 8 framework.
prices change all the time.
The rental order requires a quote generated by the client.
The prices are stored but not listed in the user view, they are only for reference in the admin order quote generator view.
The client wants to be able to change the price for each quote before sending it as their specific client may need special treatment.
So, summing up, I need:
To store a record for the price of a specific order quote.
To store a base price and a history record of this price.
To be able to list the available products in between two dates filtered by the status of the order, which will change until the final approval of the quote. Also filtered by the stock available.
Have additional costs associated to the specific order.
Different total price for deferred payment.
This is what I came up to, I have a table for:
Orders
Products
Order_Product (this name format is required by laravel's eloquent)
Products_Prices
Additionals
Orders_statuses
In the order_product table I'm planning to store the price defined for the client, and the count of rented products. Also foreign keys for a many-to-many between products and orders.
In the order I'm planning to store the "pickup" and "return dates to query first WHERE "orders with approved status" BETWEEN the two dates selected by the user. Finally get order_products with a NOT IN to display the available products.
The products_prices table I use it to store the changes record.
In the products table I have availability because the product may not be available for rent for many reasons for a period. Stock and colors that I will use for ordering the list because of a requirement from the client so I go first for primary color, secondary and tertiary afterwards.
I'm not sure if this is the most efficient way to achieve what I'm looking for. Since I will need to check products availability all the time I need to be sure that this is the fastest and more reliable one.
I'm not english speaker so I feel the need to clarify this:
The client = My client.
User = My client's client.
Thanks in advance!

Getting product weight info in virtuemart inside order details/order history page

I have the following problem in virtuemart:
I have made a function to calculate shipping cost based on a five stage cost given by the shipping company. This works perfectly on the cart page, but on the order details and order history page it does not, as I cannot get the product weight in these pages.
I have looked into order_items.php where the order details references are kept, but there is no reference to the product weight, only to product id, quantity, category, etc.
Could anyone help me in how to get the product weight inside the order details page? I can do the rest in calculating the shipping rates and updating the final sales price, but I am stuck in getting this info.
Any help is welcomed :)
Try this,
I think you missed something about order tables, hope you are using VM2.x
In this version once the order is processed its payment,shipment information gets saved on the #__orders table.
In additionally the payment method Id and Shipment method Id also gets saved. So you can identify the method used on the order.
The idea of calculating ordered products shipping cost later on admin side is not practical bcoz later the shipping cost may very.
So practically once the user placed an order that time you have to save these information on the above table. If you're using VM default Shipping plugins they will do this by default.
Hope its clear.

Is it possible to update the order item quantity in Magento?

I want to update the ordered product quantity from the sales order view page (admin side). I have added a new button and actions for update order quantity. But I don't know what are the tables needs to updated for this. or else is there any other solution?(without creating new order concept).
I already gone through below one.
Is it possible to update order items quantity in Magento?
Thanks
Orders data are saved in database tables sales_flat_order and sales_flat_order_item.
You can find orders and order items data in your (tables prefix)_sales_flat_order and (tables prefix)_sales_flat_order_item respectively. but remember that when an order is placed Magento simply copies the data from its respective quote. so in my opinion you should be checking (table prefix)_sales_flat_quote and (table prefix)_sales_flat_quote_item first.

Change number of items bought in Prestashop

I have made a custom shopping cart in prestashop, I now need to increase the number of items bought in my shop manually. I guess this can be done by modifying the database. I tried changing the ps_product_sale table, but to no use. Can anyone suggest as to how to do it.
Thanks.
You can do it by making changes in the ps_order_detail table. In that table, PS stores all information for an ordered product like product id, name, product purchased quantities etc etc.
There is a column named product_quantity, change it and it will change the number of products bought.

Limit product quantity to 1 per customer in magento

I need to limit the quantity of a product purchased by a customer to 1 per day. We are going to have something like deal and day and targeting consumers. We do not want some one to buy high quantities. Could some one guide me as to what the general approach should be to do this? Thanks.
I noticed that there is a table sales_flat_order_item which contains products_id for an order, a join of this table with sales_flat_order should give me product_id for the orders placed by the customer. How do i access this table data directly and perform the join operation the magento way? Do i need to create a new module? or modify a existing module?
You could just create a coupon/coupons for this. Leave the product at the original price and hand out a coupon to the targeted customers. Make sure that you set it to "only applies to 1 item" and can only be used once.
Regards,
Kenny

Categories