Post by straightlight » Thu May 09, 2024 1:02 am

Lumirion wrote:
Thu May 09, 2024 12:17 am
Ok. Just as a test I switched the route back to the product page and replaced my str_replace with

Code: Select all

 $this->document->addStyle('catalog/view/PDPStyles/productpage.css');  
and added that css file with my styles in it. The result is the same error about preg_replace being passed a NULL as the third value in line 65 of action.php. My css is not inserted into the product page either. Line 65 of action.php

Code: Select all

 $class = 'Controller' . preg_replace('/[^a-zA-Z0-9]/', '', $this->route); 
seems to be assembling the route to my insertproductpagestyles.php at admin/controller/extension/module/. $this->route seems to be returning null, so my controller is not referenced and my event handler is not called. Is there something wrong with either of these two addEvent lines?

Code: Select all

 $this->model_setting_event->addEvent('insertproductpagestyles', 'catalog/view/common/header/after', 'extension/module/insertproductpagestyles/addproductpagestyles'); 
and

Code: Select all

 $this->model_setting_event->addEvent('insertproductpagestyles', 'catalog/view/product/product/after', 'extension/module/insertproductpagestyles/addproductpagestyles'); 
Is it trying to look for my controller in catalog/controller/extension/module/ instead of in admin/controller/extension/module/ ?
Replace:

Code: Select all

$class = 'Controller' . preg_replace('/[^a-zA-Z0-9]/', '', $this->route); 
with:

Code: Select all

$class = 'Controller' . preg_replace('/[^a-zA-Z0-9]/', '', (string)$this->route); 
As for the rest of the Event controller of your extension, you haven't posted the changes.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Lumirion » Thu May 09, 2024 5:56 am

It is working. Thanks for all the help Straightlight. Here is a link to the zip. https://drive.google.com/file/d/1krWtC ... p=sharing
Once I added a copy of the controller to the same location under the catalog path and switched back to editing the header str_replace worked. I’ll tinker with the addStyle command later but for now this is solved.

New member

Posts

Joined
Fri Apr 19, 2024 1:32 am

Post by straightlight » Thu May 09, 2024 6:48 am

Lumirion wrote:
Thu May 09, 2024 5:56 am
It is working. Thanks for all the help Straightlight. Here is a link to the zip. https://drive.google.com/file/d/1krWtC ... p=sharing
Once I added a copy of the controller to the same location under the catalog path and switched back to editing the header str_replace worked. I’ll tinker with the addStyle command later but for now this is solved.
Now that the issue has been resolved, please add: [SOLVED] at the beginning of the subject line on your first post.

Edit: And now you did. :)

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 2 guests