CS Cart add on for Price table change - php

the functionality is to take all price from cscart_prices table instead cscart_product_prices and also price with specific user as per user_id column (Current user).
example: Product_price = current_logged-in_user_id + product_price (from cscart_prices)
Note : Dont want to make user group for every user because so many user group will require to make.
All user have different price for different products.
IF 100 Product and 150 user then 100*150=1500 entries available in cscart_prices table.
I have tried different hooks available but not getting exact value and not able to identify that which hook will work in this addon to change price before they appear on store front.

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!

What is the right way to store 'historical data' into database in laravel?

I'm creating an E-commerce mobile application by using Laravel as back-end development.
Scenario: I have a Product table which store some information about the product. Whenever user buys a product, he will get a purchase history record (which will show the product information) that will be stored into the database. So when the seller update their product information, the product information of the user's purchase history record will not be affected.
Problem: If I just simply create a user's purchase history table to store the record for each user, I think it will be a lot of spaces required in the database.
Question: Is there any better way recommended to store the purchase history record? Or is there a way to create something like a 'snapshot' for the record before the product has been updated or deleted by the seller?
Well, this is more of an opinion-based kind of question.
The method that I use personally is the one that you also have in mind: to store the relevant data of product in a separate table. Let's say you have your users, products, and orders tables. A user has many orders, and an order has many products. I use an aditional table details to store product-related info (basically, the relevant data) so, in case of changes in the origintal product, the info still remains correct. You could also store this info in a json column on your purchase history.
Another approach could be to create new product objects whenever these are updated:
Product A (id: 1): price - $10 - 01/08/2019
Product B (id: 2): price - $25 - 01/08/2019
Product A (id: 3): price - $11 - 05/08/2019 (after an "update" on the price of the product)
This way, if someone buys a Product A on 02/08/2019, the price will be $10 and the foreign key in your history will point at the product_id = 1. Of course that this approach isn't the one that I'd use because reporting will be more difficult to handle.

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

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.

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