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

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.

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!

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.

Magento: Edit existing line items in an order

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

Auto switch customer group in magento

Has anyone found a way to auto switch a customer group based on specific rules? For example, if a customer over their lifetime has ordered 200 plus bottles of something they are grouped in a specific customer tier and get special pricing (wholesale type situation)
I know how to do segments of customers but that doesn't help me auto change which customer group they belong too.
Thanks in advance for any help in the right direction...
there are a couple of payable extensions at magento connect or you can create simple module with custom actions. Article for a good start.
In case someone is still looking for an answer, this extension (which I created) can do exactly what you are looking for and more out of the box:
Website:
https://plugin.company/magento-extensions/automatic-customer-group-switching.html
On Magento Connect:
http://www.magentocommerce.com/magento-connect/automatic-customer-group-switching-by-plugin-company.html
If you'd like to build your own custom functionality though, I'd recommend looking into the sales_order_placed_after event and getting the order history details by filtering an order collection on the customer ID that has placed the order.
Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id', $yourCustomerId);
You can then loop through each order and get all items by using the getAllItemsmethod.
Alternatively you could retrieve a sales_order_item collection, and join the corresponding order details from the sales_flat_order table. Then you could filter on customer ID and product ID and group the results on product ID.
You can then base your customer group switching logic on the sum of the total ordered product quantity.

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