Page 10 of 16

Re: [RELEASED] Override Engine for OpenCart

Posted: Sat Jul 05, 2014 9:58 pm
by dfumagalli
JNeuhoff wrote:It got fixed from 1.5.6.x onwards. This VQmod issue illustrates why the Override Engine is a better approach to modifying core OpenCart classes :)
Yeah, OE has been really useful to me. I have redefined whole portions of OC (including the whole price management of products, not a small part of OC) also thanks to OE.

And now also thanks to you I can show off my latest milestone 60+ vQMods + OE + Yii in one website 8)
2014-07-05 14_44_55-Yii.png

2014-07-05 14_44_55-Yii.png (43.1 KiB) Viewed 3565 times


I only have to say one little thing that comes to OE's detriment, and it's not OE's fault but more of an Object Oriented Programming long standing issue.

In fact OE shines at customizing "modern code" small functions, the industry is slowly moving towards it. However OC has also areas where one member function is 300 rows of code, in that case using OE just to add say 1 line in the middle of 300 sounds less enticing than just vQModding the line in.

Re: [RELEASED] Override Engine for OpenCart

Posted: Tue Jul 08, 2014 4:59 am
by openmandrake
JNeuhoff wrote:
openmandrake wrote:Hi,

great work! is the override engine somewhere available from a git repository?

best,
No, it's not on a git repository. I find git too user unfriendly, and it tends to be in my way when developing software. However, I am planning on uploading an OpenCart 2.0 fork, with the Override Engine and VQMod included, to my git repository as soon as OpenCart 2.0 is released.

The Override Engine is already done for OpenCart 2.0, just waiting for Daniel to release OpenCart 2.0.
That sounds great! I am currently using the override engine exhaustively! I couldn't think of a nicer way to extend opencart.

Maybe Git is not userfriendly. I don't know, because I use it all the time :)... I only want to point out, that github as such gives people a much better possibility to follow the progress in a project. Cant wait for your fork.

An idea which I had, would be to make a custom composer installer type (eg opencart-override-module). which would allow to install modules simply via command line and integrates dependency resolution for packages. This would also be possible to provide a userinterface within the admin. If nobody else tries out this approach, I will certainly do it when OC 2 will be released...

Re: [RELEASED] Override Engine for OpenCart

Posted: Tue Jul 08, 2014 10:12 pm
by JNeuhoff
An idea which I had, would be to make a custom composer installer type (eg opencart-override-module). which would allow to install modules simply via command line and integrates dependency resolution for packages. This would also be possible to provide a userinterface within the admin. If nobody else tries out this approach, I will certainly do it when OC 2 will be released...
I agree, that would be a great idea. It is possible to install extensions in OpenCart 2.0, including files in the 'override' folder, via ita admin backend, e.g.

admin > Extensions > Extension Installer

However, there is no un-installer yet, nor does it keep track of newly installed files, which it should because no 2 3rd party extensions should try to install a file having the same name.

Re: [RELEASED] Override Engine for OpenCart

Posted: Thu Jul 24, 2014 4:15 pm
by openmandrake
Wouldn't it be great if you could add additional classes as extensions to opencart not just override existing ones! This would allow a clean separation of own modules. Thus, would massively simpify the installation procedure.

I tried to add a controller for the route test/test, which is obviously not in the standard OC. I got the following error: Cannot find controller class file for route 'test/test'...

What to you think about adding an additional fallback to check if there is no class to override, if there is a class inside the override modes with this signature?

What to you think :) ?

Re: [RELEASED] Override Engine for OpenCart

Posted: Thu Jul 24, 2014 6:50 pm
by JNeuhoff
An early test version used to be like that, but it added a significant overhead to the Override Engine, so I ended up just focusing on its main ability to extend existing core classes and override theri methods.

What's really needed is for an installer to keep track of all the additionally installed files, be it in the override folder, or in one of OpenCart's core folders. This would enable an uninstaller to remove the correct files. OpenCart 2.0 is heading in the right direction, but the installer is still insufficient. I have been thinking about creating a proper installer/uninstaller for 3rd party extensions, might implement one when I have some time at hand.

Re: [RELEASED] Override Engine for OpenCart

Posted: Fri Jul 25, 2014 8:57 am
by dfumagalli
Hello again,

I have got an issue with the orders notifications. In case the notification comes from third party back ends (in example, Paypal), the notifications get always sent in English.

I have detailed the whole thing in this post, and have been pointed exactly to the line I have highlighted, which has been customized by Override Engine.

To bring in an example, I have oc_order rows with language_id = 2, with a corresponding oc_language table:

Image

and the order notifications indeed get delivered in the order's language as long as confirm($order_id, $order_status_id, $comment = '', $notify = false) gets called by a payment method that calls it directly from the customer browser (and thus it has got the sessions and variables set).

Does this light up some idea about the cause and a solution?

Best regards

Re: [RELEASED] Override Engine for OpenCart

Posted: Fri Jul 25, 2014 10:18 pm
by JNeuhoff
I think you are talking about the catalog/model/checkout/order.php where the original has this:

Code: Select all

			// Send out order confirmation mail
			$language = new Language($order_info['language_directory']);
			$language->load($order_info['language_filename']);
			$language->load('mail/order');
The version with the Override Engine uses this:

Code: Select all

			// Send out order confirmation mail
			$language = $this->factory->newLanguage($order_info['language_directory']);
			$language->load($order_info['language_filename']);
			$language->load('mail/order');
To narrow down your problem, change it back to the original lines and let me know if you still get the same problem. Then we can see whether this is the issue.

Re: [RELEASED] Override Engine for OpenCart

Posted: Thu Aug 14, 2014 9:59 pm
by ljstorage
Has anyone else had the following problem after installing this?

Fatal error: Class 'Factory' not found in /mysite/index.php on line 63

Which is

$config = $factory->newConfig();
$registry->set('config', $config);

Re: [RELEASED] Override Engine for OpenCart

Posted: Fri Aug 15, 2014 4:10 pm
by JNeuhoff
Your error message is quite clear: You haven't installed the system/engine/factory.php.

Please follow the readme.txt instructions carefully and upload all files!

Re: [RELEASED] Override Engine for OpenCart

Posted: Thu Aug 28, 2014 7:38 am
by alukito
Hi, first of all I'd like to thank you for this extension. It really helped me to fulfill my projects requirement without fiddling with opencart source code.

A couple days ago, my shared hosting upgrade its PHP to version 5.3.29. After that update, my opencart (ver 1.5.5.1) stopped working, it showed blank page only. On my attempt to debug it, I try to change index.php to index.php.original (before override engine), then the home page showed again.

So I looked deeper into what caused the blank page, and I found that after controller->render(), the response was sent with blank content.

I try to upgrade Override Engine to version 2.6.3 for opencart 1.5.5.1, and it still showed the blank page.

Have you encountered this problem? Thank you very much.

Re: [RELEASED] Override Engine for OpenCart

Posted: Thu Aug 28, 2014 6:03 pm
by JNeuhoff
Maybe it is an issue with the variable stream used in the Controller->render ?

Take a closer look at the lines:

Code: Select all

		if ($this->factory) {
			.....
			ob_start();
			.....
			require("var://".$template_id);
			$this->output = ob_get_contents();
			ob_end_clean();
			return $this->output;
		}

Re: [RELEASED] Override Engine for OpenCart

Posted: Fri Aug 29, 2014 7:04 am
by alukito
Hi, you are right, my shared hosting used suhosin for its php and it is blocking variable stream. So, I asked my shared hosting provider to add this line to php.ini

Code: Select all

suhosin.executor.include.whitelist = var
And now it works again :)

Thanks for your help.

Re: [RELEASED] Override Engine for OpenCart

Posted: Tue Sep 02, 2014 6:37 pm
by dfumagalli
Hello again,

is the newest vQMod 2.5 compatible with OE?

Re: [RELEASED] Override Engine for OpenCart

Posted: Tue Sep 02, 2014 9:27 pm
by JNeuhoff
I haven't tested it yet Jay's VQMod 2.5, but I don't see any reason why it shouldn't work with the OE on OpenCart 1.5.x.

As regards OpenCart 2.0: I only tested it with our own VQmod which works fine with the OE.

Re: [RELEASED] Override Engine for OpenCart

Posted: Wed Sep 03, 2014 3:34 pm
by dfumagalli
Ok, thank you!

Re: [RELEASED] Override Engine for OpenCart

Posted: Wed Sep 24, 2014 4:43 pm
by dfumagalli
JNeuhoff wrote:I think you are talking about the catalog/model/checkout/order.php where the original has this:

Code: Select all

			// Send out order confirmation mail
			$language = new Language($order_info['language_directory']);
			$language->load($order_info['language_filename']);
			$language->load('mail/order');
The version with the Override Engine uses this:

Code: Select all

			// Send out order confirmation mail
			$language = $this->factory->newLanguage($order_info['language_directory']);
			$language->load($order_info['language_filename']);
			$language->load('mail/order');
To narrow down your problem, change it back to the original lines and let me know if you still get the same problem. Then we can see whether this is the issue.
Hello,

I had a... let's say "busy" 2 months but in the end I could test this suggestion of yours.

Indeed as soon as I restored the original code, the emails started being delivered in the correct language.

I have noticed a similar issue on my own code that hints at what's going wrong on yours: I had to write a TON of webshop specific rules (several kinds of buyers, each with different terms, documents and emails to send).

These rules would work in a most awesome way as long as the buyers purchased through bank transfer or direct debit but would just disappear when purchasing through Paypal or credit card.

I tracked down the issue in the low level OpenCart callback workings: the bank transfer and direct debit modules call the catalog/model/checkout/order.php functions:

public function confirm($order_id, $order_status_id, $comment = '', $notify = false);

and

public function update($order_id, $order_status_id, $comment = '', $notify = false);

from within the OpenCart context, that is, an OpenCart function calls those functions. And by consequence, the whole OpenCart environment ($_POST, session, cookies) is available to them.


On the contrary, when the Paypal / credit card / whatever modules are used, they do their stuff and then redirect the buyer to a third party payment gateway. The third party payment gateway does not know anything about the current OpenCart environment, it just "strips" everything out. Then, once the payment has been completed, the third party payment gateway calls the above functions as "callbacks"... but hey, as I said, it lost the whole OpenCart context so the callbacks are called without any OpenCart variable, session, cookie.
Therefore, those callbacks must be able to "rebuild" the lost context back up from scratch. That's why there's a whole "new Language" re-initialization. That's why in my code, given the order ID, I too had to restore everything from scratch.

In your case, by using the factory, you are trying to re-use a context that only stays when calling internal payment modules like bank transfer and direct debit. The external gateways destroy ALL including your objects, therefore when the callback is called it calls an uninitialized object. It silently fails, the next calls load translations on a "fresh" language variable which by default starts in English and therefore that's the language that ends up in the order emails.

Re: [RELEASED] Override Engine for OpenCart

Posted: Wed Sep 24, 2014 4:46 pm
by dfumagalli
JNeuhoff wrote:I haven't tested it yet Jay's VQMod 2.5, but I don't see any reason why it shouldn't work with the OE on OpenCart 1.5.x.

As regards OpenCart 2.0: I only tested it with our own VQmod which works fine with the OE.
After 1 week of continued functionality in production code (100+ vQMod XMLs running on current website), I can say OE is compatible with vQMod 2.5 so far.

Re: [RELEASED] Override Engine for OpenCart

Posted: Wed Oct 22, 2014 12:52 pm
by fackiru
Hello, help run the module opencart-2-0-0-0-override-engine-6-4-1 .zip. on net EN version installed this mod, but it refuses to work, wrote me to contact the administrator (You do not have permission to access this page, please refer to your system administrator.)

logs written
2014-10-22 1:05:17 - Can not find controller class file for route 'tool / cvs_export'
2014-10-22 1:06:21 - Can not find controller class file for route 'tool / export'

something I did not complete? tell me that.



Привет, помогите запустить модуль opencart-2-0-0-0-override-engine-6-4-1 .zip. на чистую EN версию установил этот мод, но он отказывается работать, пишет чтоб я обратился к администратору (You do not have permission to access this page, please refer to your system administrator.)

в логах написано:
2014-10-22 1:05:17 - Cannot find controller class file for route 'tool/cvs_export'
2014-10-22 1:06:21 - Cannot find controller class file for route 'tool/export'

я что-то не доделал? подскажите что.

Re: [RELEASED] Override Engine for OpenCart

Posted: Wed Oct 29, 2014 1:43 am
by MrMagoo
Probably I can't understand well how OE works.
Is there an exaustive guide to learn OE?

Thank you.

Re: [RELEASED] Override Engine for OpenCart

Posted: Wed Oct 29, 2014 1:59 am
by JNeuhoff
fackiru: Before you install the Override Engine, go to the admin backend, to Extensions > Modifications, and click on the Clear button near the top right corner. If you already uploaded the Override Engine, remove all folder/files from the system/modification.

After above mentioned step, go to the admin backend at Extensions > Modifications and click on the Refresh button. Now the Override Engine and the OCmod/VQmod should work together just fine.