Jump to content

Add a field in the Cart, is it possible ?


__fabrice
 Share

Recommended Posts

Hi,

I would add a date field in the basket. I uploaded the page product.tpl, and I edit ajax-cart.js for the call to cart.php accepts a date.

Then I see that uses prestashop / classes / Cart.php, but I do not see where to add code to manage a new date field. And besides, what tables are involved? ps_cart?, ps_order too (indeed) ?

Thank you for your help

Fabrice

Share this post


Link to post
Share on other sites

Hi,

I just want to add a field in the product table, a date field, that i could retreive in the shopping cart, and in the order.

In my case, a product is a trip. And the customer must choose a date of his trip ( in a jquerye calendar for example).

Regards,
Fabrice

Share this post


Link to post
Share on other sites

In that case, you need to add an extra field to ps_orders, since a client can purchase more than a trip.

This means that when a client decides to purchase a trip, you will need to get that date from him before adding his choice to the cart.

Share this post


Link to post
Share on other sites

Hi,
I've add a field in "ps_cart_product" table and update and insert it, ok.

But, in the cart page 'order.php', I can't retreive this data (order.php::getSummaryDetails() and Cart::getSummaryDetails()).

Thanks,
Fabrice

Share this post


Link to post
Share on other sites

Around line 200 of cart.php (located in classes), you'll see a function named getProducts, as well as a big SQL query. You'll have to change the query in order to retrieve your table field in the result.

Share this post


Link to post
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More