Post by Robotsky » Fri Jan 22, 2021 10:17 pm

How to show SKU in customer order history - order info?

Newbie

Posts

Joined
Thu Dec 24, 2020 6:24 pm

Post by straightlight » Sat Jan 23, 2021 1:05 am

Robotsky wrote:
Fri Jan 22, 2021 10:17 pm
How to show SKU in customer order history - order info?
By creating an /after event targeting your catalog/view/theme/<your_theme>/template/account/order.twig file.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by kestas » Sat Jan 23, 2021 7:05 pm

straightlight wrote:
Sat Jan 23, 2021 1:05 am
Robotsky wrote:
Fri Jan 22, 2021 10:17 pm
How to show SKU in customer order history - order info?
By creating an /after event targeting your catalog/view/theme/<your_theme>/template/account/order.twig file.
Events in OC are a pretty good idea. Just one little problem, I can't find the right documentation for example, how like this OP query can be properly fulfilled. Could you help by example? Alternatively, can you point to the proper documentation with the examples, how this event on OP request can be done. I'm little bit confused how to properly implement particular code to the php or twig files using events instead the OCMOD. I have read a lot of @straightlight posts where are a lot of good examples of the code how to...
I hope, that can help for others also.
Last edited by kestas on Sat Jan 23, 2021 10:21 pm, edited 1 time in total.

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by xxvirusxx » Sat Jan 23, 2021 8:11 pm

I thinks events are good for complex extensions/module and not just to find and replace something easy.
If you need two controller files for each event...then you need a bunch of controller files for more events.

That's what I understood from here
https://stackoverflow.com/questions/517 ... -twig-file

Extensions converted by me | Custom 3.0.3.7 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by straightlight » Sat Jan 23, 2021 9:04 pm

xxvirusxx wrote:
Sat Jan 23, 2021 8:11 pm
I thinks events are good for complex extensions/module and not just to find and replace something easy.
If you need two controller files for each event...then you need a bunch of controller files for more events.

That's what I understood from here
https://stackoverflow.com/questions/517 ... -twig-file
Or, simply use the $this->load->controller to simplify the task when it comes to several controllers.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by kestas » Sat Jan 23, 2021 10:13 pm

xxvirusxx wrote:
Sat Jan 23, 2021 8:11 pm
I thinks events are good for complex extensions/module and not just to find and replace something easy.
If you need two controller files for each event...then you need a bunch of controller files for more events.

That's what I understood from here
https://stackoverflow.com/questions/517 ... -twig-file
Agree

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by kestas » Sat Jan 23, 2021 10:20 pm

xxvirusxx wrote:
Sat Jan 23, 2021 9:38 pm
Test this
Yes that is OCMOD, but how to accomplish it using events like was suggested by @straightlight?

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by xxvirusxx » Sat Jan 23, 2021 10:33 pm

For that, @straightlight can make the event version :)

And if the OP don't like ocmod version can pay a developer for event version :laugh:

LE. Admin controller should be like this

Code: Select all

<?php
class ControllerExtensionModuleSkuCustomer extends Controller {
	public function install(){
		$this->load->model('setting/event');
		$this->model_setting_event->addEvent('sku_customer', ' catalog/view/theme/default/template/account/order/after', 'extension/module/sku_customer/showSkuCustomer');
	}

	public function uninstall(){
		$this->load->model('setting/event');
		$this->model_setting_event->deleteEventByCode('sku_customer');
	}
}
For catalog controller I need more research :laugh:
So in the end to show SKU on customer order_info you need 3 files: admin controller, admin language, catalog controller.

Extensions converted by me | Custom 3.0.3.7 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by straightlight » Sat Jan 23, 2021 11:23 pm

xxvirusxx wrote:
Sat Jan 23, 2021 10:33 pm
For that, @straightlight can make the event version :)

And if the OP don't like ocmod version can pay a developer for event version :laugh:

LE. Admin controller should be like this

Code: Select all

<?php
class ControllerExtensionModuleSkuCustomer extends Controller {
	public function install(){
		$this->load->model('setting/event');
		$this->model_setting_event->addEvent('sku_customer', ' catalog/view/theme/default/template/account/order/after', 'extension/module/sku_customer/showSkuCustomer');
	}

	public function uninstall(){
		$this->load->model('setting/event');
		$this->model_setting_event->deleteEventByCode('sku_customer');
	}
}
For catalog controller I need more research :laugh:
So in the end to show SKU on customer order_info you need 3 files: admin controller, admin language, catalog controller.
The research that is already built-in would be in the catalog/controller/extension/advertise/google.php with the most details on how to use an /after event .

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by xxvirusxx » Sat Jan 23, 2021 11:26 pm

straightlight wrote:
Sat Jan 23, 2021 11:23 pm
The research that is already built-in would be in the catalog/controller/extension/advertise/google.php with the most details on how to use an /after event .
Tks for info.
I am looking now.

Extensions converted by me | Custom 3.0.3.7 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by paulfeakins » Mon Jan 25, 2021 7:34 pm

straightlight wrote:
Sat Jan 23, 2021 1:05 am
By creating an /after event targeting your catalog/view/theme/<your_theme>/template/account/order.twig file.
Events again?!!!

I guess sometimes when you're holding a hammer, everything looks like a nail :laugh:

As others have said, OCMOD is best for this.

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Guru Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom

Post by straightlight » Tue Jan 26, 2021 9:49 pm

paulfeakins wrote:
Mon Jan 25, 2021 7:34 pm
straightlight wrote:
Sat Jan 23, 2021 1:05 am
By creating an /after event targeting your catalog/view/theme/<your_theme>/template/account/order.twig file.
Events again?!!!

I guess sometimes when you're holding a hammer, everything looks like a nail :laugh:

As others have said, OCMOD is best for this.
That's also probably why OCMod has been removed from the master branch Paul.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by kestas » Wed Jan 27, 2021 4:51 pm

straightlight wrote:
Tue Jan 26, 2021 9:49 pm
paulfeakins wrote:
Mon Jan 25, 2021 7:34 pm
straightlight wrote:
Sat Jan 23, 2021 1:05 am
By creating an /after event targeting your catalog/view/theme/<your_theme>/template/account/order.twig file.
Events again?!!!

I guess sometimes when you're holding a hammer, everything looks like a nail :laugh:

As others have said, OCMOD is best for this.
That's also probably why OCMod has been removed from the master branch Paul.
And in this way about 70% or maybe 90% of the modules will be flushed to the toilet, or they will have to be radically remade
Please correct me if I'm wrong...

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by straightlight » Wed Jan 27, 2021 8:20 pm

kestas wrote:
Wed Jan 27, 2021 4:51 pm
straightlight wrote:
Tue Jan 26, 2021 9:49 pm
paulfeakins wrote:
Mon Jan 25, 2021 7:34 pm

Events again?!!!

I guess sometimes when you're holding a hammer, everything looks like a nail :laugh:

As others have said, OCMOD is best for this.
That's also probably why OCMod has been removed from the master branch Paul.
And in this way about 70% or maybe 90% of the modules will be flushed to the toilet, or they will have to be radically remade
Please correct me if I'm wrong...
If not re-implemented, of course, that's exactly what's gonna happen as there are no correction to be made about this observation.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


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