Joomla <-> G2 <-> Zencart and useralbum module

drhiii

Joined: 2003-04-27
Posts: 397
Posted: Wed, 2011-08-17 03:00

In the last few days have been able to bolt together thanks to Dayo's excellent JoomG2 and ZCG2 bridge code, all three apps. Meaning Joomla, G2 and Zencart. And with the assistance of a knowledgable G2 user too who rang in a provided guidance a couple days ago, it all is working. It is quite excellent to see these three apps bridged together.

There is one skid mark. Autocreation of albums after a user registers in Joomla. It works just fine when Joomla and G2 and bolted together. However, when Zencart is enabled in G2, it hangs. Follows is some brief advice received about this that best describes the likely problem:

"I can see a few potential problems with the ZCG2 and UserAlbum modules. ZCG2 tries to add every new album to ZC as a category for sale. In theory it should be able to handle the auto album generation by user albums but the User album module probably does some things with permissions that causes a conflict with the standard ZCG2 configuration."

Anyone take a stab at where to start, what to look at, to break this logjam? I am a network security bloke and code is not in my skillset, hence why I ask. If anyone has at least an opinion of where to start, and what a roadmap might be to solve this, let's engage.

As a further fyi, if the function was as a one-off site, meaning multiple users in Joomla but only a handful of people who needed to admin albums, this would not be a prob. But the aspiration is towards bringing up a community of people hence the need to autocreate albums becomes important. Handcrafting user albums would be a drag...

tx for any response...

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2011-08-17 04:30

Here's a thought.
Several years ago I modded the user albums module to allow a template album to be cloned as the new user's album.
The mod copied the template albums params and content.
Maybe you setup a template album w/ the proper zen cart permissions/params.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Wed, 2011-08-17 04:45

Hmmmmm. Thinking....

Hmm. I installed your mod to see the cloning in action and it is excellent. You have sparked an idea, yes.

suprsidr wrote:
Here's a thought.
Several years ago I modded the user albums module to allow a template album to be cloned as the new user's album.
The mod copied the template albums params and content.
Maybe you setup a template album w/ the proper zen cart permissions/params.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Wed, 2011-08-17 05:22

All this needs is a little debuging to see where the conflict is as, in theory, there should be nothing particular to that setup that should stop things from working.

I am working out of station for the next three weeks or so and can't get to my "Development Mac" at home so can't chip in. I suggest you look for the handle event function in the zcg2 module.inc and work your way down the code logic.

A lot of people say they are not programmers so can't tackle stuff but I for instance am certainly not a programmer but have been bloody minded enough to take time to work through code and use google until I am able to find an answer.

Over time, I have learnt stuff that makes it easier but when I took on ZCG2 for instance, I didn't know how to write a line of PHP. However, it was an existing module that had fallen out of date and I felt by systematically working through the code, I could figure out how to bring it up to date and add enhancements to it which is what I was able to do.

This is what I would do to resolve this and anyone can solve these sorts of issues. It is just a matter of having the will to do it as it can take time:

1. Add a line saying die('Got Here without Crashing/Hanging'); to beginning of the bit of the code in the handle event function that deals with the "save" event. A look at the code should ID both the function and aspect that deals with the save event.

2. Iteratively create a user in UserAlbums and move the "die line" down until you hit where it crashes without your text showing.

You should vary the text a bit between attempts so as to know you are not loading something from a cache.

Actually, I usually use "die('a')" and "die('b')" alternatively.

As said, I can't look at the code to check where the likely crash point is as I just have my company laptop with me and not setup to check useralbums easily anyway.

When you find out the crash point, post the line which may lead us to another place to go debug or might reveal the issue directly.

I can only visit here sporadically but others might be able to ID the issue if you find the crash point.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Wed, 2011-08-17 21:07

Dayo,

I will do as you instruct. Just having a start point with a technique or two to debug is extremely helpful. I will do exactly as you say and report back... and in the meantime, start boning up on PHP.

thank you

Dayo wrote:
All this needs is a little debuging to see where the conflict is as, in theory, there should be nothing particular to that setup that should stop things from working.

I am working out of station for the next three weeks or so and can't get to my "Development Mac" at home so can't chip in. I suggest you look for the handle event function in the zcg2 module.inc and work your way down the code logic.

A lot of people say they are not programmers so can't tackle stuff but I for instance am certainly not a programmer but have been bloody minded enough to take time to work through code and use google until I am able to find an answer.

Over time, I have learnt stuff that makes it easier but when I took on ZCG2 for instance, I didn't know how to write a line of PHP. However, it was an existing module that had fallen out of date and I felt by systematically working through the code, I could figure out how to bring it up to date and add enhancements to it which is what I was able to do.

This is what I would do to resolve this and anyone can solve these sorts of issues. It is just a matter of having the will to do it as it can take time:

1. Add a line saying die('Got Here without Crashing/Hanging'); to beginning of the bit of the code in the handle event function that deals with the "save" event. A look at the code should ID both the function and aspect that deals with the save event.

2. Iteratively create a user in UserAlbums and move the "die line" down until you hit where it crashes without your text showing.

You should vary the text a bit between attempts so as to know you are not loading something from a cache.

Actually, I usually use "die('a')" and "die('b')" alternatively.

As said, I can't look at the code to check where the likely crash point is as I just have my company laptop with me and not setup to check useralbums easily anyway.

When you find out the crash point, post the line which may lead us to another place to go debug or might reveal the issue directly.

I can only visit here sporadically but others might be able to ID the issue if you find the crash point.

--
dakanji.com

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Thu, 2011-08-18 07:08

Hi.

The debug process I tried to explain is not a big deal and it should be possible to grab someone at random off the street, explain the steps to them and they should be able to do it. No need to study php or know any programming at all.

I think that the view that some of these sorts of things is a big deal stops many from having a go but it is just a simple process of elimination and all that is needed is the patience and determination to work through it. So just carry out the debug process, which I hope I explained clearly, and post your findings here.

In simple terms, you need to add a line that will terminate a script with a flag successively after lines of prewritten php.

Say you have 10 lines of php code as so....

Line 01
Line 02
Line 03
...
Line 09
Line 10

You add your die flag and trigger the action that caused the crash.

Line 01
die('a')
Line 02
Line 03
...
Line 09
Line 10

if you see 'a' in your browser, then you know Line 01 executed without issue so you change to

Line 01
Line 02
die('b')
Line 03
...
Line 09
Line 10

and so on until the crash happens which will mean it was the line immediately before the die flag that was the issue.

Post that here and we will see what needs to be done.

If you need clarification, post a query and people should be able to answer.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Thu, 2011-08-18 08:03

Yes, I understand exactly what you are saying here. I will sit down and work through this process tmrw eve. The process is clear. Reason I mentioned learning more into PHP is, well, I need to. I used to program and created some sophisticated stuff, but that was awhile ago. I just never kept with it is all.

This is worthy tho and I have almost all of the pieces of this model working, except for the autocreation aspect, and a not quite related migration of fields from one Joomla app to another. I just need to hunker down and be able to do it.

I will report back as soon as I have crawled through this debugging process. It is straight forward, yes sir.

thankx

Dayo wrote:
Hi.

The debug process I tried to explain is not a big deal and it should be possible to grab someone at random off the street, explain the steps to them and they should be able to do it. No need to study php or know any programming at all.

I think that the view that some of these sorts of things is a big deal stops many from having a go but it is just a simple process of elimination and all that is needed is the patience and determination to work through it. So just carry out the debug process, which I hope I explained clearly, and post your findings here.

In simple terms, you need to add a line that will terminate a script with a flag successively after lines of prewritten php.

Say you have 10 lines of php code as so....

Line 01
Line 02
Line 03
...
Line 09
Line 10

You add your die flag and trigger the action that caused the crash.

Line 01
die('a')
Line 02
Line 03
...
Line 09
Line 10

if you see 'a' in your browser, then you know Line 01 executed without issue so you change to

Line 01
Line 02
die('b')
Line 03
...
Line 09
Line 10

and so on until the crash happens which will mean it was the line immediately before the die flag that was the issue.

Post that here and we will see what needs to be done.

If you need clarification, post a query and people should be able to answer.

--
dakanji.com

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Thu, 2011-08-18 12:54

Cool. Let us know how it goes.

BTW, you can use the "reply" link when you want to respond to posts ... so that the whole of the post you are responding to is not repeated every time you respond to something if there isn't something specific you want to repeat.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Sat, 2011-09-03 22:25

Ok, finally had quality time to focus down on this. I began with the module.inc in useralbums per Dayo's instruction and from the first pass at it knew the process was not making it that far. I actually had a feeling it was not making it to 'useralbums' before this because I would DeActivate 'useralbums' in plugins and it would hang regardless of whether 'useralbums' was active or not. So I sensed this was happening before it ever reached this part of the code.

This is an important part of this debugging puzzle too... no matter whether 'useralbums' was active or not, a new user created under Joomla would not drop down into G2 as long as Zencart was also Active. If I DeActivated ZenCart via ZCG2 in the plugins, things worked just fine, all the way to useralbums and the autocreation of the user's album. That works. The instant ZCG2 is Activated, a new user in Joomla hangs when dropping into G2 and the following code is where it hangs. Once an new user's album is created, I can Activate ZCG2 and everything works well from that point.

Anyway, I backtracked and thought to start from the beginning. Am glad I did... for the process for a new user never made it out of index.php. Below is where it failed. I will also start working my way through what this event means. Am just now learning the logic of all this so as you said Dayo, it just takes commitment to dig in and learn it.

In the meantime, if anyone has any thoughts...

Off top of my head, and I am not at all sure, but would this have anything to do with cookies? When it hits this line of code, the whole screen blanks and hangs. I have cookies set to / in the G2 under the Admin Options/General menu. I will mess with the second 'domain' field as well. But, any thoughts?

Follows is the index.php from the G2 root...

* This script will just redirect to main.php
* The Location header requires an absolute url to conform with HTTP/1.1
* @package Gallery
* @author Bharat Mediratta <bharat@menalto.com>
* @version $Revision: 17580 $
*/

/* Include bootstrap.inc in case config.php overrides GALLERY_MAIN_PHP */

require_once(dirname(__FILE__) . '/bootstrap.inc');
require_once(dirname(__FILE__) . '/modules/core/classes/GalleryUrlGenerator.clas
s');
require_once(dirname(__FILE__) . '/modules/core/classes/GalleryCoreApi.class');

/* The REQUEST_URI can either be /path/index.php or just /path/. Get rid of inde
x.php.* */
$path = GalleryUrlGenerator::getCurrentRequestUri();
if (preg_match('|^(/(?:[^?#/]+/)*)(.*)|', $path, $matches)) {
$path = $matches[1] . GALLERY_MAIN_PHP;
if (!empty($matches[2]) && ($pos = strpos($matches[2], '?')) !== false) {
$path .= substr($matches[2], $pos);
}
}

$configBaseUri = @$gallery->getConfig('baseUri');

$urlGenerator = new GalleryUrlGenerator();
$urlGenerator->init(!empty($configBaseUri) ? $configBaseUri : null);

$phpVm = $gallery->getPhpVm();

****It works to this points*****

$phpVm->header('Location: ' . $urlGenerator->makeUrl($path));

die('Got Here without Crashing/Hanging'); *** the above line is where it fails ***

?>

Dayo wrote:
Cool. Let us know how it goes.

BTW, you can use the "reply" link when you want to respond to posts ... so that the whole of the post you are responding to is not repeated every time you respond to something if there isn't something specific you want to repeat.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Sat, 2011-09-03 23:11

As an FYI, I do not have modsec, snort or other tight security tools running on the test site. The hangups have the similar feel as a IDS blocking rule. This is not the case here until things get ironed out.

And nothing shows up in the apache logs when the newuser event that triggers all this hangs. So logs have not revealed anything yet.

tx

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Sun, 2011-09-04 04:31

You ran the debug on index.php and if you look the top of the file, included in your post above, it says, "This script will just redirect to main.php".

Index.php in G2 simply sends users to main.php which actually calls the modules that do the work etc. The crash point in your debug is simply the line where the user is redirected to main.php. Not surprisingly, the flow never gets back and since we already suspect that it crashes in the zcg2 module there is no need to go all the way back to the start of the g2 flow and we can go right narrow down the start point for the process.

This is why, when we discussed the debugging before, I said to "...look for the handle event function in the zcg2 module.inc and work your way down the code logic".

So, open the zcg2 module.inc file where you will find a handle event function. Within that function you will find "case 'GalleryEntity::save':". The code between that line and the following "break" is what should get run when a new album is created and if the crash is the zcg2 module, it will be happening here. This is where you need to debug.

Put your first "die" after "case 'GalleryEntity::save':".

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Sun, 2011-09-04 23:45

Dayo, thank you for the response. And, you are correct. What I had done was start in on the useralbum module, and module.onc in there, and when it failed from the first line, I went to the beginning. I see did not read your instructions properly as I needed to start in the zcg2 or modules/zencart code. I went to the wrong module. My fault.

I did as you instructed and started exactly where you said to place the die code first, and it never made it that far. So I went back to the beginning of the file and walked line by line until I determined exactly where it failed. Again, am learning how this is all put together...

I have posted the snippet of code below which is at the beginning of the file, indicating how far it got and then where it failed... am trying to learn what this all means, at the beginning of this module.inc in the zencart module....

/**
* This module integrates Gallery 2 with Zen Cart 1.3.9.
*
* @package ZenCart 1.3.9
*/
class ZenCartModule extends GalleryModule {
function ZenCartModule() {
global $gallery;

$this->setId('zencart');
$this->setName($gallery->i18n('Zen Cart'));
$this->setDescription($gallery->i18n('G2<->ZC Bridge'));
$this->setVersion('3.3.3b');
$this->setGroup('commerce', $gallery->i18n('Commerce'));
$this->setCallbacks('getSiteAdminViews|registerEventListeners|getItemLinks');
$this->setRequiredCoreApi(array(7, 18));
$this->setRequiredModuleApi(array(3, 5));
die('Got Here without Crashing'); ***** It worked this far ***
}

die('Got Here without Crashing'); ***** And here is where it failed ****

Dayo wrote:
You ran the debug on index.php and if you look the top of the file, included in your post above, it says, "This script will just redirect to main.php".

Index.php in G2 simply sends users to main.php which actually calls the modules that do the work etc. The crash point in your debug is simply the line where the user is redirected to main.php. Not surprisingly, the flow never gets back and since we already suspect that it crashes in the zcg2 module there is no need to go all the way back to the start of the g2 flow and we can go right narrow down the start point for the process.

This is why, when we discussed the debugging before, I said to "...look for the handle event function in the zcg2 module.inc and work your way down the code logic".

So, open the zcg2 module.inc file where you will find a handle event function. Within that function you will find "case 'GalleryEntity::save':". The code between that line and the following "break" is what should get run when a new album is created and if the crash is the zcg2 module, it will be happening here. This is where you need to debug.

Put your first "die" after "case 'GalleryEntity::save':".

--
dakanji.com

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Mon, 2011-09-05 05:48

If that line is what is crashing it, then it should crash whether the useralbum module is active or not.

Anyway, that is a standard G2 API call and it does work.

So there is something else wrong. Missing files in your installation perhaps?

***EDIT***

Just rereading your post. It is the "}" that is crashing it. So basically, it crashes as soon as zcg2 loads. Hmmm. Need to think about that one ... nothing springs to mind immediately apart from that there is some conflict between the two modules.

Blank php pages invariably leave an entry in the server logs. Clear the log, run again and post entry or entries.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Mon, 2011-09-05 06:34

Hello Dayo,

Yes, this is what is perplexing. I was hoping that it would fail at the 'save' function, but as I sensed, it was failing before that and the line by line debug indicated it was well before.

As for missing files, I am 99.99999% certain that no, no missing files. Reason for saying that is I have reinstalled from scratch many times just to make sure I am not introducing an install or configuration error. It is the same behaviour no matter what I do. I have purposely installed carefully, Joomla from 0, G2 from 0, then Zencart from 0, making sure each one is working sequentially. Then I bolt in JoomG2 and then ZCG2. Testing each step over and over. I have done this without altering or adding anything except the bare minimum configurations to get each layer talking and minimize the possibility of a module or plugin conflict. Same behaviour, and have repeated the slow, careful install from ground up many times. I am as certain as I can be that there are no missing files.

And you are correct... I have Activated and Deactivated 'useralbums'. Same behaviour. This is why I felt it was never reaching that far in the first place.

What does work is when I DeActivate ZCG2, then create a new user in Joomla (I can create a new user in Joomla first then DeActivate ZCG2, is the same), but once deActivated, I can drop down into G2, and it all works. All the way to the autocreation of the user album. I ReActivate GCZ2 and the user works from there. Can log off, log on, move between Joomla, G2 and ZenCart, no problem.

I make sure I remove cookies so they are recreated each time I log in... in every possible scenario. That has had no effect.

I am looking at the code over and over to try and understand how it works. But that is why it is a bit perplexing because when Joomla + G2 are tied through JoomG2, and I perform the DeActivation of ZCG2, a new user can drop down into G2 and all works fine. I am really trying to understand what the code is saying however. As you say, this is a standard G2 API call and by appearances it should work. Why it fails at that particular point, well... that is what I am trying to understand. Everything else is beautifully seamless.

I appreciate your eyes and thought on it.

david

Dayo wrote:
If that line is what is crashing it, then it should crash whether the useralbum module is active or not.

Anyway, that is a standard G2 API call and it does work.

So there is something else wrong. Missing files in your installation perhaps?

***EDIT***

Just rereading your post. It is the "}" that is crashing it. So basically, it crashes as soon as zcg2 loads. Hmmm. Need to think about that one ... nothing springs to mind immediately apart from that there is some conflict between the two modules.

Blank php pages invariably leave an entry in the server logs. Clear the log, run again and post entry or entries.

--
dakanji.com

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Mon, 2011-09-05 11:10

Look at my earlier comment on the server logs and post these.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Mon, 2011-09-05 23:23

I turned on verbose logging and here is something that showed up that had not seen before. The first are just warnings but the third line is a fatal error.

This is just a guess after looking at line 403 of the ZC module.inc, but is perhaps in the flow of all this, is Zencart trying to create a user from the G2 tables before a new user has been created in G2 by JoomG2? (I know this is a stupid joke but I couldn't resist... maybe a Cart before the horse as in a zenCART before JoomG2 user creation horse?)

The admin passwords are the same per the installation instructions in JoomG2, and it of course works if the Zencart module is temporarily deActivated, then reActivated after JoomG2 does its thing.

[Mon Sep 05 16:35:43 2011] [error] [client 11.22.11.22] PHP Warning: max() [<a href='function.max'>function.max</a>]: Array must contain at least one element in /home/xyz/m/cms/photos/modules/tags/classes/TagsHelper.class on line 461, referer: http://www.aabbcc.com/administrators/login
[Mon Sep 05 16:35:43 2011] [error] [client 11.22.11.22] PHP Warning: min() [<a href='function.min'>function.min</a>]: Array must contain at least one element in /home/xyz/m/cms/photos/modules/tags/classes/TagsHelper.class on line 462, referer: http://www.aabbcc.com/administrators/login
[Mon Sep 05 16:35:43 2011] [error] [client 11.22.11.22] PHP Fatal error: Call to undefined method GalleryZenCart::createZencartUserFromG2() in /home/xyz/m/cms/photos/modules/zencart/module.inc on line 403, referer: http://www.aabbcc.com/administrators/login

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Tue, 2011-09-06 04:22

The modules in G2 do not fire off at random. The zencart module reacts to an event, which is that a user has been created before running and the error message shows that it is at least trying to do so as expected.

The error in the log also flagged two things:
1. As I should have noted, when you said the process crashed before you got to "case 'GalleryEntity::save':", going to the top of the file was in error as that is not how things work.
2. You must have made a mistake in the debugging as the process does run through the 'GalleryEntity::save' process as expected. The call to GalleryZenCart::createZencartUserFromG2() on Line 403 only gets called after 'GalleryEntity::save' is triggered.

I suspect you may have put the line immediately above "case 'GalleryEntity::save':" which would have triggered a php error by itself and then went on to the top of he file etc which was a distraction in this case.

I need to rush off and will get back later.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Tue, 2011-09-06 05:42

Hi Dayo, tx for staying with this.

I went back and ran the tests again. The first time I did it a few days ago, as you instructed placed the die line directly after the "case 'GalleryEntity::save':" in ZCG2's module.inc. I cleared caches, cookies, making sure everything was clean. It never made it to the first location you recommended. That's why I went backwards in the file and ended up where I did.

However, in repeating it all this eve, placing the die command directly behind the "case 'GalleryEntity::save':", this time it made it. Was confused since I did it the exact same way, but as you say, I had to have made a mistake.

Regardless, I proceeded down the file. It did not take long. It failed three lines later as detailed below on line 353. It worked to line 352. I swear this was not the behaviour I had when I first did this per your instructions but that is not important now. Follows is how far it made it when running it this eve.

From Zencart module.inc:

/**
* Event handler for the GalleryEntity::save and GalleryEntity::delete events.
* Adds, updates, or deletes Zen Cart products and categories.
*
* @see GalleryEventListener::handleEvent
*/
function handleEvent($event) {
GalleryCoreApi::requireOnce('modules/zencart/classes/GalleryZenCart.class');
$zenCart = new GalleryZenCart();
$ret = $zenCart->init('AdminMode');
if ($ret) {
return array($ret, null);
}
switch ($event->getEventName()) {
case 'GalleryEntity::save':
$entity = $event->getEntity();
THIS MADE IT --> die('Got Here without Crashing/Hanging');
if (GalleryUtilities::isA($entity, 'GalleryAlbumItem')) {
THIS FAILED (on line 353) ---> die('Got Here without Crashing/Hanging');
if ($entity->testPersistentFlag(STORAGE_FLAG_NEWLY_CREATED)) {
list ($ret) = $zenCart->addAlbumAsCategory($entity);
if ($ret) {
return array($ret, null);
}

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Tue, 2011-09-06 06:02
Dayo wrote:
The modules in G2 do not fire off at random. The zencart module reacts to an event, which is that a user has been created before running and the error message shows that it is at least trying to do so as expected.
dakanji.com

Also in response to the above, yes, am trying to understand how all this works in sequence. What events trigger what subsequent events.

This is why I mention that a user is never created in G2 when it fails. Only when I disable Zencart, then drop down from Joomla to G2 for the first time, then a user is created. As long as Zencart is active and a new user that has been created in Joomla tries to drop into G2 for the first time, the user is never added in G2. It fails first. And this is true whether useralbums are active or disabled.

Just thought to add the above behaviour.

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Tue, 2011-09-06 06:41

Thanks for the feedback.

Will get back later.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Tue, 2011-09-06 07:34

Yessir.

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Tue, 2011-09-06 20:58

Hi,

It would appear from your subsequent reports that you did not make a mistake in positioning the debug line. However, I can't figure out what might be wrong as your reports suggest four different crash points for four different test runs.

Since there doesn't appear to be a specific identifiable problem point, trying to figure out the problem is like taking a stab in the dark.

I can't offer any more suggestions at this point. Flummoxed.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Tue, 2011-09-06 22:57

Ok, understand. I will work through it and see how to solve this. Tx for your input...

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Wed, 2011-09-07 08:01

Dayo, one other question, then will leave ya alone. Figured I'd give it a go as you know Zencart.

Did you have any difficulty adding a Tax class in Zencart to all items that are added through the ZCG2 module? Am trying to add a single tax class that applies to all items that are created in G2 and am not finding where to add the tax class to all items on the ZC side.

tx

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Wed, 2011-09-07 13:36

Hi.

Keep the question flowing. I'll respond as long as I know the answer.

Can't recollect the exact process but these tutorials from the ZC site might help

http://tutorials.zen-cart.com/index.php?article=76
http://tutorials.zen-cart.com/index.php?article=78

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Wed, 2011-09-07 22:57

Ok. Will do. Am obsessed with solving the solving the album autocreation issue so will impart info once solved.

The tax thing is too easy but there is a missing element that I will now have to go to the ZC forums to see if someone can spot what's missing. Have followed the ZC tutorials but to no avail.

tx for your continued response.

Dayo wrote:
Hi.

Keep the question flowing. I'll respond as long as I know the answer.

dakanji.com

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Thu, 2011-09-08 17:48

Hi,

Just went back to look at your post with a clearer head and noticed that the failure point you posted was an "if" statement. I had thought it was the the "$entity = $event->getEntity()"

drhiii wrote:
....
case 'GalleryEntity::save':
$entity = $event->getEntity();
THIS MADE IT --> die('Got Here without Crashing/Hanging');
if (GalleryUtilities::isA($entity, 'GalleryAlbumItem')) {
THIS FAILED (on line 353) ---> die('Got Here without Crashing/Hanging');

Actually, the code did not crash on the indicated line. Remember that "if" is conditional. When you put a "die" directly after an "if" statement and it doesn't get called, it simply means that block of code did not run. You need to continue the debugging after the "if" block.

Anyway, looking at the zcg2 code, I recollect that I left it in a state where some stuff I was working on was still experimental and not pushed into the released version. It was to create new users in ZC when added to G2. It ties into the error log you posted before on "Call to undefined method GalleryZenCart::createZencartUserFromG2()". That did raise an eye brow from me at the time but as I wasn't able to go in and check, I was hoping a structured debug would tell enough but we got blindsided.

Anyway, upgrade your zc-g2 module to v3.3.4 to resolve the issue.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Fri, 2011-09-09 06:32

Dayo! This is very cool. To come back to it with a different perspective. I understand that.

I understand everything you said concerning the conditional IF statement. My challenge is I am learning how to read this code and follow it. As I am new to it, it is taking time to learn what the IF statement was calling after this. I am applying myself to learning this.

Am also not going to commit the same sloppy reporting errors either. I will go upgrade this and report back, with accuracy.

Know that I appreciate your coming back to it with some new insight. I do not take any of this for granted.

Back as soon as I have an accurate report.

Dayo wrote:
Hi,

Just went back to look at your post with a clearer head and noticed that the failure point you posted was an "if" statement.
Anyway, upgrade your zc-g2 module to v3.3.4 to resolve the issue.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Fri, 2011-09-09 09:37

Dayo,

Here are the results of the upgrade. First the behaviors.

When Zencart is Activated along with JoomG2... then a new user is created... Dropping down into G2 from Joomla WORKS! A new user is created in G2. That works now! This is true regardless of whether 'useralbum' is active of inactive. Way cool.

Once in G2, when clicking on 'Your Album' which by default should take you to a new album if one does not exist, did not work. It did not create a new album for a new user. It did not hang however. This was of course with 'useralbum' active. I tried a variety of settings including When First Accessed, When User First Created, Jump to Album, and so on. No matter the setting, it did not create an album.

The great news is it did create the user in G2. I was able to bypass the auto album creation and manually create the user's album, assign permissions, and that worked. It is a drag to not have the auto album creation not work but, with your current tweak, things have progress MUCH farther down the pipeline. Very cool. Not having to fight the user creation in G2 with ZenCart active is a significant advance.

Deactivating Zencart temporarily of course allowed the user creation and auto album creation to work, then reactivating Zencart let things proceed.

Finally, I carefully ran the debugging exercise and was careful to make sure this is exactly where it failed. It is not random. I repeated this many times to make it crystal clear. Follows is the latest progress on the debugging. It failed on Line 364 of module.inc. I do not understand exactly where it branches to but I am grepping the keywords to try and understand it. It has been extremely helpful with your dipping back into it this additional time because it helped me further understand how things are put together. I have a ways to go, but your coming back this one time really helped advance my understanding. I will be persistent. It is *that* close to working I can see. This is cool stuff to be working on imo.

/* Always update to make sure thumbnails always show up. Should not be neccessary and needs investigation */
$ret = $zenCart->updateCategoryFromAlbum($entity);
if ($ret) {
return array($ret, null);
}
}
IT MADE IT THIS FAR (line 363) --- die('Got Here without Crashing/Hanging');
} else if (GalleryUtilities::isA($entity, 'GalleryDataItem')) {
IT FAILED HERE (line 364) ---die('Got Here without Crashing/Hanging');
if ($entity->testPersistentFlag(STORAGE_FLAG_NEWLY_CREATED)) {
list ($ret) = $zenCart->addItemAsProduct($entity);
if ($ret) {
return array($ret, null);
}

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Fri, 2011-09-09 10:37

Can you check if you can manually create an album when zcg2 is active?

Remove the debug stuff and just see if it goes through.

Thanks

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Fri, 2011-09-09 19:25

Per your request here is the behaviour with ZCG2 Active....

I create a new test user called user34 in Joomla. Then drop down in to G2 and user34 is created successfully in the G2 user base.

If I click on Your Album which calls 'useralbum', it returns by logging user34 out.

HOWEVER, I went to the apache writable directory for 'data.gallery.base' pointed to by G2's config.php and the corresponding directory for user34 is created. It is indeed there!

I relog in as the new user, drop down again into G2 which works, and click Your Album a second time. I receive a Permissions error which is expected.

All this is with ZCG2 Active.

Follows is the screen output:

An error has occurred.

Back to the Gallery
Error Detail -
Error (ERROR_COLLISION) : /xxx/xxx/albums/Test1/user22 already exists

in modules/core/classes/GalleryAlbumItem.class at line 226 (GalleryCoreApi::error)
in modules/core/classes/GalleryAlbumItem.class at line 154 (GalleryAlbumItem::_createDir)
in modules/core/classes/helpers/GalleryItemHelper_advanced.class at line 234 (GalleryAlbumItem::create)
in modules/core/classes/GalleryCoreApi.class at line 1646 (GalleryItemHelper_advanced::createAlbum)
in modules/core/ItemAddAlbum.inc at line 80 (GalleryCoreApi::createAlbum)
in main.php at line 250 (ItemAddAlbumController::handleRequest)
in main.php at line 104
in main.php at line 88

................................................................................

I repeat the whole process above creating a new user called user35. Drop in to G2 but this time I do NOT click on Your Album. Instead I log in as admin and manually create user35 album and assign permissions to it for user35 has full admin rights. This of course works. All this is with ZCG2 Active.

If I try to click Your Album for user35 I expect it to fail and it does since the album already exists. It logs user35 out.

Dayo, I appreciate your putting more eyes on this.

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Fri, 2011-09-09 19:28

Dayo, would it help if I created a test environment for you to log in to? I can install a pristine Joomla-JoomG2-G2-ZCG2-Zencart installation and hand you admin access to it, and also shell access to the filesystem if that would help.

This may be overdoing, but I can also capture video of each event so you see the output. Not long videos, but short clips of each important event or output.

Whatever I can do to provide correct information.

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Fri, 2011-09-09 20:45

OK. Setup the test environment with only an admin user and no others. I'll have a look but it might be a slow process on my part. I suppose we can do things in parallel.

From your explanation of the first case, the user album is created but the user is logged out after clicking the link.

A few things to do/check in order.

1. Send me a copy of the UserAlbums module
2. Despite the errors, are the relevant albums created in ZC?
3. What happens if joomg2 is disabled? I.E. purely in G2 with ZC and UserAlbums, what happens when a new user is created. Basically, do the two play nice with each other before adding the Joomla angle into things?

Please run the three items and then set up the test environment.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Sat, 2011-09-10 08:25

Dayo, I am about 80% completed with a Joomla-JoomG2-G2-ZCG2-Zencart test site. Once completed, I will get all the login and related info for where things were installed, MySql info, and so on...

Once this is done, I will complete the 3 steps you directed in your post and forward a tarball of the useralbum and post results of #2 and #3. Will complete in a few hours.

Whatever it takes will do...

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Sat, 2011-09-10 19:17

Dayo,

Test environment completed. J + JoomG2 + G2 + ZCG2 + ZC

1. Will send useralbums as soon as I acquire your email addr and can post an attachment. Sent a PM with more info to that effect.

2. Yes. The relevant albums are indeed created in ZC. Success.

3. Yes. G2 and ZC play nice together. Tested and retested. Everything, including the use of Useralbums... all work 100%. Success there too.

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Sat, 2011-09-10 22:09

Hi,

Just PM me the ssh details and no need to send UserAlbum ... I'll have a look at the one you have in the setup.

Not yet sure when I'll be looking in yet though. So, to save time, can you confirm on Point 3 that when the joomg2 module is disabled, the Zencart module and UserAlbums module work together? I.E. that when you create a new user in G2 without Joomla involvement, you get the album link and when that is clicked, the user album is created as expected?

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Mon, 2011-09-12 05:35

Wanted to make sure I answered your query below...

Answer is YES. When G2 and ZC are bolted together via ZCG2, everything plays nicely together. Albums and images created in G2 appear properly as products in ZC. That is 100%

To add to this... when JoomG2 and ZCG2 are installed to a Joomla/G2/Zencart model, when a new user is created in Joomla, if I temporarily deactivate ZCG2 and then have the user drop down into G2 and click "Your Album" which triggers the autocreation of an Album owned by the new user, when I ReActivate ZCG2, the new user's album is created in ZenCart. And then all images and subalbums added to the new user's album appear properly in Zencart.

It is really most excellent to see how all this bolts together. Once the new user album is created (by temporarily DeActivating ZCG2), everything works, from Joomla down into ZenCart. Albums. Images/products. Everything. Except for this last gotcha when a new user drop down into G2 for the first time. With your last tweak, with ZCG2 enabled, a new user drops into G2, their album and userlogin IS now created in G2. The new user however does not end up with ownership of the new album therefor cannot see their new album that should be owned by them. The cool thing is not only is their new album now created in G2, it appears in ZenCart too. It's like *that* close to laying all out. Your last tweak got 99% there.

SSH details in PM, and the test site has been created per your instructions.

Dayo wrote:
Hi,

... to save time, can you confirm on Point 3 that when the joomg2 module is disabled, the Zencart module and UserAlbums module work together? I.E. that when you create a new user in G2 without Joomla involvement, you get the album link and when that is clicked, the user album is created as expected?

dakanji.com

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Mon, 2011-09-12 08:01

Hi.

Haven't been able to check in on the setup site yet but will get round to it.

Typing this quickly from a remote device so excuse my being direct.

Sorry but you have not yet answered my twice repeated query yet: When Joomg2 is disabled, do the zencart and useralbums modules work fine together?

Note that I know all about how G2 and zencart works together etc and just interested in the how things work when the two mentioned G2 modules (zencart and useralbums) are active at the same time. I.E. Create user in G2 without Joomla involvement.

A simple "Yes. The two work fine together until joomg2 is added to the mix" or "No. Things crash even without joomg2 when I add a user in G2" will do.

Thanks!

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Mon, 2011-09-12 08:14

Yes. The two work fine together until joomg2 is added to the mix.

Dayo wrote:
Hi.

Sorry but you have not yet answered my twice repeated query yet: When Joomg2 is disabled, do the zencart and useralbums modules work fine together?

A simple "Yes. The two work fine together until joomg2 is added to the mix" or "No. Things crash even without joomg2 when I add a user in G2" will do.

Thanks!
dakanji.com

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Mon, 2011-09-12 17:36

OK.

Sorry about the school room question then. Just that I needed that specific bit of info as I had suspected the way joomg2 handles sessions might be the issue since I first asked on Friday but couldn't be sure of what was happening from the responses you had given.

I'll try to wrangle some time to have a look at things presently.

Cheers.

--
dakanji.com

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Mon, 2011-09-12 22:05

Right.

Good news is that I've found where it is crashing in joomg2. Generates a security error. Bad news is that it shouldn't be crashing there (only does with user albums requests) and I have no idea why it is.

I'll have another look tomorrow and perhaps try my luck with the core devs on IRC if I can't make headway. Only problem is that they generally have their hands full with G3 and tend not to want to deal with G2 issues. One of them, mindless, does help with G2 stuff but he has not been around for a while.

Maybe Bharat would be minded to after being relaxed by one of his long bicycle rides.

We'll see.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Tue, 2011-09-13 00:59

No worries about the school room question. In my effort to assist in this, my tendency to over explain stuff I know gets cumbersome, especially when the overexplained pieces are down the wrong track.

So no worries. Fire at will. Whatever it takes, including if I need to get yelled at now and then.

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Tue, 2011-09-13 01:23

Dayo, this is good news. I saw your login activity last eve and then today, yessir. Tell me what you need from me. Per the 500 error, let me know if I need to rebuild G2 for instance.

And this matters little now, but as I progressed through the debugging process as far as I could with my current skillsets, I saw this security error and too thought the security error was maybe a permissions error that happened when a registered user was triggering a call to G2 that required a higher level of permission, admin permission. When I saw that, wondered if it was a permissions request that was no able to be fulfilled. I didn't expand on that because of my tendency to overexplain stuff, especially when I am not using common language familiar to you or the developers of G2 and G3 which can be really annoying I know. I felt however this was the nexus point of the problem. Oh so close it seemed.

Yes, I do understand that G3 is the focus on IRC but maybe Bharat might ring in on this. x'd fingers. Hey, I'll lone him a bike and he can come ride the same routes the pro cyclists ride here (Colorado) if that helps clear the mind and body. I almost went to the Santa Fe Code Conference over a year ago but was held back by the subsequent medical crisis that hit family... wish I had been able to go though. At least to make some intro's.

As you say tho... your discovery is great news. If this were to get over the hump, to get this gotcha tweaked, would honestly compel me to contrib back by assisting others who want to build this J + G2 + ZC model. The more I install these three core pieces, it gives me the ability to help others wanting this model to be able to get it.

Dayo wrote:
Good news is that I've found where it is crashing in joomg2. Generates a security error. Bad news is that it shouldn't be crashing there (only does with user albums requests) and I have no idea why it is.

I'll have another look tomorrow and perhaps try my luck with the core devs on IRC if I can't make headway. Only problem is that they generally have their hands full with G3 and tend not to want to deal with G2 issues. One of them, mindless, does help with G2 stuff but he has not been around for a while.

Maybe Bharat would be minded to after being relaxed by one of his long bicycle rides.

We'll see.

--
dakanji.com

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Wed, 2011-09-14 04:34

Putting this on hold as other issues with the normal working with the JoomG2 module have cropped up that need looking at.

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Wed, 2011-09-14 04:45

Understand. Let me know what I can do when you come back to this, or how can I assist on other issues that need tending to. Am at the ready when you are....

Dayo wrote:
Putting this on hold as other issues with the normal working with the JoomG2 module have cropped up that need looking at.
dakanji.com

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Thu, 2011-09-22 04:14

Hi.

Thanks for the offer and sorry for going quiet.

I am afraid I am unable to address these issues at this time.

Actually, I am putting all G2 related development activity on the back burner and I cannot say when or if I will ever get back to it.

I will obviously act on "actionable intelligence" received and can update stuff if required.

BTW, If you haven't done so recently, now is a good time to donate to the dev team. It is hard work multiplied a 1000 times for them.

Cheers

--
dakanji.com

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Fri, 2011-09-23 08:51

Check PM.

Dayo wrote:
Hi.

Thanks for the offer and sorry for going quiet.

I am afraid I am unable to address these issues at this time.

Actually, I am putting all G2 related development activity on the back burner and I cannot say when or if I will ever get back to it.

I will obviously act on "actionable intelligence" received and can update stuff if required.

BTW, If you haven't done so recently, now is a good time to donate to the dev team. It is hard work multiplied a 1000 times for them.

Cheers

--
dakanji.com

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Fri, 2011-09-23 12:51

Checked. Thanks.

To summarise reply; It is time->priority issue.
Happens all the time with ad hoc developers. Just that many do not get around to posting notification.

--
dakanji.com