Jump to content

Storing price value when saving


Recommended Posts

Hi,

 

I am new in this community and after struggling  to find a solution to my problem, I've decided to open an account. First of all I'd like to say thank you all for your help and hopefully this topic can be useful to other developers.

 

The reason I'm writing this topic is that I am developing a test module which stores the price of a product in a variable called 'former_price' when the admin updates the price (e.g., I want to update the price of a t-shirt with a lower price and want to store the old price so I can show it strikethrough, kind of saying 'look, the old price was higher...'). The thing is that I want to use the hookActionProductSave in order to save the value when clicking on save, however I don't know how to. I tried this way:

public function hookActionProductSave($params)
  {
  	$former_price = $params['price']->former_price;
  }

Also this way:

public function hookActionProductSave($params)
{
	Configuration::updateValue($former_price, Tools::getValue($price));
}

I have created the variable former_price in the database and I am able to update it vía tpl, but I want this action to be invisible to the user and just update the variable using the action hook.

 

English is not my mother tongue language so I hope I explained my issue clearly. Thank you for your help

Link to comment
Share on other sites

hi..
can you develop custom module ? if you develop custom module then register hook with your module "ActionProductSave" and use same like above your module file.
if you need store the price then you need create the custom table using you module install method.

 

public function hookActionProductSave($params)
  {
  	$former_price = $params['price']->former_price;
  }

 

Read this i hope you better understand 
http://nemops.com/prestashop-products-new-tabs-fields
Thanks

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...