Post by BinkFour » Fri Apr 20, 2018 7:37 pm

OC Version: 3.0.2.0
Theme: Default
Extension/Mods: VQMOD 2.6.2 / Dutch language

Current situation
After setting up a fresh copy of Opencart 3.0.2.0 I have started to investigate the use of Events. I have read the following sources Goal
Create an event based on this topic: viewtopic.php?t=35611
  • Change the output of function getQuote from flat.php
    // catalog/model/extension/shipping/flat/after
Issue
I am confused ??? at this point on how to register an event.

Questions
  • Does an event always require module files as shown in reference 4?
    Do I need to register an event manually in the database?
    Does an event PHP file need install and uninstall functions?
    This does event manager also support OC 3.0.2.0 looking at the date of the latest update?
Hopefully, my questions are clear and hopefully, someone can explain in simple steps how to register an event making it available on the OC event overview.

Thanks!

New member

Posts

Joined
Mon Jun 10, 2013 1:47 am


Post by straightlight » Fri Apr 20, 2018 7:43 pm

Does an event always require module files as shown in reference 4?
No
Do I need to register an event manually in the database?
The quickest way, yes.
oes an event PHP file need install and uninstall functions?
No. A simple PHP file in event folder would suffice.
This does event manager also support OC 3.0.2.0 looking at the date of the latest update?
Contact the extension developer for this question if the OC version has not been specifically addressed with the extension.

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 BinkFour » Fri Apr 20, 2018 7:50 pm

Great! I will do some testing with manually adding it to the database and post the result and the event file itself.
Thanks!

New member

Posts

Joined
Mon Jun 10, 2013 1:47 am


Post by DigitCart » Fri Apr 20, 2018 9:00 pm

Hi,
If you have not used the event system so far, you can take a look at this free extension of mine.
Although the purpose of this extension is different than your goal, but you can see how an event can be registered and used...
https://www.opencart.com/index.php?rout ... n_id=33336

My Extensions


User avatar
Active Member

Posts

Joined
Thu Jun 22, 2017 5:32 pm


Post by BinkFour » Mon Apr 23, 2018 2:51 am

@Digicart thanks for the reference. I, however, am now under the impression that module files are not required to set up an event. You may correct me if the following set up is wrong and therefore not working.

I have created the following file: /domain/admin/controller/event/shippingrate.php

I have not been able to verify the following code.

Code: Select all

<?php
  class ControllerEventDisableFlatRate extends Controller {
    // catalog/model/extension/shipping/flat/before
    public function disableflatrate(&$route, &$data, &$output){
      if ((float)$this->cart->getTotal() >= $this->config->get('free_total')) {
      	$method_data = array();
      }
    }
  }
Event Information
Trigger

Code: Select all

catalog/model/extension/shipping/flat/before
Action

Code: Select all

event/shippingrate/disableflatrate
I have also added the following for verifying the output.

Code: Select all

echo "lalala".$this->config->get('free_total');
But no result or output.

The error.log has no references on events and I have not seen any other logs related to events.

New member

Posts

Joined
Mon Jun 10, 2013 1:47 am


Post by BinkFour » Fri Jul 06, 2018 7:40 pm

You can find and use the result from the following repository: https://github.com/LybaNL/Opencart_Even ... pping_Rate

New member

Posts

Joined
Mon Jun 10, 2013 1:47 am

Who is online

Users browsing this forum: Amazon [Bot] and 327 guests