Jump to content

[SOLVED] How to update product column on frontend? User command


Danimt

Recommended Posts

Hey,

 

What I'm trying to accomplish is the following:

  1. If Products don't have a price, show "Request price" [Done]
  2. If the user clicks on "Request price" it sends an e-mail with the product reference, description, url and client name [Done]
  3. Create a new database column for saving the "Request price" status, and keeping users from flooding with massive clicks on the same product request [Done].
  4. Interaction in frontend with database column (read proccess only) [Done]
  5. Save state (from false to true) in the product column [This is where I need help]

 

Example on some products there is "Requisitar preço" (Request price), when you click it will send an e-mail to us with the product info and user name. (You won't be able to see it, as it only shows to registered users)

http://loja.tavrol.pt/pt/20

 

Now I need to save "true" (bool) into the DB column for the selected product. Any ideas?

 

Thanks

Edited by Danimt (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Thank you for your answer.

 

I'll dig deeper into creating modules and see how that turns out.

 

 

moreover - you can create module with simple php script.

For example when you open page like "your.domain.com/module/your_module/status.php?request_id=id

module will change status to "true" in your shop database.

 

You can add this link in mail with request, it's simplest than module with form, because you can change request status by one mouse click :)

  • Like 1
Link to comment
Share on other sites

moreover - you can create module with simple php script.

For example when you open page like "your.domain.com/module/your_module/status.php?request_id=id

module will change status to "true" in your shop database.

 

You can add this link in mail with request, it's simplest than module with form, because you can change request status by one mouse click :)

 

I was hoping to maintain my current php file I use to handle the ajax post request and do the SQL update from there by including the necessary DB connection files but i'm not finding much info on that.

 

Any idea on how to enable database querys and execution from a php file included in the template directory? (what files do I need to include to have access to Db::getInstance();)

Edited by Danimt (see edit history)
Link to comment
Share on other sites

I was hoping to maintain my current php file I use to handle the ajax post request and do the SQL update from there by including the necessary DB connection files but i'm not finding much info on that.

 

Any idea on how to enable database querys and execution from a php file included in the template directory? (what files do I need to include to have access to Db::getInstance();)

 

This question was solved here!

 

http://www.prestashop.com/forums/topic/205661-solved-accessing-dbgetinstance-from-new-file/

Link to comment
Share on other sites

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
×
×
  • Create New...