Post by OSWorX » Mon Mar 21, 2022 6:06 pm

by mona wrote:
Mon Mar 21, 2022 9:22 am
Thank you, it is not really what I was hoping but it is what I suspected was the case.
In part it is a new way of thinking and approach. I am sure we will get used to it, or not ..
What did you expected or hoped to see?
You want to add 2 headers to the output.
You showed us by doing it by the framework controller via OCMod.
The event does basically the same, but instead when the header is called (which is the same).

by mona wrote:
Mon Mar 21, 2022 9:22 am
The example was just for simplicity. I am pretty sure for OC4 Daniel has added it already.
No, he did not (but you can check that also by yourself if you look at GH and the master branch).

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by straightlight » Mon Mar 21, 2022 7:15 pm


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 by mona » Mon Mar 21, 2022 7:23 pm

@OSWorX - I was hoping for a different kind of workaround to add/edit the framework.php - as an example of a situation that may arise due to anything really, a typo even .. you answered the question great, even more so if I am not correct and it has not been included in OC4 :) (I thought I saw it somewhere it was or has been done, whatever, what will be will be - It is Opencart - It is free and those that be can do whatever they like with their own work - and all I will say is thank you !)

(As always) Your assistance is very much appreciated, direct and to the point and will undoubtedly be very useful in the future, as were the questions asked prior to it. That was actually was a very good way to explain the concept of a previous comment on this thread (something about it is like OCMOD but different) .. the difference is in vqmod/ocmod you look at where Opencart does it and “follow those standards”. Now you look where you want to do it, so you create in many ways more flexibility at the same time as reducing the chances of conflicts. Something like that anyway ..

and thank you straightlight, I did think I had seen it.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by ADD Creative » Mon Mar 21, 2022 8:10 pm

OSWorX wrote:
Mon Mar 21, 2022 6:06 pm
No, he did not (but you can check that also by yourself if you look at GH and the master branch).
He has but only for the catalog side. It's just as important it's added to the admin side, to stop personal information and configuration data (such as SMTP passwords) being stored as plain text in the browser cache (or anything in between). I guess he is alright with that, but some of us like to keep our customer data a bit more secure.

Also don't forget different browsers cache in different ways. There is nothing to say web browsers won't cache more aggressively in the future.

Apologies for going off topic on what I'm sure will be a very useful resource for anyone want to learn OpenCart events.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by OSWorX » Mon Mar 21, 2022 9:21 pm

ADD Creative wrote:
Mon Mar 21, 2022 8:10 pm
OSWorX wrote:
Mon Mar 21, 2022 6:06 pm
No, he did not (but you can check that also by yourself if you look at GH and the master branch).
He has but only for the catalog side. It's just as important it's added to the admin side, to stop personal information and configuration data (such as SMTP passwords) being stored as plain text in the browser cache (or anything in between). I guess he is alright with that, but some of us like to keep our customer data a bit more secure.

Also don't forget different browsers cache in different ways. There is nothing to say web browsers won't cache more aggressively in the future.
You misunderstood me here.
What I have ment, is a (simple) way to add new/various header(s) through the config settings.
Like we do currently with the "robots" and other (tab Server).
If we would have there a new textarea (or lines to add), additional headers could be easely added (when needed).

As well to have the possibility to define where some parts have to be added (header or footer) as this logic is already existing:
https://github.com/opencart/opencart/bl ... t.php#L130
ADD Creative wrote:
Mon Mar 21, 2022 8:10 pm
Apologies for going off topic on what I'm sure will be a very useful resource for anyone want to learn OpenCart events.
Nothing to "apologize" ;D
I am happy the more good OpenCart developers participating here and tell us what they think, they suggest.
And maybe show their solutions.
Because together - I am sure - we will bring it forward.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by OSWorX » Mon Mar 21, 2022 9:26 pm

by mona wrote:
Mon Mar 21, 2022 7:23 pm
@OSWorX - I was hoping for a different kind of workaround to add/edit the framework.php ..
Events itself have (currently) no access to library files (or similiar in the system folder as whole).
Should be discussed with Daniel - when there is a need for "manipulating" such files there.

Guess he does not allow it, because of Security reasons - which would make sense when we look as some "extensions / modules / templates / themes" and what some of them are doing!

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by ADD Creative » Tue Mar 22, 2022 1:46 am

OSWorX wrote:
Mon Mar 21, 2022 9:21 pm
You misunderstood me here.
What I have ment, is a (simple) way to add new/various header(s) through the config settings.
Like we do currently with the "robots" and other (tab Server).
If we would have there a new textarea (or lines to add), additional headers could be easely added (when needed).

As well to have the possibility to define where some parts have to be added (header or footer) as this logic is already existing:
https://github.com/opencart/opencart/bl ... t.php#L130
I see I have misunderstood and now see what you are saying. Anyway the cache control is not really something to be left to store owners, it's just fundamental basics of a secure web application. But that's a topic for another day.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by mikeinterserv » Wed May 04, 2022 10:22 pm

Here is an updated extension for basic quotations request.
It is based on an event and will install as a module that you can install / uninstall from extensions / modules / MW OC Quotes Button.
Example code in relation to this thread.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by straightlight » Thu May 05, 2022 3:56 am

I like the idea but may need some improvement on that package ...

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 straightlight » Thu May 05, 2022 7:29 am

In addition, </body> does not exist in product.twig file from the catalog but only in the footer...

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 straightlight » Thu May 05, 2022 8:06 am

$search2 is used but I don't see it validated anywhere afterwards.

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 straightlight » Thu May 05, 2022 5:44 pm

I expanded the extension a bit to provide the basic idea.

Attachments


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 www-root » Wed Apr 12, 2023 2:51 pm

Hello! Can you tell me how to modify PHP files through events (OpenCart 3)? For example, when editing an order, https://i.imgur.com/vxA1whA.png
Thank you in advance!

Newbie

Posts

Joined
Wed Apr 12, 2023 2:40 pm

Post by straightlight » Thu Apr 20, 2023 7:56 am

www-root wrote:
Wed Apr 12, 2023 2:51 pm
Hello! Can you tell me how to modify PHP files through events (OpenCart 3)? For example, when editing an order, https://i.imgur.com/vxA1whA.png
Thank you in advance!
Editing an order with Events are already provided from this documentation on how to accomplish this: https://github.com/opencart/opencart/wiki/Events-System .

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 www-root » Fri Apr 21, 2023 3:20 pm

straightlight wrote:
Thu Apr 20, 2023 7:56 am
www-root wrote:
Wed Apr 12, 2023 2:51 pm
Hello! Can you tell me how to modify PHP files through events (OpenCart 3)? For example, when editing an order, https://i.imgur.com/vxA1whA.png
Thank you in advance!
Editing an order with Events are already provided from this documentation on how to accomplish this: https://github.com/opencart/opencart/wiki/Events-System .
Thank you! but here I can only add data to the before event, and how exactly to change the request, for example: https://imgur.com/vxA1whA
i.e
$this->db->query("DELETE FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
on
$this->db->query("DELETE FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "' AND order_product_id NOT IN(1,2,3)");

Newbie

Posts

Joined
Wed Apr 12, 2023 2:40 pm

Post by straightlight » Fri Apr 21, 2023 11:14 pm

www-root wrote:
Fri Apr 21, 2023 3:20 pm
straightlight wrote:
Thu Apr 20, 2023 7:56 am
www-root wrote:
Wed Apr 12, 2023 2:51 pm
Hello! Can you tell me how to modify PHP files through events (OpenCart 3)? For example, when editing an order, https://i.imgur.com/vxA1whA.png
Thank you in advance!
Editing an order with Events are already provided from this documentation on how to accomplish this: https://github.com/opencart/opencart/wiki/Events-System .
Thank you! but here I can only add data to the before event, and how exactly to change the request, for example: https://imgur.com/vxA1whA
i.e
$this->db->query("DELETE FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
on
$this->db->query("DELETE FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "' AND order_product_id NOT IN(1,2,3)");
With Events, it cannot be changed. It can only be added to complete an action whether it's before or after.

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 24 guests