Title: How To Override JavaScript And Model Files In EasyStore Without Losing Changes After Updates? - Question | JoomShaper
SP Page Builder 6 is Here! Learn More →

Title: How To Override JavaScript And Model Files In EasyStore Without Losing Changes After Updates?

A

Amvimedia

EasyStore 9 months ago

Hello EasyStore Community,

We are using the overrides and custom module concepts in our Joomla project to ensure our customizations persist after updating the EasyStore system. However, we have encountered challenges when working with JavaScript files, API calls, and model files.

Here are the specific files where changes have been made:

JavaScript Files: media/com_easystore/js/product.site.js media/com_easystore/js/cart.site.js Model Files: components/com_easystore/src/Model/OrdersModel.php components/com_easystore/src/Model/OrderModel.php components/com_easystore/src/Model/CartModel.php Email Services: administrator/components/com_easystore/src/Email/EmailManager.php administrator/components/com_easystore/src/Email/EmailService.php administrator/components/com_easystore/src/Email/EmailServiceInterface.php We are aware of the standard override mechanism for templates and certain backend logic. However, overriding JavaScript files, API calls, and model logic seems more complex. Is there a recommended way to safely override these files to make them update-proof?

Specifically, we would like to know:

JavaScript Files: Is there a way to override the JavaScript files (product.site.js and cart.site.js) or hook into the API calls to avoid directly modifying the original files? Model Files: Can model file logic (OrdersModel.php, OrderModel.php, CartModel.php) be extended or overridden like controllers? If not, what is the best practice to customize these files? Email Services: For customizations in email logic (EmailManager, EmailService), how can we implement these changes in a maintainable and update-safe way? Your guidance will help us adhere to best practices and reduce potential conflicts with future updates. Thank you for your support!

0
2 Answers
P
piXelcore
Accepted Answer
9 months ago #178528

Da noch keiner geantwortet hat und unten eine de domain zu sehen ist schreibe ich kurz was dazu auf deutsch. Ich habe das Problem mit einem eigenen Skript gelöst das nach dem Update betreffender Joomla Erweiterungen nach einem Update der Komponenten ausgeführt wird. Da bei jedem neuen Komponenten-Update die Dateien überschrieben werden ist natürlich der eigene eingefügte Code überschrieben und betreffende Dateien ständig per Hand aufsuchen dann den Code per Copy&Paste einfügen macht keinen Sinn. Das eigene Skript wird im Nachgang ausgeführt und erstellt eine Sicherungskopie der Dateien und sucht in den betreffenden Dateien automatisch nach dem Code der verändert werden soll. Das Script fügt an der Stelle den neuen eigenen Code als Beispiel wieder ein (ersetzen, löschen oder auskommentieren alles möglich), quasi ein Patch nach dem update. Vorteil dieser Methode ist das die originale Datei vom Komponenten-Hersteller erst einmal das reguläre Update erhält (könnte ja auch was wichtiges verändert worden sein). Bei dieser Vorgehensweise sollte aber die Seite auf einem Entwicklungs-Server liegen zum testen, wenn alles läuft Update -> Patch dann erst am Produktionsserver (Live-Umgebung) ausführen.

0
Atick Eashrak Shuvo
Atick Eashrak Shuvo
Accepted Answer
Support Agent 9 months ago #178682

Hello Amvimedia,

Thank you for sharing your concerns. We understand the importance of maintaining customizations after updates. Unfortunately, there is currently no way to make changes to core files like JavaScript, models, or email services completely update-proof. Any direct modifications risk being overwritten during updates.

Our development team is actively working on introducing custom hooks to enable more flexible and sustainable customizations, but this will take some time. We sincerely apologize for the inconvenience and appreciate your patience as we work toward a solution.

Thank you for your understanding.

Best regards

0