mjan Posted December 13, 2014 Share Posted December 13, 2014 Hello, I've set up a new module and I have that error message : Fatal error: Class 'Tools' not found in /homepages/3/d533617558/htdocs/modules/pf_simpleproducts/getproducts.php on line 19 The line 19 in getproducts.php is : if ((Tools::getValue('prodname')) && (Tools::getValue('prodname') != '')) Could you help me ? Thank for your help Link to comment Share on other sites More sharing options...
FullCircles Posted December 15, 2014 Share Posted December 15, 2014 Is the file being called using the prestashop framework? i.e as: class pf_SimpleProductsGetProductsModuleFrontController extends Module type thing, or is it just a completely standalone file. If it's standalone, it won't have easy access to any prestashop classes such as that without including them in in some fashion, so that might be the issue. Without knowing exactly what you're trying to do with it, it's hard to say what would be the correct method to go with though, so more information would be needed Link to comment Share on other sites More sharing options...
mjan Posted December 15, 2014 Author Share Posted December 15, 2014 Thank you for your help. First, the module is simple product module and has the purpose to make product page without price, add to cart... Then, in the module, there is a field to search for a product and to add a product to a list to remove price, add to cart... When I enter a name in the field to search the product, the error message displays Link to comment Share on other sites More sharing options...
FullCircles Posted December 15, 2014 Share Posted December 15, 2014 If it's for your own personal use, I'd definitely recommend simply changing the product.tpl file in the theme to suit your purposes instead, likely to be a lot simpler than having to set up your own front end controller that duplicates the product page, by far. If it's intended for use in various stores, you still ideally don't want to be recreating the entire product page, as it won't interact well with any other modules that they might want. Might instead be worth looking into the various hooks on the product page and how you can alter it like that. Worst comes to worst and you can't directly hook into the bits you want, you can always just run some jQuery code via a product page hook that will modify/remove the blocks (price/add to cart etc). For the admin where you select which products have this option.. you have a few ways of going about it. Simplest is probably to just do all the form work in the module configuration page, which tends to be your getContent() method. Tends to be simpler but isn't very pretty Ideally you'll want to add an admin controller, you can then have that hooked into prestashops helperlist and helperform classes, which makes it simple to add sorting, filtering and searching by the columns and whatnot. There's information in the developer guides for using them, but it requires a bit more learning to do so. The other way would be to add on a new tab to the add/edit product section via hooks. I don't tend to prefer this way of doing it though, I found it a little clunkier compared to an admin controller, but possibly that's just because it wasn't suited to what I was trying to do Hope some of that helps 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