Post by bvdberg » Sat Nov 28, 2015 7:46 pm

Hi,

I'm trying to install related options extension on my open cart (fresh install 2.1.0.1).

This extensions uses ocMod to make a modification on
admin/model/catalog/product.php

The problem is that in my frontend I get Undefined index: reviews in /catalog/controller/product/product.php
My question is:
1. How is it possible that the frontend controller loads the admin product model?

I've modified the install.ocmod.xml so that there are no real changes done (only comment). Still the problem exists. Apparantly when OcMod places a file in system/modification/admin/model/catalog/product.php it gets loaded by
/catalog/controller/product/product.php ???

Any help is welcome..

Bas

Newbie

Posts

Joined
Wed May 12, 2010 2:55 am

Post by OSWorX » Sat Nov 28, 2015 9:02 pm

If you have modified the .xml-file, you should know what it is doing in real.
And which files are copied to the server and what they are doing.

Since OC 2.x is out and OCMod exists (before OC 1.5. and VQMod), I have never saw such a behaviour.
Backendfiles are operating only in the backend, frontend only in the frontend.
Maybe there is a helper file (like I like to use inside some of my modules) which as adding/changing more?

And when you have edited the .xml, have you also refreshed the cache?

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


User avatar
Administrator

Posts

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

Post by IP_CAM » Sat Nov 28, 2015 11:59 pm

as I look at this:

OcMod only uses DEFAULT Files, to use 'em as Source, to then be placed, in the modified Version, within the
SYSTEM/STORAGE/... Subsection, like shown on the image, similar to VqMod-modified files, beeing placed in, and later called out of the VqMod/VqCache/... Subsection.

The VqCache-File Title represents the real path to the (Source) File, and with OcMod, a real, but OcMod-ified, Copy of the (Source) File is placed in the correct Source File Subdirectory, but then located in the System/Storage/... - Section.
Seemengly, but due to lack of personal experiences/care, I can only guess... 8)

Meaning, that, basically, one could take (a) modified File(s) out of this Section, and replace the Default Source File(s) with it, then, the Mod(s) would already be Part of the Default Source... ;)

because this would then be a real speedy Solution for 'loop-less' Top Shop Performance, if one ever has a final enhanced and mocked up Version ready to hit the real World. And very easy to do as well...

Am I far off track ?
Ernie
hitline.info/shop/

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by bvdberg » Sun Nov 29, 2015 6:55 pm

@OsWorx: Yes I refreshed the cache. Otherwise the files would not exist under modification folder. The problem is not in the contents of the OcMod XML, because I deleted all changes. The problem is that when I use OcMod, the frontend uses the admin model.

@IP_Cam: I looked in SYSTEM/STORAGE/ folder. but there is nothing there. Only some index.html files with nothing interesting. I don't think that is the right direction for a solution. And what do you mean by : OcMod only uses DEFAULT Files?

Could you maybe help me debugging this? For example. I read that engine/loader.php loads the model in the controller. And maybe it has some logic that makes it go to the admin model? Is it normal that this file exists under modification folder as well? ( modification/system/engine/loader.php ( and action.php).
Where to start?

Bas

Newbie

Posts

Joined
Wed May 12, 2010 2:55 am

Post by bvdberg » Sun Nov 29, 2015 10:03 pm

I've found the cause of my problem.
In /system/startup.php there is the following code:

Code: Select all

// Modification Override
function modification($filename) {
	if (!defined('DIR_CATALOG')) {
		$file = DIR_MODIFICATION . 'catalog/' . substr($filename, strlen(DIR_APPLICATION));
	} else {
		$file = DIR_MODIFICATION . 'admin/' .  substr($filename, strlen(DIR_APPLICATION));
	}
Apparantly the existence of DIR_CATALOG in your config.php determines whether OcMod loads admin or catalog modifications.

As I already mentioned I did a fresh install using Installatron, which created a config.php file that contained a definition of DIR_CATALOG.
To be precise, this was the code in \config.php:

Code: Select all

define('DIR_CATALOG', '/home/public_html/2016/catalog/');
define('DIR_APPLICATION', DIR_CATALOG);
After changing this into

Code: Select all

define('DIR_APPLICATION',  '/home/public_html/2016/catalog/');
the problem was solved. OcMod no longer loads Admin models in the frontend.

Newbie

Posts

Joined
Wed May 12, 2010 2:55 am

Post by OSWorX » Mon Nov 30, 2015 12:50 am

bvdberg wrote:As I already mentioned I did a fresh install using Installatron, which created a config.php file that contained a definition of DIR_CATALOG.
No, you did not ..
The only you did was:
I'm trying to install related options extension on my open cart (fresh install 2.1.0.1).
And that's a 'small' difference, because the original installer does not add this line:

Code: Select all

define('DIR_APPLICATION', DIR_CATALOG);

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


User avatar
Administrator

Posts

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

Post by bzark » Wed Dec 02, 2015 1:47 am

Reference this forum post to fix your issue.

viewtopic.php?f=191&t=154782#p592030

New member

Posts

Joined
Wed Oct 01, 2014 10:32 pm
Who is online

Users browsing this forum: No registered users and 2 guests