Change number of items bought in Prestashop - php

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.

Related

Ecommerce database design, save product information without affecting historical data

What would be the best, if not, the practical way to design an e-commerce database wherein the product information of the product purchased by a customer should not update when the product information was updated?
To give a better understanding, here's a scenario:
Merchant created "Product A" where it is priced at $50.
Customer saw Product A and purchased it.
Customer visited the transaction history and viewed his recent purchase: Product A priced at $50
Month's after, Merchant updated the price of Product A to $80.
Customer viewed again his transaction history. His transaction with Product A should retain at $50 and not the updated price of $80 because it was the price he paid that time.
One solution I am looking into is to save the whole product information in a table as a PHP serialized data in "purchases.product_information".
Is it even a good idea to store PHP serialized data in a column? How's performance if a user wanted to search for a text in the product information like price, item name, etc.?
Any other workaround for this?
Thank you
It is a case of slowly changing dimensions (https://en.wikipedia.org/wiki/Slowly_changing_dimension)
A simple solution will be to have a separate table purchase_items and have all the columns that may change over time against each item (Example:price, discount etc) and purchase and purchase_items table will have one_to_many relationship
Although, there are more complex situations where the price of the product changes on the fly based on the time at which an order is made in a day etc. In these cases, the price may not be stored against the product itself
This answer is addresses exactly the issue and you might find this helpful
https://dba.stackexchange.com/questions/57992/ecommerce-orders-table-save-prices-or-use-an-audit-history-table

Magento Products are not showing in Shop

Hope you can help me today. I imported about 85.000 Products from an SQL Source via Magmi. These Products are showing in the backend, they are "active", I updated the index (all of them), deleted the cache, made sure, that the products are in any category, made sure all mandatory fields are filled out, and they have a price. The products are not in Stock, but when I manually add a product thats not in stock, it is shown in the shop. And if i modify an imported product and increase the amount I have in stock, they are still not shown.
The products are all visible in catalog and in search, but I just cant find then clicking on the category in the menu. But if I search for a specific product I can find it.
Got anybody an idea?
Cheers
EDIT: Here I got a picture from Magmi import Process
And i only have one store, and one store view, that has default values
Following things you can check -
Check Visibility of the product.
Check if the product is assigned to a category.
Check if the product is assigned to a store view.
Check if the product is In Stock.
Check if the product has a qty assigned.

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.

Magento grouped product

I have created one group product containing many associated products. On product page I am adding that associated(simple) products of grouped product to one container. Then after clicking on ADD TO CART all associated products are showing differently with their quantity and prizes. But I want to show then as one group like single product. And price and quantity will be addition of all the associated products. Is there any way to do this? please help
If you want to show the selection of products as a unity, you should use bundle product which is aimed to do this.

Using an alternate price field in OpenCart

I have an OpenCart installation that is running two stores, one wholesale and one retail. The product catalog is shared, but the problem is that OpenCart doesn't natively support multiple pricing options. So I added a new field to the oc_product table, retail_price. The idea is that I would use the price field for wholesale pricing and the retail_price field for -- you guessed it -- retail pricing.
I have everything pretty much covered on the admin side, so my new field is showing in the product section and is being updated in the database.
Now the issue is getting the price to change on the front end for the retail store. Needless to say, product price is used in a ton of different scripts. So I figured the best/sneakiest method would be to change the price field when the database is queried and the price data is initially set. This is kind of where I got lost... I changed it in some places I thought were right but the price doesn't change on the front end. Sometimes OpenCart can be a mysterious fig.
Can anyone give me a clue as to where the best place(s) to change the price would be?
I assume that you've already created a different customer type for both wholesale and retail customers in the admin area.
That being the case, it's very simple to add this functionality to the model.
Open:
catalog/model/catalog/products.php
On or around line 22 you should see a line that looks like this:
$query->row['price'] = ($query->row['discount'] ?
$query->row['discount'] : $query->row['price']);
Determine the numerical value of your retail customer, let's assume it's 1 and wholesale customers is 2.
The variable $customer_group_id used below is previously set at the open of the getProduct() method.
Replace the previous line with the following:
if ($customer_group_id == 2):
$query->row['price'] = ($query->row['discount'] ?
$query->row['discount'] : $query->row['price']);
else:
$query->row['price'] = ($query->row['discount'] ?
$query->row['discount'] : $query->row['retail_price']);
endif;
Now if your customer is logged in and is not a wholesale customer, or is not logged in, they will see the retail price, if they are logged in as a wholesale customer they will see the wholesale price.

Categories