Problem with prestashop hook.php and tab.php files - prestashop

We got an error at the top of some pages: Warning: Invalid argument supplied for foreach() in /public_html/classes/Hook.php on line 491.
I've read that it could be a problem with the foreach loop or arrays, but I don't know php and don't know how to fix it.
In line 491 I find: foreach ($results as $result) {
Another problem is that when I enter a category from the client side, I can't go to the 2nd/3rd/4th/5th page, only one page is displayed and the next ones don't want to load. The error Warning: Invalid argument supplied for foreach() in /public_html/classes/Hook.php on line 491 appears on pages that do not want to load.
I also get an error after enabling debug mode:
PrestaShopBundle\EntityTab.
The association PrestaShopBundle\EntityTab#tabLangs refers to the owning side field PrestaShopBundle\EntityTabLang#tab which does not exist.
I changed:
#ORM\OneToMany(targetEntity="PrestaShopBundle\Entity\TabLang", mappedBy="tab")
to
#ORM\OneToMany(targetEntity="PrestaShopBundle\Entity\TabLang", mappedBy="id")
insrc/PrestaShopBundle/Entity/Tab.php but it doesn't help.
PHP debug info debug info

I managed to solve the problem - I had to change active to m.active in the body of the sql query. Thank you

Related

Cache files always created with wrong permissions in Yii 2

I get this error in my log files every time a cache file doesn't exist it seems. On the first page load, I always get this error
[message] => filemtime(): stat failed for [...]/runtime/cache/my/myapp03eab921185f7b68bbca50d8debc0dda.bin
[file] => [...]/vendor/yiisoft/yii2/caching/FileCache.php
[line] => 113
It doesn't happen anymore on next page loads but that one time is really annoying since the slack bot watcher is spamming our channel with this useless warning. Is there a way to avoid that, or is it a permission problem?
The "runtime", "cache" and "my" folders all have 775.
Update
Turns out the issue is that I'm using error_get_last() that is also getting warning-level errors. So it's a different issue entirely, not Yii-related
Make sure that you don't have enabled scream in your php.ini. Warnings from this filemtime() call should be suppressed by # operator, but scream setting can override this operator and generate warning anyway.
if (#filemtime($cacheFile) > time()) {
// ...
}
You must be getting this in PHP 7.1. try to run this with PHP 5.5 and see if you are getting the same error.
To reproduce you need to delete all files from runtime/cache directory
Then start app again(reload page) and look into runtime/cache. It is empty
Yii2 doesn't make cache again
Got same issue in Yii. The error was on the same string (FileCache.php:113)
if (#filemtime($cacheFile) > time()) {...
In my case reason was that my custom php error handler (heir
of the class yii\base\ErrorHandler) didn't check if
error type need to be handled according error_reporting().
Custom handlers allways gets every error, even muted by Error Control operator (#)
https://www.php.net/manual/en/function.set-error-handler.php
error_reporting() settings will have no effect and your error handler will be called regardless

Oracle APEX: Error: SyntaxError: Unexpected end of JSON input

I'm having an issue where I've got a button that's action is to 'submit page' upon being clicked. The code then executes a PL SQL statement:
IF :REQUEST = 'btn_create_company' THEN
INSERT INTO COMPANIES (company_name) VALUES(:COMPANY_NAME);
However, when the code comes to execute, whilst it is adding the entry to the database, I'm getting this error on the client which is preventing the page from redirecting after processing:
Error: SyntaxError: Unexpected end of JSON input
I don't understand why this is happening as I'm confident there's nothing wrong with the above statement.
Ok, so I get this problem too, It's when I submit the page but instead of reload the whole page, I'm running a process and stay there.
The process itself works well, however I get the error message, just like you.
So I don't get the a solution, but found a workaround by adding this to the end of my process:
apex_json.open_object;
apex_json.write('success', true);
apex_json.close_object;
You are missing the page number on :COMPANY_NAME. It should be something like :P1_COMPANY_NAME
I was encountering a similar error when operating the last page in a chained dialog (aka "wizard") I had created.
The cause of my issue was that I had created a branch on the "After Submit" with the Behaviour/Type attribute set to "PL/SQL Procedure" and then had the code I wanted to be executed within the PL/SQL code attribute. When the "Finish" button was clicked, I was seeing the same error.
My resolution was to delete the branch and instead to use Create Process, with the Identification/Type set to "PL/SQL Code" and then placing the code I wanted to be executed within the "Source/PL/SQL Code" attribute.

DGRAPH Log report DocumentCollectionCategories::GetDocumentScore invalid parameter

I'm looking at our Dgraph.log file and I'm seeing a lot of the following errors. Can anybody point me towards the cause of it? I've verified that my property "p_sort_default" exists and is being populated with data. I'm not sure how to track down where it's being used as a parameter incorrectly.
ERROR 01/02/14 06:02:50.414 UTC DGRAPH {dgraph}: DocumentCollectionCategories::GetDocumentScore invalid parameter "p_sort_default".
This error is due to using a search interface with a dimension search. The search interface was designed to be used with a navigation query which have the parameter "p_sort_default". The dimensions do not have the parameter and are throwing the error. We are setting up a new search interface specific for the dimension search to use to clear up the error.

Prestashop admin panel is lost after trying to export language packet

There were some language problems in my site which uses a specific theme so I thought,I should pick out the language pack edit and reload it. Because I couldn't find a way to edit it using browser on admin panel.
I just pressed a button named export language packet. I don't know if something happened that time. But it didn't give me a file (an exported file I mean) . So I didn't do anything else. But since that time I can't reach my admin panel. While I write the URL it shows me a big white screen.
On the other side the site itself (not admin panel) is reachable. What can I do to fix my problem?
Hi,
This is the error
( ! ) SCREAM: Error suppression ignored for
( ! ) Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in C:\wamp\www\httpdocs\translations\tr\admin.php on line 586
Call Stack
# Time Memory Function Location
1 0.0009 690552 {main}( ) ..\index.php:0
2 1.7995 9942280 DispatcherCore->dispatch( ) ..\index.php:50
3 2.0567 10375504 ControllerCore::getController( ) ..\Dispatcher.php:342
4 2.0686 12512728 AdminControllerCore->__construct( ) ..\Controller.php:128
5 2.0689 12514200 AdminControllerCore->l( ) ..\AdminController.php:304
6 2.0711 12612344 TranslateCore::getAdminTranslation( ) ..\AdminController.php:1737
The error you got is in your translation file in file translations\tr\admin.php on line number 586.
To fix that error, take a backup of that file, i.e. keep a copy of that file in some other place, then try to find out the syntax error you got there. It is some kind of PHP syntax error there in that translation file. As the translation file is only for the admin section, therefore your site front end may be fine and your site admin section is not working.
If you are not able to find that error and fix it, then delete all contents from that file, and then try to load the admin section.
You should use a translation pack which is provided by prestashop, ie download it from the prestashop http://www.prestashop.com/en/translations .
Also if you want to edit translations, use admin. In your question you mentioned, that you were not able to edit translations, please do provide details for that problem, and also try to edit translations while keeping error reporting on, so if there is any problem, you will get the errors printed. If you got errors printed, then update your question with that error message.
Let me know if you still got any questions.

Loading feeds / entries getting undefined method 'entries' for 0:fixnum error

I trying to load feeds from my blog but this is resulting in the error in the title mentioned.
The error message:
NoMethodError (undefined method `entries' for 0:Fixnum):
app/controllers/pages_controller.rb:6:in `home'
This is how I'm doing:
I created a file in the libfolder called blog_feeds.rb, that contains only the following:
module BlogFeeds
require 'feedzirra'
def load_feeds
feeds = Feedzirra::Feed.fetch_and_parse('http://blog.shigotodoko.com/feed')
end
end
And the line #6 for the error is:
#feeds = load_feeds.entries
Note that this error only occurs sometimes, not always.
So, any idea about what's going wrong here?
Thank you!
When fetching a feed, Feedzirra will return the HTTP status code instead of an object containing the feed entries, if the HTTP fetch results in an error (i.e. not a 200 or 3XX).
In order to handle this condition gracefully, check the type of the object you get back from fetch_and_parse by wrapping it in something like:
unless feeds.is_a?(Fixnum)
# work with the feeds object
else
# handle the error condition, retry, etc.
end
You should also be able to see these failures by fetching the feed in a browser repeatedly, if it's frequent enough.
Well, seems that was something wrong with my code before.
I was trying to randomize some posts and using something like this on the view:
#feeds.shuffle!.first(5)
In order to get the first 5 random posts.
And to fix it, I just replaced the shuffle! method for the shufflemethod.
Now, everything is working fine!