ufk
ufk

Reputation: 32104

PrestaShop 1.7.3 Product.php class override

I have PrestaShop 1.7.3.3 installed with php 7.1.18 When I override modules and place them in the override directory it works well.

for example I added PrestaShop/override/modules/ps_languageselector/ps_languageselector.php and the override is being executed.

when I try to override Product.php by placing a file at PrestaShop/override/classes/Product.php, the file is not being loaded at all! adding die() or error_log doesn't change anything.

what am I missing ?

thank you

Upvotes: 2

Views: 4097

Answers (2)

Inform-all
Inform-all

Reputation: 168

The idea of PS1.7 is to extend instead of overriding.

But if you really must you still can override. Delete these 2 files:

var/cache/dev/class_index.php & var/cache/prod/class_index.php

Upvotes: 2

Ghazaleh Javaheri
Ghazaleh Javaheri

Reputation: 2117

i had same problem,in my case problem was file permission ,in module/Moddule.php in addOverride function we have a line file_put_contents($path_override, preg_replace('#(\r\n|\r)#ism', "\n", file_get_contents($path_override))) that transfer your override to /override directory ,because of file permission this line doesn't execute ,so problem happen, run chmod -R 777 . in your project directory solve the problem

Upvotes: 0

Related Questions