Drupal 6 port ?

zmove - August 13, 2008 - 10:11
Project:Ubercart Option Images
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:pillarsdotnet
Status:closed
Description

Hi,

Recently, Ubercart team released a drupal 6 version of ubercart that pretty usable with the support of the D6 version of imagefield, imagecache, etc... (download the latest bazaar version).

Do you plan to update your module to drupal 6, if yes, do you have an estimation about when it can be done (another thing that the current "when it's ready" ^^)

If you don't plan to update module, are you agree to review and implement if the review is good an eventually patch ?

zmove

#1

tjholowaychuk - August 13, 2008 - 15:31

They have a d6 release already? great! unfortunately I am busy at work with other projects but I welcome any maintainers that would like to work on uc_option_images as well.

#2

pkej - August 15, 2008 - 23:20

I did a quick conversion with Deadwood, there were just an extra ) at line 407 a missing ) at line 411. Unfortunately the schema for files have changed so the uc_option_image_save and uc_option_image_load functions needs to be rewritten completly.

I'm not up to it at this time.

I've attached the converted files for whoever might continue.

The admin pages work well as well as the forms and the module selection in drupal 6.4

AttachmentSize
uc_option_image.zip 14.07 KB

#3

tjholowaychuk - August 15, 2008 - 23:17

Really should have its own table, but it was a quick module at the time so I never got around to it :)

#4

pkej - August 15, 2008 - 23:37

It also should have default images set in the admin part. For example, when I list colors I would like to have all the color images added in the admin part, b/c I can't take pictures of everything in all the 45 color variations I have available. For now I'll just hard code that into a template file.

#5

tjholowaychuk - August 16, 2008 - 05:42

That too, there are alot of variations with that which may be ideal depending on what the person is doing. Defaults as well as image-not-found images should all ideally be uploadable.

#6

tjholowaychuk - August 18, 2008 - 18:12
Status:active» postponed

#7

tmpearsall - November 11, 2008 - 04:35

Is anyone working on modifying the uc_option_image_save and uc_option_image_load functions so that they support Drupal6? If not, I'm going to give it a shot but wanted to know in advance if anyone had started already.

#8

duncano74 - November 16, 2008 - 04:12

This mod looks pretty good - looking forward to the 6 port :)

#9

pillarsdotnet - January 8, 2009 - 23:56

Working on a 6.x conversion -- started with deadwood and the 5.x/6.x upgrade guide.

Looking at the file schema now; can't be too hard...

#10

pillarsdotnet - January 9, 2009 - 00:45

Well, the nid column doesn't exist; trying to use the filename column instead...

#11

pillarsdotnet - January 9, 2009 - 02:40
Version:5.x-1.0» 5.x-1.0-3
Category:support request» task
Assigned to:Anonymous» pillarsdotnet
Status:postponed» needs review

Woo-hoo! It's working!

Patch relative to current CVS HEAD checkout.

AttachmentSize
uc_option_image.5.x-to-6.x.diff 10.7 KB
uc_option_image_6.tar_.gz 7.06 KB
uc_option_image_6.zip 7.96 KB

#12

pillarsdotnet - January 9, 2009 - 05:26

Slight changes.

Pretty much works for me now.

I have an idea for improvement that would eliminate a great deal of redundancy in the image uploads:

  • Add file-upload fields to the admin/store/attributes/$oid/options page.
  • Make sure they get saved with $nid = 0
  • Modify the uc_option_image_load() so that if a file for ($nid,$aid,$oid) is not found, fall back to (0,$aid,$oid)
  • Add delete buttons to the file upload forms for the node/$nid/edit/options pages.
AttachmentSize
uc_option_image.5.x-to-6.x.diff 15.45 KB
uc_option_image-6.x.tar_.gz 7.19 KB
uc_option_image-6.x.zip 8.13 KB

#13

pillarsdotnet - January 9, 2009 - 23:36

Halfway there -- the logic is implemented but not the ui.

Added a default fallback image.

So the logic goes:

Load the specific node/attribute/option image if it exists,
else Load the attribute/option image if it exists,
else Load the default image.

AttachmentSize
uc_option_image.5.x-to-6.x.diff 10.78 KB
uc_option_image-6.x.tar_.gz 11.78 KB
uc_option_image-6.x.zip 12.92 KB

#14

tjholowaychuk - January 10, 2009 - 03:20

I dont have time to maintain this module guys, feel free to step up as a maintainer if you would like, and I will grant you CVS access.

#15

pillarsdotnet - January 10, 2009 - 05:05

I'm interested.

#16

tjholowaychuk - January 10, 2009 - 18:54

Its all yours :)

#17

johngflower - January 14, 2009 - 22:28
Category:task» bug report

Hi,

I've tried out uc_option_image-6.x.zip from post 12 & 13.

#13 causes product nodes to load up as a blank page.

#12 Allows me to choose option images and will display the default image. If I choose one of the option from the select field the option image vanishes. What do I need to do to make this module work for me?

I'm using drupal 6.8 and Ubercart 6.x-2.0. I've ticked yes to switching option images and selected the right attribute.

Any suggestions?

Cheers,

John

AttachmentSize
Screenshot-5.png 76.22 KB
Screenshot-6.png 32.57 KB
Screenshot-7.png 25.41 KB

#18

johngflower - January 14, 2009 - 22:57

Problem fixed. Using module from post #12 I changed the image option size, in the attribute settings menu, from Original to Product. Now the module works as it should.

Thanks for writing and updating a great module.

#19

johngflower - January 14, 2009 - 23:21
Category:bug report» feature request

It appears that I can only have one option displaying it's images at a time. Is it, or could it be made, possible to have an image displayed for each option with images?

#20

pillarsdotnet - January 15, 2009 - 05:12

working on that. hang on a couple more days...

#21

johngflower - January 15, 2009 - 17:34

sweet :), thank you.

#22

pillarsdotnet - January 17, 2009 - 20:12

Questions for comment:

1. Should each option image be located (a) before or (b) after the option selection form?
2. Should we skip attributes with fewer than two options?

#23

pkej - January 19, 2009 - 10:10

#22

1. Is it possible to have it selectable?
2. Of course, there are no actual options to select if there is only one option. It is good user interface to not confuse people with the impression of options where there are none.

3. It has been a long while since I tried out the module, so just ignore this if question 1 is exactly what I am asking about ;) Could the option image, if it is small enough, be inlined in the option tags of a drop down? I think that might need some stylesheet magic, but it would be nice if it is possible.

#24

johngflower - January 19, 2009 - 17:44

1) Pepsi & Coke - some people will prefer one, some the other. Both are valid choices.
2) Yes, simplicity works. Possibly this is easiest achieved by not having a 'no image' picture if no images have been uploaded for the option.

As an aside. I've broken my install of the module posted in #12. I did have pictures working. Now the picture are no longer visible and I see the words 'no image' in their place. Even after uploading new pictures to the options they don't appear. Any clues as to what I may be doing wrong?

#25

pkej - January 19, 2009 - 19:19

#13? Try it again. Do you have any caching on your site? Have you tried uninstalling and reinstalling the module (if it have the proper uninstall hook)?

Apart from that, no idea, especially if you have been modifying it yourself. Try diffing your version with the one you downloaded to see the changes you have done, and try to work from that.

#26

johngflower - January 20, 2009 - 18:26

I'll give #13 another go. And I'll try uninstalling (if possible)

I do have caching. In trying to fix this problem I flushed both the image_cache caches and the caches in the performance menu. I haven't modified the module.

#27

ccshannon - January 20, 2009 - 20:39
Category:feature request» bug report

I just tried the .zip file at post #13.

I copied the uc_option_image folder to my modules folder at sites/all/modules/.

At admin/build/modules I checked 'Option Images' and Save.

(Dev site is running on my laptop) after about 2-3 minutes of hanging for a return page, I get a blank page in response.

I go back to my site's homepage, and all seems fine.

Go back to admin/build/modules and 'Option Images' is unchecked.

Turned on devel.module query logging, tried enabling the module again, got back a whole lots of these (edited my pathnames but the log is otherwise the same):

Missing argument 2 for drupal_get_path(), called in /Users/me/Sites/example.com/sites/all/modules/uc_option_image/uc_option_image.install on line 5 and defined in /Users/me/Sites/example.com/includes/common.inc on line 1669.\";}}', timestamp = 1232483532 WHERE sid = 'kil654ok4nmjj8i60ik0tl8757'

This error is repeated dozens and dozens of times. Not sure if anyone else is seeing this when enabling the module.

#28

pillarsdotnet - January 20, 2009 - 23:11

Use the one in #12 not the one in #13.

#29

johngflower - January 21, 2009 - 04:56

I tried the module from #13. Here's the error message I get. Along with the relevant function.

Fatal error: Call to undefined function _t() in /var/www/html/sites/all/modules/uc_option_image/uc_option_image.module on line 395

Line 395:- _t('uc_option_image_load',array('nid'=>$nid,'aid'=>$aid,'oid'=>$oid));

Relevant code:-

/**
* Load image file.
*
* @todo: static cache
*/
function uc_option_image_load($nid, $aid, $oid) {
_t('uc_option_image_load',array('nid'=>$nid,'aid'=>$aid,'oid'=>$oid));
static $files;
$filename = uc_option_image_id($nid, $aid, $oid);
if (empty($files[$filename])){
$files[$filename] = db_fetch_object(db_query("SELECT * FROM {files} WHERE filename = '%s'", $filename));
if (empty($files[$filename])) {
if ($nid) {
return uc_option_image_load(0, $aid, $oid);
}
elseif ($aid && $oid) {
return uc_option_image_load(0, 0, 0);
}
}
}
_t('uc_option_image_load',array($filename => $files[$filename]));
return $files[$filename];
}

#30

pillarsdotnet - January 24, 2009 - 03:53

yup. Take those lines out; I had them in for debugging; sorry. the _t() function is one I wrote myself -- not part of Drupal.

Right now my priority is to make uc_option_images and uc_aac work together. Until then, uc_option_images is kinda useless for me.

#31

Bobuido - January 24, 2009 - 21:15

Started porting this myself before gradually realising I'm slightly out of my depth. Looking at this patch, seems you've already gotten further than me.

Have you made any more progress? Tomorrow I'll look at seeing if I can make any further progress with the patches you've pasted.

#32

johngflower - February 7, 2009 - 11:36

Have you had any joy getting option_images working with aac?

#33

warrenscott - February 8, 2009 - 02:49

I get the server error as well with both #12 and #13 versions. Drupal 6.9. Thoughts?

#34

johngflower - February 18, 2009 - 18:17

Any news?

#35

pillarsdotnet - February 22, 2009 - 19:40

Should be able to work on it this week.

#36

johngflower - February 24, 2009 - 08:47

Sweet :)

#37

pkej - March 7, 2009 - 13:24

pillarsdotnet, would it be possible to base the options on CSS sprites in 6.x?

#38

pkej - March 7, 2009 - 13:58

I tested number #12 and it seems to work well. The only thing I noticed is that it requires each product to have specialized images for each option. It would be nice if one could add a default image for each option. Thus, for example if I use color, I could upload a color for each option in the settings, and thus there will be a list of colors available by default; then, when the photographer has the time we can add images gradually.

#39

pkej - March 7, 2009 - 19:34

I also realized it is possible to upload images for text attributes if I add an option. I added an option measurement, and of course the image I uploaded didn't show up. It would be nice to be able to add one image for a text box, for example for measurements, these kinds of images are used to show the customer how to measure for what they want to order.

Of course there is no big deal in adding those images via for example css, but it would be very convinient to add one image for each type of measurement attributes available.

EDIT: Forgot to write "text" in front of "attributes", big difference ;)

#40

encho - March 23, 2009 - 15:21

Any news on this?

#41

cybertoast - March 25, 2009 - 16:01

Any further action on this? As far as adding the Drupal 6 port to CVS I mean.

#42

johngflower - March 25, 2009 - 18:05

I used to have Option 12 working. Now it doesn't, the first option image shows but there is no image once the ption is changed, not sure why. Looking forward to the new version coming out

#43

jerry - April 14, 2009 - 02:43

I had a similar problem - a working test installation of #12 stopped working for no apparent reason. It turned out that the uploaded image files had disappeared. A bit of digging suggested that it might be due to the fact that the files weren't marked permanent in the files table. Changing this code around line 429:

$file->filename = $nid . $aid . $oid;
$file->uid = $user->uid;

to this:

$file->filename = $nid . $aid . $oid;
$file->uid = $user->uid;
$file->status = FILE_STATUS_PERMANENT;

seems to have corrected that problem for me.

#44

pillarsdotnet - April 14, 2009 - 19:00

Good catch. Commited patch in #12 and Jerry's correction to HEAD.

#45

pillarsdotnet - April 16, 2009 - 19:19
Version:5.x-1.0-3» 6.x-1.x-dev
Status:needs review» fixed

Please post problems with 6.x version as separate issues rather than adding to this one. Thank you.

#46

System Message - April 30, 2009 - 19:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.