I have an application which is a T-Shirt customizer which works very good on it's own. But I need to integrate it into prestashop. So after a user uses the application to customize a t-shirt he has to click Add to cart and the product will be added to cart with a custom price and description.
What I need is for this output to be injected into the PrestaShop cart as a custom product with all the custom information and also the generated custom product image to display next to the details in the cart.
So I have the customizer done, I have allready made a custom module and page for Prestashop but I don't know how to integrate it with the cart. My prestashop knowledge is limited.
How can I do this?
I did something similar. Here's how I dealt with it.
My module works on its own. I stored customization in the database via object model from the customizer module. Each customization have an ID.
Prestashop offers customization for each products. I hide it from the customer on the prodct page but I use it to store the ID of the customization. That way, you can see in the cart the customization ID for each customized product.
I used _addCustomization method in the Cart object to store the customization ID. Here's a small example:
Hope I'm clear enough.
Does this help you out?
When you use this code in
CartController.php
then you only save your custom-description in a customization field. But how do you change the price for this customization?
Of course you have to override
getPriceStatic
method inproduct.php
file to recalculate the custom price. But there is also another problem: what if the customer add same product into the cart but with a different customization and also a different custom price?Different customization-text is handeled by your used method and is therefor added correctly to the cart, but the different price calculation just overwrites the first custom price because both customizations are associated with the same product.