Wocommerce Add column order quantity to My Account Orders - php

i would like to have a new column which shows how many DIFFERENT products are in each order in the order over screen in my account.
Example:
apple x 5
banana x 9
cake x 3
Right now Woocommerce shows a column "total" which lists 17 (5+9+3) "17 items for 25 $"
i would like to have a new column which shows the number of different products, so here: 3 (apple+banana+cake).
tried to achieve this by changing this code, but wasnt successfull. thx for your input
Add column total order weight to WooCommerce My account Orders

Related

Adding to the quantity field from product add on in woocommerce

Can anyone help with my dilemma please? I have a product that i want customers to be able to select the delivery for. For example, i have product x, the customer wants 5 products delivered across 3 months.. lets say in jan i want 1, feb - 2 and march - 2.. so quantity of 5 in total .. i want to get the quantity displayed as 5 and then price displayed for qty*price of product as well.. this has to be displayed in the cart page as well .. I have created product add ons using the woocommerce plugin, now i want the product add on fields to include these as a quantity .. i am fairly new to php .. can someone please help me with this?

Woocommerce: Table specific product sales with metadata in front end

Ok so here is my aim:
I have a single product with no category. I have used the 'YITH Woocommerce Product Add-ons' to add a group of checkboxes to the product that accepts 4 selections. The order is raised and the product has the 4 selections of checkboxes listed in the cart/checkout pages and also on the order page in my account. So far so good! Now...
I wish to produce a table on the frontend that lists all the sales of the product with the order date, first and last name of the customer and the 4 selections the customer made when ordering the product. For example...
Product X Sales:
First Name | Last Name | Date | Select 1 | Select 2 | Select 3 | Select 4
I have looked at the plugin 'Product Customer List for WooCommerce', this has a shortcode for displaying a list of customers and date when the product was purchased however; I don't have a way of extracting the metadata stored by the YITH Product Add-on field attached to the product sale.
Any help would be appreciated either with or without the Product Customer List plugin. Looking for some code possibly to recall the data per product sale and list it correctly in a frontend table.
Thanks in advance!
This option is now available in the pro version of the plugin

opencart category quantity discount

I want to set discount is as follows.
Suppose, My one product is for £4.29.
If buyer buys 3 or in multiple of 3 like 3,54,39 or 189 etc, will cost him as £3.33/product.
If buyer buys bulk order other than multiple of three like 4 or 14 or 2 or 38 etc, than it will cost him as regular price of £4.29/product.
* One product will cost £3.33 only and only if bulk order is made with multiple quantity of 3. *
I found some setting in the discount section of each product. It works fine as per my requirement. (reffer attached image)
![enter image description here][1]
But it's hard to mention it for each multiple of 3. For Eg. What if a customer wants to 300 products. For that I need to write till the 300.
Is there any extension available for this or any one have other solution for this problem.
Thank you for your answer.
If am getting you right, you are able to calculate discount for all other quantities except for those in multiples of 3.
If that is the case, my suggestion is:
qty;
if ((qty % 3) == 0) {
// multiply qty by 3.33
price = qty * 3.33;
}
else {
// use your existing (working) formula
}
I hope this works.
twist added into the problem.
There are three categories with same price. Assume that its £4.29.
If a customer buys any of these category product with a total quantity of 3 or multiple of 3 than one product price will be £3.33
If a customer buys 10 products than 9 products will cost him as £3.33/product and remaining 1 product will cost £4.29.
Customer is allowed to buy 3 diffrent products of three different categories or he may buy 2 from one category or 1 from another category.
I hope you guys will understand the problem and give the bestest solution possible.

How to store complex product/order data in MySQL?

I'm working on an order system for my online shop. I have 2 tables:
products, storing info about products
orders, storing general id's & infos of customer orders.
Now I want to have a way to store complex customer orders in the database. I need something that will let me know how much of each size (S, M or L) of each product is in an order.
The tricky part is that I want to be able to add/edit/delete products (of course without affecting orders from the past), so the method should be flexible
How should I go about this?
a separate table for every order, with products as rows?
one table for all orders, with products as columns?
some other option?
Thanks!
Depends on your goals for your cart. For instance, do you want to allow guest purchases? i.e. where a user does not need to login in order to make a purchase?
The attached image is a design I have been working on and it goes like this:
A visitor selects products from the site and adds these to a session cart (just a place to temporarily store the products, their quantities and their prices etc.)
Once the customer is ready to check out, we create the order, the order person and the person_address (where the product must be delivered to) and add the items to the order_item table. All this information is added by the customer in the checkout page.
The final step is then to offer the payment methods: paypal, credit card, etc.
What I like about this design is that users have no obligation to register with us. Order_person acts as a kind of interface between users and orders. If do register, we simply link order_person to the user table...
I have included a sample front end of the checkout page too.
At the very least you need:
Products (one row per product)
ProductID
Size
Orders (one row per order)
OrderID
OrderDetails (one row per product per order)
ProductID
OrderID
Size
Note that each 'size' is its own ProductID. You'll probably want to have yet another ID that groups products that are the same 'base' product, but in different sizes.
So if Order #1 has three products, and Order #2 has four, then OrderDetails will have seven rows:
OrderID ProductID Quantity
1 234 2
1 345 9
1 456 30
2 432 1
2 234 65
2 654 8
2 987 4

Populate dropdown menu based on groupnumber and MySQL answer

I am building an webapplication for retailers to register purchased products in PHP/MySQL.
What I like to do now is to populate a dropdown menu in a form with the products the specific retailer sells.
The retailer is assigned a value for each product that they are selling, and then the values are summed up and putten into the database in the colum Group.
The group memberships can be determined by coverting the number in the Group column to binary and then check the specific position for a specific group in the string returned.
Example: 5 is 101 in binary, this value is assigned to the Group column in the database. By checking if the first position is a 1 I'll determine if the retailer is selling Product 1. Noting that the second character is a 0 I thereby know they ar'nt selling Product 2.
And since the last position is a 1 I also know they sell Product 3.
So for the retailer to register they've sold a Product 1, I want to populate a dropdownbox with only the prducts that retailer is selling.
I do understand I have to get the groupvalue (the binary value is set when loggin in using the $_SESSION['group']) loop it through to check wich products the retailer sells and in the same time populate the dropdownbox. I'm guessing a while loop inside the -tag, but how? The names (Product 1 and so on) are in a separate table with their values. Example:| 1 | "Product 1" | (the | are representing columns start/end).
Any idea on how to do this? Or is it someway better to do this? A string in the table with the names wont work since the fields are limited to a number of chars and with many products that will be a problem.
Nevermind, remade the groupsystem into using separate tables instead.
Now working like a charm with a table frou groups, a table for users and a table to link them together.

Categories