Jump to content

understanding overide paths from http://doc.prestashop.com/display/PS16/Overriding+default+behaviors


johnrobertson

Recommended Posts

I have trouble understanding the instructions for override paths...
http://doc.prestashop.com/display/PS16/Overriding+default+behaviors

The files I want to override in version 1.6.2.20 are 
http://example.com/x/themes/default-bootstrap/js/order-opc.js
and
http://example.com/x/controllers/front/OrderOpcController.php

Does anyone know a good guide or a quick answer?
(I know that altering the original and re-naming the theme is a work around, but want to allow updates)
John

 

Edited by johnrobertson (see edit history)
Link to comment
Share on other sites

14 hours ago, johnrobertson said:

I have trouble understanding the instructions for override paths...
http://doc.prestashop.com/display/PS16/Overriding+default+behaviors

The files I want to override in version 1.6.2.20 are 
http://example.com/x/themes/default-bootstrap/js/order-opc.js
and
http://example.com/x/controllers/front/OrderOpcController.php

Does anyone know a good guide or a quick answer?
(I know that altering the original and re-naming the theme is a work around, but want to allow updates)
John

 

 

1- About  changes on your theme

 You can't do override your themes files, you can create child themes but on 1.7 not on 1.6 if you need change some file just change but keep a track of your changes

if you want keep update but I think you dont need worry too much about the theme update on 1.6 because is almost to end of live

 

2- to override the controller just go to the override directory and create your override files

you can see the controller names   something like NAMECore your new file name should be the same but change the class declaration  

original

class NAMECore extends FrontController

your file should be

class NAME extends NAMECore

 

after you need delete the class_index.php file on the cache directory 

 

 

 

 

 

 

 

 

 

 

 

 

  • Like 1
Link to comment
Share on other sites

I think this is beyond me but thanks for help!

I copied a file from
/controllers/front/OrderOpcController.php
to
/override/controllers/front/x-orderopccontroller.php


I read the reply that says "

class NAMECore extends FrontController

your file should be

class NAME extends NAMECore
.
...I tracked this down to about the first line of text in my transplanted file. There are no other overrides in the directory to copy, but I tried changing it
Mine orgininal said ...
class OrderOpcControllerCore extends ParentOrderController
My edited version said ...
class OrderOpcController extends OrderOpcControllerCore

I remembered to delete the cache file

Unfortunately my test site showed an error message instead of the edited shopping cart page:
Fatal error: Class 'orderopccontroller' not found in /classes/controller/Controller.php on line 134

I think I should find an easier work-around, but write this here in case anyone else has the same problem.  

 

Edited by johnrobertson
line about deleting cache file (see edit history)
Link to comment
Share on other sites

Old PrestaShop releases contain every single empty master file for overrides in their override directory, except those for overriding the back office files, which is possible, too.

  1. Go to PrestaShop downloads
  2. Choose Previous releases
  3. Choose Older versions
  4.  Choose for example release 1.5.3
  5. Download the zip file and have a look into its override directory 
  6. Or simply use the following download url: https://download.prestashop.com/download/releases/prestashop_1.5.3.0.zip?_ga=2.142362546.1486751929.1534879200-1861741334.1534879200
  7. And don't forget that you need to refresh the smarty cache to make any override work
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...