Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 09:09 am EDT

Geeklog Forums

CafePress script for GL

Page navigation


Status: offline

ScurvyDawg

Forum User
Full Member
Registered: 11/06/02
Posts: 523
Hey there

I think the script is not designed to work as a static page so I doubt it will work that way as all the paths will be buggered up.

Just place the file in your public_html folder and be sure to open the store.php file in a text editor and edit the path the lib-common.

Once you have edited the path to lib-common then edit the stores to reflect the name of your CafePress store in the same file.

Now you can call to the store with a link like www.yoursitename.com/store.php and that's it.

I hope that helps
ScurvyDawg
 Quote

Status: offline

HMUSN

Forum User
Newbie
Registered: 02/17/04
Posts: 2
YEAH!! Idea So I am not as dumb as I thought. Here is what happened to me. I was so exsited about the new verson of geeklog I totaly did not even think of that messing it up. But thats what it was. I went to the current verson and it worked fine. THANKS ScurvyDawg! Your Insainly Smart!
 Quote

Status: offline

brindy

Forum User
Newbie
Registered: 03/28/04
Posts: 2
hey doods - i like this script, and it obviously works so i must be doing something dumb, but it's just showing all the items above the main gl page, check it out:

http://www.grrs.org.uk/store.php

i haven't got any customization on the store other than just adding the items that are there.

what am i doing wrong?

thanks in advance!
 Quote

Status: offline

brindy

Forum User
Newbie
Registered: 03/28/04
Posts: 2
Quote by brindy: hey doods - i like this script, and it obviously works so i must be doing something dumb, but it's just showing all the items above the main gl page, check it out:

http://www.grrs.org.uk/store.php

i haven't got any customization on the store other than just adding the items that are there.

what am i doing wrong?

thanks in advance!



hey, i got it working but i had to edit the script. the script was assigning COM_site_header() and COM_site_footer() to a display variable, but the rest of the script was just using echo. i changed the assignment to the display variable to echo as well and it works fine:

at the top of the script...
Text Formatted Code

$display = COM_siteHeader();

// becomes...

echo COM_siteHeader();

// and likewise for the footer.

 


i'm using gl 1.3.9 i don't know if that's got anything to do with it?

cheers,
brindy
 Quote

Status: offline

ScottMcW

Forum User
Chatty
Registered: 09/22/02
Posts: 42
Hi all,

I'm using the CafePress script at http://www.type34.org/store.php and it's GREAT. Just wanted to know if anyone's using this with a CP Premium Store? Is there any reason why it shouldn't work? I'm eventually going to upgrade to that and hope that the script works just as well then!

Thanks all!

ScottMcW
www.type34.org
 Quote

Status: offline

ScottMcW

Forum User
Chatty
Registered: 09/22/02
Posts: 42
Ok ok...I'm slow this week, must be the time change. It only took me a week to figure out that since the Premium stores give you full control over the HTML, you don't really NEED the script.

Duh.

Ok, continue on now...I'll catch up eventually! Smile

ScottMcW
www.type34.org
 Quote

Status: offline

ScurvyDawg

Forum User
Full Member
Registered: 11/06/02
Posts: 523
It is so cool you are having success with the script.

Big Grin
 Quote

Status: offline

destr0yr

Forum User
Full Member
Registered: 07/06/02
Posts: 324
cafepress added "Additional Photo's"... If you want them to work, add the following to your store.php around line 131 with all teh other preg_replace's:

Text Formatted Code

$itemdetail = preg_replace("//content/products/productcenter//", "http://www.cafepress.com/content/products/productcenter/", $itemdetail);

 

-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
 Quote

Status: offline

jhackwith

Forum User
Chatty
Registered: 07/24/04
Posts: 63
Location:Lewiston, Idaho
Quote by destr0yr: cafepress added "Additional Photo's"... If you want them to work, add the following to your store.php around line 131 with all teh other preg_replace's:

Text Formatted Code

$itemdetail = preg_replace("//content/products/productcenter//", "http://www.cafepress.com/content/products/productcenter/", $itemdetail);


 


I tried to implement this and get the following error upon clicking on an item:

Warning: Unknown modifier 'c' in /home/.halima/jasonhackwith/intotheflame.com/store.php on line 131

Any ideas?
"Beauty... is the shadow of God on the universe." ~ Gabriela Mistral -- Desolacíon
 Quote

Status: offline

destr0yr

Forum User
Full Member
Registered: 07/06/02
Posts: 324
Quote by jhackwith:

I tried to implement this and get the following error upon clicking on an item:

Warning: Unknown modifier 'c' in /home/.halima/jasonhackwith/intotheflame.com/store.php on line 131

Any ideas?

Try wgetting http://www.okanagangirlz.com/store.txt and rename it to store.php.
-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
 Quote

Status: offline

jhackwith

Forum User
Chatty
Registered: 07/24/04
Posts: 63
Location:Lewiston, Idaho
Quote by destr0yr:
Try wgetting http://www.okanagangirlz.com/store.txt and rename it to store.php.


Beautiful. Works great! See it at http://www.intotheflame.com/store.php.
"Beauty... is the shadow of God on the universe." ~ Gabriela Mistral -- Desolacíon
 Quote

offsuit.com

Anonymous
I just wanted to say, this hack is AWESOME!

And yeah, I had to fix the additional photo thingy, I was gonna say something, but looks like you guys are already on it.

--Nate
www.offsuit.com/store.php

P.S. - The only thing i can think of now is some way to put a featured product on the homepage, to let people know I have a store..
 Quote

Status: offline

ScurvyDawg

Forum User
Full Member
Registered: 11/06/02
Posts: 523
There is block code to post a banner from CP on your site but if for some odd reason did not see it.

Text Formatted Code

<br>
<center>
<a href="http://www.scurvydawg.com/store/cafe_store.php">
<img src="http://www.cafepress.com/cp/banners/promo_120x60_01.gif" width="120" height="60" alt="Support This Site" border="0">
</a>
<br>
<a href="http://www.cafepress.com/cp/info/storeref.aspx?refby=scurvyd" target="_blank">Get your very own online store.</a>
</center>



 


Of course you will have to edit the paths to suit you but check that out.

I will post a corrected store.php sometime over the next week.

 Quote

Daniel

Anonymous
hey scurvy,

just wondering if there's an updated file for this? the link to the 1.3.9 integration file doesn't seem to work anymore.

thanks!
 Quote

Status: offline

ScurvyDawg

Forum User
Full Member
Registered: 11/06/02
Posts: 523
Ahhhhh

OK I will post a new one when I get home tonight.

I moved to a new server account and that must be one of the files I did not move.

I will post here when I am done.

Cheers
SD
 Quote

Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
I see Dest0yer has a random product block, in place of the CafePress promo gif file. I wonder how he does that.

Sam
 Quote

Status: offline

ScurvyDawg

Forum User
Full Member
Registered: 11/06/02
Posts: 523
He and I did that using the www.notonebit.com random item script

I am not currently using the basic store free script but he still is so can still use that block.

I am not sure I even still have the code but notonebit does and if destroyer wants to release it he can but it will be tough as there is a bit if a process to get it working right.

Smile
 Quote

Status: offline

destr0yr

Forum User
Full Member
Registered: 07/06/02
Posts: 324
Quote by ScurvyDawg:I am not sure I even still have the code but notonebit does and if destroyer wants to release it he can but it will be tough as there is a bit if a process to get it working right.

I guess somebody would just have to contact me and ask.. Wink

Drop the following into your /path/to/geeklog/system/lib-custom.php:

Text Formatted Code

function phpblock_randshop() {
global $_CONF;

// SET VARIABLES //
srand ((float) microtime() * 10000000);
$start = '<!-- ### Items ### -->';
$end = '<!-- ### end of ITEMS ### -->';
$stores = 'YOURSTORE';
$url = 'http://www.cafepress.com/' . $stores;
$itemfile = '/path/to/geeklog/system/cpitemfile.inc';
$mode = $_SERVER['QUERY_STRING'];

if ($mode == "update") {
    echo "Beginning CP item file update...<br>n";

    // connect to CP
    $reqheader = "GET /$stores HTTP/1.0rnHost: www.cafepress.comrnUser-Agent: MS Internet Explorerrnrn";
    $socket = @fsockopen("www.cafepress.com", 80, &$errno, &$errstr);
    if ($socket)
    {
        fputs($socket, $reqheader);
        while (!feof($socket))
        {
            $cpfile .= fgets($socket, 4096);
        }
    }
    fclose($socket);


    $items = eregi("$start(.*)$end", $cpfile, $cparray);

    $newcparray = split ("n", $cparray[1]);

    foreach ($newcparray as $line) {
    if (strlen($line) > 100)
        {
        $newestcparray[] = $line;
        }
    }

    $handle = fopen($itemfile, "w");
    foreach ($newestcparray as $line) {
    $line = ereg_replace("<td align="center" valign="top"><p>","",$line);
    $line = ereg_replace("</td>","",$line);
    $line = ereg_replace("150","100",$line);
    $line = ereg_replace("<b>(.*)</b>","",$line);
//  $line = ereg_replace("\$(.*)r", "r", $line);  // Uncomment to hide prices
    $line = ereg_replace("prod.aspx?","prod&",$line); //this line is just used to integrate with custom store. delete to use regular cp store.
    if (eregi("<td colspan=3>",$line)) {unset ($line);}
    if (eregi("<tr>",$line)) {unset ($line);}
    $line = ereg_replace("<a href="","<a href="http://www.okanagangirlz.com/store.php?target=http://www.cafepress.com",$line);
    $line = ereg_replace("src="/cp/img","src="http://www.cafepress.com/cp/img",$line);
    if (!empty($line)) {
        $lastcparray[] = $line;
        fwrite($handle, $line);
        }
    }
    fclose($handle);
    echo "CP item file update completed.n";
}
else {
    $itemhandle = fopen($itemfile, "r");
    $itemarray = fread($itemhandle,filesize("$itemfile"));
    fclose($itemhandle);
    $lastcparray = split ("r", $itemarray);

    $item = $lastcparray[rand(0,count($lastcparray)-2)];
    $item = ereg_replace("[x27]",'',$item);
    $item = trim($item);
   //for javascript use:
    //echo "document.write('<div align="center">" . $item . "</div>');";

    //for php use:
    $theitem = '<div align="center">' . $item . '';
    $theitem .= '<a href="' . $_CONF['site_url'] . '/store.php"><strong>More Products</strong></a></div>';
    return $theitem;
    }
}

 


Edit the $stores = 'YOURSTORE'; and $itemfile = '/path/to/geeklog/system/cpitemfile.inc'; lines.

Create a new phpblock with teh following info:
Block Title: Whatever you want
Block Name: again, whatever you want, make it unique
Block Type: PHP Block
Block Function: phpblock_randshop
Save it, position it, and you're set.

-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
 Quote

Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
Thanks a lot!

Sam
 Quote

Status: offline

ScurvyDawg

Forum User
Full Member
Registered: 11/06/02
Posts: 523
magical
I updated the CafePress integration script.

New Basic CP Shop Script

If you do not yet have a CafePress store Get one here

Big Celebration
 Quote

Page navigation

All times are EDT. The time is now 09:09 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content