SonnyBoyII Posted July 25, 2011 Share Posted July 25, 2011 Hi I would like to decrease stock quantity after purchase by: quantity * variable. the variable will be stored in "feature | value" for each product. for example: We have 100 products XYZ with feature called "multiply" and value set to 12. If one bought 5 XYZ products , stock decrease -5x12. So we will have 40 products left at stock. Order history will be shown 5 products bought by that customer. Link to comment Share on other sites More sharing options...
SonnyBoyII Posted July 26, 2011 Author Share Posted July 26, 2011 any ideas? please?? Link to comment Share on other sites More sharing options...
Richard S Posted July 27, 2011 Share Posted July 27, 2011 You might use the default PrestaShop hook called updateQuantity and do all the actions you want. I do not remember what params this hook get, but I believe you should be able to get what you want by a simple module using this hook. Link to comment Share on other sites More sharing options...
SonnyBoyII Posted July 27, 2011 Author Share Posted July 27, 2011 You might use the default PrestaShop hook called updateQuantity and do all the actions you want. I do not remember what params this hook get, but I believe you should be able to get what you want by a simple module using this hook. Thanks! But the problem is I have no idea where is the final stage of buing process, when stock is updating. Which file shall I play with? orders, cart, products ? All I need is to take off from the stock, instead of X products,X * value_stored_in_prod_feature_tab. Any other prestashop behaviour remain the same. please, help Link to comment Share on other sites More sharing options...
Richard S Posted July 27, 2011 Share Posted July 27, 2011 I have mentioned that the most universal and best practice would be to create a custom module for this, because by editing core files of PrestaShop you will create problems with the updates in the future. You might use the default PrestaShop hook called updateQuantity and do all the actions you want. I do not remember what params this hook get, but I believe you should be able to get what you want by a simple module using this hook. Thanks! But the problem is I have no idea where is the final stage of buing process, when stock is updating. Which file shall I play with? orders, cart, products ? All I need is to take off from the stock instead of X products, X * value_stored_in_feature_tab. please, help Link to comment Share on other sites More sharing options...
SonnyBoyII Posted July 27, 2011 Author Share Posted July 27, 2011 Thanks. What would be the simplest practice then?? I need to get this work ASAP,the simplest way, because I have plenty other things to do to finish this project.... I will create proper modules later on I have mentioned that the most universal and best practice would be to create a custom module for this, because by editing core files of PrestaShop you will create problems with the updates in the future. You might use the default PrestaShop hook called updateQuantity and do all the actions you want. I do not remember what params this hook get, but I believe you should be able to get what you want by a simple module using this hook. Thanks! But the problem is I have no idea where is the final stage of buing process, when stock is updating. Which file shall I play with? orders, cart, products ? All I need is to take off from the stock instead of X products, X * value_stored_in_feature_tab. please, help Link to comment Share on other sites More sharing options...
Richard S Posted July 27, 2011 Share Posted July 27, 2011 Really, a module is the simplest way to do this as I see it. Link to comment Share on other sites More sharing options...
SonnyBoyII Posted July 27, 2011 Author Share Posted July 27, 2011 Really, a module is the simplest way to do this as I see it. I really have no time to lern how to write a module. Which funcion in which file shall I edit? Link to comment Share on other sites More sharing options...
Richard S Posted July 27, 2011 Share Posted July 27, 2011 Hooks are used from modules, if you want to use the this as I wrote earlier, you must use a module. Really, a module is the simplest way to do this as I see it. I really have no time to lern how to write a module. Which funcion in which file shall I edit? Link to comment Share on other sites More sharing options...
SonnyBoyII Posted July 27, 2011 Author Share Posted July 27, 2011 Hooks are used from modules, if you want to use the this as I wrote earlier, you must use a module. Really, a module is the simplest way to do this as I see it. I really have no time to lern how to write a module. Which funcion in which file shall I edit? I belive, all I need is to edit a line in one of the core files: from ... -quantity .... change to: -(quantiy * something) edit: I think I should be able to do this by editing updateQuantity function in classes/product.php file, am I right? Link to comment Share on other sites More sharing options...
SonnyBoyII Posted July 27, 2011 Author Share Posted July 27, 2011 I have mentioned that the most universal and best practice would be to create a custom module for this, because by editing core files of PrestaShop you will create problems with the updates in the future. You might use the default PrestaShop hook called updateQuantity and do all the actions you want. I do not remember what params this hook get, but I believe you should be able to get what you want by a simple module using this hook. Thanks! But the problem is I have no idea where is the final stage of buing process, when stock is updating. Which file shall I play with? orders, cart, products ? All I need is to take off from the stock instead of X products, X * value_stored_in_feature_tab. please, help But Richard, I think if I simply override a class I would be able to update prestashop without any problem as well? Link to comment Share on other sites More sharing options...
SonnyBoyII Posted July 27, 2011 Author Share Posted July 27, 2011 Ok, I almost there How can I get a value stored in feature >> value called "multi" , in classes/product.php file, ? Link to comment Share on other sites More sharing options...
SonnyBoyII Posted August 1, 2011 Author Share Posted August 1, 2011 [sOLVED] Its solved now! you can find the ansfer there http://www.prestashop.com/forums/topic/121727-features-values-how-to-pick-variable/ Thanks ROCKY!!!! Regards, SonnyBoy Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now