Hi there.

I would love to see this module ported to D6. I would be happy to assist in this.

If anyone else are interested perhaps we could join forces?

Thanks,

CommentFileSizeAuthor
#9 cafepress-6.x.tar_.gz14.4 KBjriedel
#4 cafepress.zip13 KBenzipher
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

junedkazi’s picture

hi,

I am interested to join in and contribute

Thanks

Juned Kazi

Kbrooks’s picture

I'm interested in working on this. Do we have any sort of "plan" at this point?

Kami

junedkazi’s picture

I have put a request to Rooey for adoption for the cafepress module .
Once he responds we will start working on it .

Thanks

Juned Kazi

enzipher’s picture

FileSize
13 KB

Great! It seems like I got the ball running. I would be happy to make some testing.

Actually I tried the Deadwood module. I attached what came out of it. Perhaps it's a good start.

Thanks

jriedel’s picture

I'd like to see this module working. However I'm new to Drupal and might not be able to help take over support of the module. I thought I'd see what I could do just for my own site.

I just pulled down that zip and tried to get things to work. Wow, this is going to take some work. I got the admin menus working, fixed a few issues that the class name it was looking for in the code doesn't match the doc. However it still didn't pull any products. The optional class assumes things about the Cafepress website. It can be changed to match, but I think one will be constantly fixing it when Cafepress changes something.

I think the best way to take care of the situation is to use the search API that Cafepress has. That would make it better in the long run.

The first thing to do is add an setting for an API key, that should be easy to do. I'll look at some code from another module that does API calls to a site. It has the added advantage of caching the API calls nicely in the database.

The other thing that should be done is to move the HTML out of the module file and into a tpl. This would make theming it easy.

expatme’s picture

+1

ajayreddy’s picture

I look forward to a stable release of this

jriedel’s picture

I just got a good version of this working under D6.8. Give me about another week or 2 and should have it working real well and I'll zip up what I have and post it here.

jriedel’s picture

FileSize
14.4 KB

Here it is. Still a lot needs to be done to get rid of HTML in the module and allow a lot more theming. The code also needs some cleanup, proper indenting and such, but it works. The random product block works and so does the full store page.

No need to download anything else, no need to create directories, that's all taken care of for you.

Now all someone has to do is to take over support, finish the cleanup and get the code loaded into CVS.

lionheart8’s picture

It is great to know something for Drupal 6 is in the works. I wish i could help but I am not that much of a programmer. You do have my moral support, though. :)

Gonna try uploading this to my D 6.8 & see what it can do.

gottsman’s picture

Thanks for your time and effort to create a 6.x port.

I tried installing your development build into a brand new 6.9 install. After installing the website just quit working with blank pages. Are there still plans to finish the port to 6.x?

jriedel’s picture

Sorry to hear about your problem. Very hard for me to tell what the problem may be. It's working fine for me on a 6.9 site. But I'm not a Drupal coder, I just play one at night.

It sounds like some PHP error in one of the files. Do you have access to the webserver/php logs?

Can you check the ownership and permissions of all the files from that got unpacked?

Let's try this first. Get to a command prompt and go to module directory and type

php cafepress.install
php cafepress.module

You should get nothing back from either one. If you do then what is the message and what version of PHP do you have? I have 5.2.6.

Next try going into the classes directory and try

php cafepress.cafepress.class
php cafepress.product.class

Same thing, any messages?

As for finishing the port, I have no idea if the person in charge of this module will take it further.

sykedya’s picture

HI

I got this to work with very little effort, Thanks :)

Just a few things i was wondering if you had an idea about... I need to change it to AUD instead of the default USD. Any ideas how i would do this.

Also if i try and change the thumbnail size from 100 it gives me blank pages. not that there is anything wrong with 100size for thumbnails.

Cheers for any help.

Thanks

jriedel’s picture

AUD/USD and other things like that and theming is where the module needs a lot of help. You can try going into cafepress.module and look at line 342. That has the $ on it and the price, you can change to read whatever you want.

I just took a few stabs at what "I" thought was a layout that worked well for me in theme I'm using. Someone that really understands theming needs to make the process much more generic.

That's odd on the image size. Mine is set to 150, I just changed it to 240, then to 100, then back 150. It worked everytime. Can you look in the database at the cache_cafepress table? That shoud have the raw data from API call in it. I'd like to know if it provides images for anything other than 100px.

I based those sizes on the admin page on what I was seeing in the data CP gave me when testing. I wonder if not everyone is being given all of those sizes.

sykedya’s picture

It might have something to do with me only having a basic store.

As for the pricing it grabs it in USD so i guess unless it can be grabbed at the converted rate ill have to leave it at that for know.

Thanks for the quick reply. I will look the database and get back to you when i get the chance!

Cheers

lionheart8’s picture

Hi
I have been following this with a lot of interest.
Following the following instructions for the Drupal 5 version

Installation
------------

1. Drop the cafepress.module file into your module directory.

2. In the modules section of your configuration menus, set the directory for your images (make sure that the images are named after the product number -- they are by default), and your cafepress store. If you would like to avoid downloading specific images from your store, you can download cafepressbox from http://www.getfreesofts.com/script/883/8648/CafePress_Random_Product.html and place the class.cafepressbox.php file in your modules/cafepress directory. It will get the list of products and images directly from your store.

3. Activate the block.

4. ...

involving that class from that website, I am able to display products like at that temporary link:
http://www.orbit.890m.com/

Now, regarding the D6 version, I installed it at http://www.orbit.890m.com/d6 but noted during installation, one is asked for an API key.
I do not have one, but I found some confusing statements about it in the Cafepress forums. Some people said they no longer give out API keys, one led to a link requiring practically signing up for an affiliate program & agreeing to the TOS before getting the keys.

I had no plan of signing up fpr an affiliate program for now. Does it mean I cannot use the D6 version without the API key?

Without it, under "Stuff from our store" I just get a $ sign & "more".

I even tried adding class.cafepressbox.php which works in D5 after I included the necessary images, but it does not seem to work here.
Is there any chance of making it work for D6?

Thanks & regards

jriedel’s picture

Mine is just a basic store, so I don't think that is the issue at this point. I'm not sure how to take care of the USD/AUD issue if all the CP API data is giving you is USD. I didn't see it the raw data, but for your store they might also list the price in a native currency.

As to API key. Sigh.....

Yes I ran into the same thing, E-mailed them, and got back an auto response that they nolonger give them out. Hoever in a few places CP people said if you are having trouble, try this API key. So yes, you need to put in an API key.

Look in the README.txt file I supllied, you should find what you need.

As to the class.cafepressbox.php, I tried that at first with D6 and got nowhere fast, and I didn't want to have to add images. So for my own needs I re-coded to us the API.

RachelNY’s picture

I am not sure what is going wrong for me. I uploaded and enabled the module. Left the default image directory, put in the API key, my store ID, etc ... the cafepress/onlinestore page shows up fine, but it doesn't show any images/products ... do I need to create an images/cafepress directory? Do I need to actually upload images? Is there something simple I am missing here or any dependencies I am unaware of?

Any help would be much appreciated!

Thanks,
Rachel

RachelNY’s picture

Some progress, it will only work if I do this:

Line 62 of cafepress.cafepress.class

    // Check for cached data.
    if (isset($this->handlers['getCache'])) {
      $response = file_get_contents('http://api.cafepress.com/product.listByStore.cp?v=3&appKey=77888c76-60ac-44f1-8e88-207bc5a81234&storeId=englishchannel');
//      $response = call_user_func($this->handlers['getCache'], $params, $class, $method);
    }

Any ideas? Is there some cache setting I need to tweak?
Rachel

Also, I also had to create the /sites/default/files/images/cafepress directory manually....

jriedel’s picture

Shouldn't be anything you next set related to the cache. Can you see if the install created the cache table in the database?

Or how about putting a debug print statement in the cafepress_cache_get function in cafepress.module to see where things are failing.

I have some code to create the image directory, but thinking about it a bit, it might have worked for me because of exsisting protection settings and how Apache is setup.

RachelNY’s picture

There is a cache_cafepress table which is empty.

cafepress_cache_get:
print $params; // Shows: "Array"
print $class; // Shows: "productlist"
print $method; // Shows: "ByStore"

Is there something else you want me to look for?

ernlilley’s picture

Folks,

I'm really glad you did this for Drupal 6. I'm just getting started with Drupal, so I've got my hands full converting a site for a client, and they really didn't want their CafePress to be linked off from the site. This was a big help.

When you click on a product, it takes you to the external CafePress page. I assume that's just the way it is and you can't actually keep it in the skin for the entire transaction. If I'm missing something though, please let me know.

Either way, it's been a big help.

Ern

jriedel’s picture

I'm sure they would be some ways to do it. You could open the Cafepress stuff in an iframe. Much more than that might require a premium store at Cafepress, then using a lot more the API to create orders. A big, big task to code and test.

ronjo84’s picture

I keep getting the following error:

Fatal error: Class 'cafepress' not found in /home/askronco/public_html/bumpert/drupal-6.12/sites/all/modules/cafepress/cafepress.module on line 293

Help?

venusrising’s picture

Anyone get any news about this module vesion 6

venusrising’s picture

Works great. I got an API key from Cafe Press with no issue someone should commit this code.

venusrising’s picture

One thing to note is that Block generation time is about 145ms which is quite huge. I do not have caching enabled as this is too dynamic to do so. This looks great but the block generation time may be a downfall.

jriedel’s picture

Not surprised about the block time. I had no use for that so in the port I made I never tested that much, just that it seemed to work.

venusrising’s picture

I wonder how we can speed up the block generation time. The module works great however Jreidel, thanks for porting it!

jriedel’s picture

Without using some PHP profiling tools, which I don't have, it would be hard to find the issue.

It's been while since I did any work on it, so I went back and looked at the code. The only difference between block display and the page display is that the block picks random number and displays just the one random item from the filled up array of data.

That array is filled completely not matter block or page. So what would be intersting to know if someone has the time to test it.... Does the block generation time match the page mode genteration time?

Anyone that wants to take the code and give it a facelift, go right ahead. It was a first attempt at any real PHP/Drupal code, so I'm sure it has a lot of room for improvement

venusrising’s picture

Well, you did a great job and it looks nice. I did not know that there was a page for this module so when I have a chance I will check generation time. Wish I could be of more assistance.

ascii122’s picture

Thanks for doing this module. Seems like it's working great!

ebeyrent’s picture

Assigned: Unassigned » ebeyrent

I have created a Drupal 6 branch based on the code in #9. Thanks for all your efforts with this!

ebeyrent’s picture

Status: Active » Closed (fixed)