stratboy Posted July 5, 2013 Share Posted July 5, 2013 (edited) Hi, with this line of code: p($link->getCategoryLink(new Category(3))); I get the requested permalink, but also this warning: Warning: trim() expects parameter 1 to be string, array given in [...]/classes/Tools.php on line 981 So, what's the matter here? If I look at the Link::getCategoryLink() source, I see that I must pass the category Object, since the category ID (that instead doesn't throw any warning) is deprecated. Any idea? Edited July 5, 2013 by stratboy (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted July 6, 2013 Share Posted July 6, 2013 I believe these are your issues $params['meta_keywords'] = Tools::str2url($category->meta_keywords); $params['meta_title'] = Tools::str2url($category->meta_title); Can you try to dump those 2 variables before those 2 lines? (they're in the getcategorylink funcion) Link to comment Share on other sites More sharing options...
stratboy Posted July 6, 2013 Author Share Posted July 6, 2013 (edited) I believe these are your issues $params['meta_keywords'] = Tools::str2url($category->meta_keywords); $params['meta_title'] = Tools::str2url($category->meta_title); Can you try to dump those 2 variables before those 2 lines? (they're in the getcategorylink funcion) Yes, the dump is something like this: array(1) { [1]=> string(0) "" } So they're array not string. Though, it's just prestashop output. getCategoryLink wants a category object, and a category object features those properties as array, not string. I guess it's maybe a little bug? For now I'll continue to use the ID instead, even if it's officially deprecated. Thank you! Edited July 6, 2013 by stratboy (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted July 6, 2013 Share Posted July 6, 2013 Yes, could be a bug indeed! 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