How to store ordered image into database
-
Hi,
Can anyone please help me how to store ordered image into orders table along with grand total and quantity etc. All ordered data is storing at packeages/Webkul/Checkout/src/Cart.php, for reference please find below the screenshot,thanks in advance
-
Hi,
Can anyone please suggest me, how to store ordered image into database from order summary page. Thanks in advance
-
Hello @Keerthi
You need to customise for it & can do as -
- Add column 'image' in oder_item table.
- Insert base image when order gets placed.
- Show this image where you want.
This is the way, you can achieve it.
If you only want to show images for order without inserting, then ca do as -
Every order is place for product & product have images. So if you want to product images at order page then can retrieve according to product & need not to do above thing.
Thanks
-
Hi Rahul,
I have created one more column called "image" in order_item table and then I have added image in orderItem.php model. but image is not storing into database when order get placed. Please help me
-
Hi @Keerthi
You also need to override cart functionality beacuse every order is placed on basis of cart data, so when you add item in cart you also need to store your base image path there. So create column in cart_item table to store image there. For it you have to create own your cart facades as we created in Checkout package.
Now you need to override add cart fuctionality for which you need to create your own route & coontroller and when user clicks on Add to cart then this controller will be called and store image in cart_item table.
After doing all of this you need to ovveride checkout's save order functionality for which you can do the above process and when this controller called you can see this
$order = $this->orderRepository->create(Cart::prepareDataForOrder());
in OnepageController.php's saveOder function.
in this code, your Cart::prepareDataForOrder() function should be used which we override before.
Thanks