white screens after enabling

Project:Chained Attributes and Options
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description
Project: 
Links attribute options

hopefully this is the queue for uc_cano..."project" dropdown below issue details doesn't have uc_cano or Chained Attributes as an option, i can only assume this is it...

already cleared cache...several times...no change...

still having errors as described above ("headers already sent") and white screens after submitting just about any form on the site when this is enabled. also note that the second time around, after disabling, uninstalling and reinstalling, i had to manually create my table in the DB, it did not create the table for me.

i sort of got it working at some point, but to me it seemed to work backwards from what i would think. in my case, we're talking about letters to hang a baby's name on a nursery wall. the letters can be made with or without ribbon and then if there's ribbon, different styles and types of ribbon are available, but we don't want to show the styles or types unless they choose to add ribbon.

i chose the parent attribute (ribbon y/n), the option to have the dependents (y - add ribbon) and dependent attributes (ribbon style and ribbon type) and those seem to be only available when selecting the "n - no ribbon" option instead of the one selected. i noticed that the code sets the options to 'disabled'. am i misunderstanding how this works? maybe a readme.txt/install.txt or some instructions on how to set this up would be helpful too?

Version: 
Ubercart 2.0-RC1
Joined: 03/17/2010
Juice: 75

I saw that you mentioned your version is 2.0-RC1. This might be the reason. This module has been developed under Drupal 6.16 and Ubercart 2.2.

Joined: 03/17/2010
Juice: 75

I tried again on my server but I didn't get the white screen as you mentioned. But anyway I found a few other issues and there's a new features implemented. So I just issued a new version. Can you download the newest code here: http://www.ubercart.org/files/uc_cano-1.1.tar, and try it again?
1) Disable the CANO module;
2) Uninstall it;
3) Overwrite with new source code;
4) Enable CANO again (you should now see 1.1 as the version).

Everything should work without problem. If not please don't hesitate to let me know. Thanks!

Joined: 02/11/2010
Juice: 91

I'll check out the new version asap. i only chose RC1 because 2.2 was not an option when i created the issue (?). one quick tip, you might want to add "package = "Ubercart - extras" to your .info file to group it in with UC modules instead of in the "other" fieldset on the modules page. i'll let you know how the new version goes after uninstalling the old.

Joined: 02/11/2010
Juice: 91

ok, so i did what you said and still was having issues, so i decided to run the module's files through coder (drupal.org/project/coder) and it found a couple of errors (mainly just little picky formatting things), but once i fixed those i no longer get white screens all over the place!!! (the main issue it found was on line 189 of uc_cano.module where array key oid wasn't in quotes (use ['oid'] instead of [oid])). so yay!!...

...kind of..i still have 2 issues:
- it doesn't work with uc_aac (Ajax Attribute Calculation). when you choose the option that the dependent attributes are NOT associated with, they fade out like it's going to work, but then they are called back up...not sure what to do here but disable uc_aac for the time being because the CANO aspect is more useful to me on this site
- maybe i'm misunderstanding the logic behind the cano definitions admin page, but what i had to do (besides disable uc_aac) was to choose the option i DON'T want the attributes to be linked to for it to work as desired...basically it seems to me to work backwards.

explanation:
i have an attribute for these letters of "ribbon" with options "no ribbon" or "add ribbon". it seemed to me that the logical thing to do would be make "ribbon style" and "ribbon type" dependent on the "add ribbon" option, so that's how i initially set it up, but it only displayed those attributes when i chose "no ribbon". so contrary to my logic, i set the "ribbon style" and "ribbon type" to be dependent on "no ribbon" and it works as i would have expected with it being dependent on "add ribbon" option. does that make sense? as long as i set up the attribute to depend on the attribute option i DON'T want to associate them with, it works. see http://www.alabamarecycling.org/letter-creations/options/colors/test2 for an example and screenshot attached of CANO definitions (this is just a dev site).

all that said, this is a great, and VERY useful module and i salute you for doing such good work thus far. maybe it's just my install or my use case that's the problem (or just me for that matter!), but it's a great module, so props! you saved my butt on this one. if you can help explain about how it's setup and/or help it play well with uc_aac (another very cool module), that'd be awesome. let me know if you'd rather i create a separate issue for those.

AttachmentSize
CANO definitions.png 6.93 KB
Joined: 02/11/2010
Juice: 91

btw, the js file doesn't seem to work in IE at all because of the indexOf function not being supported! found in several forums the following solution that, when added to the js file makes IE handle it

if(!Array.indexOf){
    Array.prototype.indexOf = function(obj){
        for(var i=0; i<this.length; i++){
            if(this[i]==obj){
                return i;
            }
        }
        return -1;
    }
}

let me know about the "backwardsness" question?

Joined: 07/27/2009
Juice: 20

Two days ago I installed the latest version of uc_ano, mentioned here. I have the same problems. For my planed online shop I need some complexe attribute selections. Customers can choose for some piece of clothing different kind of materials and depending on the material selection, they can choose the available colors. In Summary I will have up to 4 or 5 groups of these material-color combinations.

First I also realized, that Ajax Attribute Calculation is not working together with uc_cano.

Second, the tool is disabling the selected attributes and not enabling. I like the idea, to be able to choose, if the tool should disable or enable the selected attributes. But at the moment I can't choose.

drupal 6.17
ubercart 6.x-2.3
uc_cano 1.1

Joined: 08/19/2010
Juice: 4

I think I've found a solution to the white screen and header problems. At the beginning of each file, there are three invalid bytes which cannot be seen by using a text editor (or at least vim ignored them).

$ head -n 1 * # outputs the first line of every file in the current directory
==> uc_cano.admin.inc <==
<?php

==> uc_cano.css <==
.uc-cano-dependent-attr {

==> uc_cano.info <==
; $Id: uc_cano.info, Exp $

==> uc_cano.install <==
<?php

==> uc_cano.js <==
$(document).ready(function() {

==> uc_cano.module <==
<?php

These are the characters which I believe are causing the white screens and header problems. So I ran the following bash to remove these characters (make sure you are in the uc_cano directory):

#!/bin/sh
tmp=`mktemp`
for file in uc_cano.*; do
        tail -c +4 "$file" > "$tmp"
        mv "$tmp" "$file"
done

I put it into a script, but you can also run it straight from the interactive shell. Make sure to run it only once though, or you'll be stripping actual code out of the files. You can also use a hex editor to remove the first three bytes from each file manually.

After running this script, I haven't got a white screen or header error. I was also able to run update.php successfully. Seems like PHP was thinking they were output and Drupal was choking on them. Hopefully this will be fixed in the next release. I think this module is very useful and has a lot of promise.

uc_cano 1.1
Drupal 6.19
Ubercart 2.4

Joined: 03/17/2010
Juice: 75

seanfisk: I think there're some coding issues in your message.
for everyone interested in this little module, I'm almost done with the latest version which should fix most of the reported issues so far. I'll upload it asap when it's done. thank you!

oncreative's picture
User is online Online
Joined: 08/23/2010
Juice: 118

I get the white screens too. If I look in the drupal logs it seems to fail with the 'Cannot modify header information - headers already sent by' mesage at line 345 of common.inc. This would indicate that there are hidden chars being sent but going through the files with Text Wrangler doesn't find any. Looking forward for the release version.

oncreative's picture
User is online Online
Joined: 08/23/2010
Juice: 118

Re-saving them using Text Wrangler seems to do the trick.

oncreative's picture
User is online Online
Joined: 08/23/2010
Juice: 118

I found that in the end Text Wrangler didn't do the trick and I had to figure what seanfisk's code was trying to do as it didn't work for me. In the end I got it working using the following slightly modified script (for OSX):

#!/bin/sh
tmp=`mktemp -t tmpfile`
for file in uc_cano.*; do
        tail -c +4 "$file" > "$tmp"
        mv "$tmp" "$file"
done

Although I don't get white screens anymore I do now get this error:

Fatal error: require_once() [function.require]: Failed opening required 'sites/all/modules/ubercart/contrib/uc_cano/uc_cano.admin.inc' (include_path='.:') in /public_html/includes/menu.inc on line 346

Very annoying as this module would've solved a larger headache, I'll have to look for another solution.