thiv Posted March 1, 2013 Share Posted March 1, 2013 Hi, How is-it possible to define "Virtual Product" as default when creating a new product ? I want the "Virtual Product" checkbox already checked when I add a new product. My store is selling only "Virtual Product". thiv Link to comment Share on other sites More sharing options...
Ismael Arguedas Posted March 3, 2015 Share Posted March 3, 2015 Hello, I would like to know, how to do this, also on presta 1.6.0.9 thx Link to comment Share on other sites More sharing options...
Tuni-Soft Posted March 3, 2015 Share Posted March 3, 2015 You can either make a small module with hook "displayBackOfficeHeader" and add this code $(window).load(function(){ if(location.href.indexOf('&addproduct') > -1) $('[name=type_product][value=2]').prop('checked', true); }); or simpler (but involved core files edits) find the method getType in "classes/Product.php" and change these lines if (!$this->id) return Product::PTYPE_SIMPLE; to if (!$this->id) return Product::PTYPE_VIRTUAL; Link to comment Share on other sites More sharing options...
Tuni-Soft Posted March 3, 2015 Share Posted March 3, 2015 A better solution https://www.prestashop.com/forums/topic/386184-free-medialoader-module-load-your-js-and-css-files-easily/?p=1987142 Use my free module, create a javascript file in "bo_js" (inside the module directory) And add this code inside it $(window).load(function(){ if(location.href.indexOf('&addproduct') > -1) $('[name=type_product][value=2]').prop('checked', true); }); This way, you don't have to modify on core files or make modules just for few lines of code 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