[Testing] Working CafePress Mod..

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
ejaan
Registered User
Posts: 123
Joined: Wed Jan 22, 2003 3:47 pm
Location: NYC
Contact:

[Testing] Working CafePress Mod..

Post by ejaan » Fri Nov 21, 2003 8:07 pm

Those of you who are interested in this CafePress Mod, here is a preview of what I have done ...
http://ejaan.com/store.php

if you are 100% sure this this what you want, please reply here so i can post the zip file..
its only 1 file... nothing to modify except the first line of the file where you enter your store ID...
shouldn't take more then 30 second to install.
hey.. best of all. its works!
8)

pollix
Registered User
Posts: 153
Joined: Tue Jul 23, 2002 6:29 pm
Location: Ridgecrest, CA
Contact:

Post by pollix » Sat Nov 22, 2003 11:40 am

Yeah post it! That's better then the cafepress mod I did!!

Gadget Girl
Registered User
Posts: 73
Joined: Wed Feb 06, 2002 10:13 pm
Location: Virginia

Post by Gadget Girl » Sat Nov 22, 2003 12:44 pm

So this shows your store in your phpBB forum? If so, that's really cool. :)

Anything else that I should know of that it does?

What versions of phpBB is it written for? I use 2.0.6.

Thanks,

Sara

ejaan
Registered User
Posts: 123
Joined: Wed Jan 22, 2003 3:47 pm
Location: NYC
Contact:

here is the details...

Post by ejaan » Mon Nov 24, 2003 7:00 am

it should work with any version of phpBB 2.0.4 +
here is the php code, just copy and paste into a blank document and change the first line of it... and then just name it
store.php
and save & upload.. and bingo.. ur done ;-)

Code: Select all

<?php
/******* JUST EDIT THE BELOW LINE TO REFLECT YOUR CAFEPRESS STORE ID ***********/

$stores = 'extasy';

/****** DO NOT MODIFY ANYTHING BELOW THIS LINE *******************************/
/****** DO NOT MODIFY ANYTHING BELOW THIS LINE *******************************/
/****** DO NOT MODIFY ANYTHING BELOW THIS LINE *******************************/
/****** DO NOT MODIFY ANYTHING BELOW THIS LINE *******************************/

/***************************************************************************
*                        CafePress Store Modification for phpBB
*                               By Opooh: opooh@ejaan.com
*                  Based on the CP Store coding by: NotOneBit.com
*
*   $Id: store.php
*
***************************************************************************/

/***************************************************************************
*
*   This program is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation.
*
***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

//
// Start output of page
//
$page_title = 'Store';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
?>
<link rel="stylesheet" type="text/css" href="http://www.cafeshops.com/cp/css/global.css" title="style">
<?php
$start = '<!-- Start Main Content -->';
$end = '<!-- End Content, Start Footer Include -->';
$url = 'http://www.cafeshops.com/';
$item = $_GET['item'];

// WRITE CAFEPRESS JAVASCRIPT TO PAGE //
echo '<script language="JavaScript1.1" src="http://www.cafeshops.com/commonscripts.js"></script>';

if ($item) { // Script has been called with a specific item, bring up detail page.
	$detail = $url . $item;

	$fp = fsockopen ("www.cafeshops.com", 80, $errno, $errstr, 30);
	if (!$fp) {
	    echo "$errstr ($errno)<br>\n";
	} else {
	    fputs ($fp, "GET /$item HTTP/1.0\r\nHost: www.cafeshops.com\r\nUser-Agent: MS Internet Explorer\r\n\r\n");
	    while (!feof($fp)) {
	        $content .= fgets($fp,1024);
	    }
	    fclose ($fp);
	}


	$null = eregi("$start(.*)$end", $content, $cparray);
	$pattern = "/\/cp/";
	$replacement = "http://www.cafeshops.com/cp";
	$itemdetail = preg_replace($pattern, $replacement, $cparray[1]);

	$largeImgPattern = "/<a href=\"\//";
	$largeImgReplacement = "<a href=\"?item=";
	$itemdetail = preg_replace($largeImgPattern, $largeImgReplacement, $itemdetail);

	// The next four lines aren't truly necessary. They 1)make the add to cart button pop up //
	// in its own window with the keep shopping button returning you to your custom store //
	// 2)add a view cart button (vey handy) and 3) change the link to the CP legal questions page //

	$itemdetail = preg_replace("/<form method=\"post\" action=\"http:\/\/www.cafeshops.com\/cp\/addtocart.aspx\">/i", "<form method=\"post\" name=cart action=\"http://www.cafeshops.com/cp/addtocart.aspx?keepshopping=javascript:self.close()\" target=\"cartWin\">", $itemdetail); 
	$itemdetail = preg_replace("/<input type=\"submit\"/", "<input type=submit onClick=\"cartWin = window.open ('','cartWin','toolbar=yes,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=500'); cartWin.focus(); return true;\"", $itemdetail);  
	$itemdetail = preg_replace("/Value=\"Add to Cart\"><\/td>/", "Value=\"Add to Cart\" >&nbsp;&nbsp;&nbsp;<input type=image src=viewcart_btn.gif onClick=\"cartWin = window.open ('http://www.cafeshops.com/cp/viewcart.aspx','cartWin','toolbar=yes,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=500'); cartWin.focus(); return true;\"></td>", $itemdetail);  
	$itemdetail = preg_replace("/law.  <a href=\"http:\/\/www.cafepress.comhttp:\/\/www.cafeshops.com/" , "law. <a href=\"http://www.cafepress.com", $itemdetail);

	echo "<script>";
	echo "function e (z, h, w, b, g) {";
	echo "document.write('<div style=\"width:'+w+';height:'+h+';background:white url(http://zoom.cafepress.com/'+(z%10)+'/'+z+'_zoom.jpg) no-repeat center center;\"><img border=\"'+b+'\" class=\"imageborder\" src=\"http://www.cafeshops.com/cp/img/'+(g?'zoom':'spacer')+'.gif\" width=\"'+w+'\" height=\"'+h+'\"></div>')";
	echo "}";
	echo "</script>";

	echo $itemdetail;
}
else { // No item was requested when script was called, show items from all stores in the $stores variable.
	$allitems = $url . $stores;

	// connect to CP
	$reqheader = "GET /$stores HTTP/1.0\r\nHost: www.cafeshops.com\r\nUser-Agent: MS Internet Explorer\r\n\r\n"; 
	$socket = @fsockopen("www.cafeshops.com", 80, &$errno, &$errstr); 
	if ($socket) 
	{ 
		fputs($socket, $reqheader); 
		while (!feof($socket)) 
		{ 
			$content .= fgets($socket, 4096); 
		} 
	} 
	fclose($socket);

	$null = eregi("$start(.*)$end", $content, $cparray);
	$pattern = "/<a href=\"\//";
	$replacement = "<a href=\"?item=";
	$storeitems = preg_replace($pattern, $replacement, $cparray[1]);
	$storeitems = preg_replace("/\/cp\/img\/saletag.gif/", "http://www.cafeshops.com/cp/img/saletag.gif", $storeitems);
	$storeitems = preg_replace("/\/cp\/img\/fathersday_prodtag.gif/", "http://www.cafeshops.com/cp/img/fathersday_prodtag.gif", $storeitems);
	$storeitems = preg_replace("/\/cp\/popupsurvey.aspx/", "http://www.cafeshops.com/cp/popupsurvey.aspx", $storeitems);
	echo $storeitems;
}




//
// Generate the page
//

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>

Last edited by ejaan on Mon Dec 01, 2003 3:24 pm, edited 2 times in total.

User avatar
Dio2
Registered User
Posts: 94
Joined: Sun Jun 15, 2003 5:02 pm

Post by Dio2 » Tue Nov 25, 2003 4:53 am

Gadget Girl wrote: So this shows your store in your phpBB forum? If so, that's really cool. :)

Anything else that I should know of that it does?

What versions of phpBB is it written for? I use 2.0.6.

Thanks,

Sara


My board is 2.0.6 and it works great. :D

ejaan
Registered User
Posts: 123
Joined: Wed Jan 22, 2003 3:47 pm
Location: NYC
Contact:

hehe...

Post by ejaan » Tue Nov 25, 2003 5:34 am

it should work with all 2.+ version of phpBB
(unless i am wrong, of course!)

Tom_S
Registered User
Posts: 524
Joined: Tue Jul 29, 2003 6:54 pm
Location: 127.0.0.1
Contact:

Post by Tom_S » Tue Nov 25, 2003 11:23 am

Don't work for me. I edited and put my store id as suggested but all I keep getting is:
STDERR:

Failed to find the "nothing" line (\n\n)! Premature end of script headers.

STDOUT:

(nothing)


Any suggestions? This MOD would be perfect for my site.

Thanks...

[EDIT]
And after testing and testing I still get the same error.
I am running 2.0.6

ejaan
Registered User
Posts: 123
Joined: Wed Jan 22, 2003 3:47 pm
Location: NYC
Contact:

hi...

Post by ejaan » Wed Nov 26, 2003 4:49 pm

Tom,

why dont u put a link to your site...
it works for me fine, i've upgraded mine to 2.0.6 from 2.0.4 and works excellent...

Tom_S
Registered User
Posts: 524
Joined: Tue Jul 29, 2003 6:54 pm
Location: 127.0.0.1
Contact:

Post by Tom_S » Wed Nov 26, 2003 4:53 pm

I can give you a link to the page. I don't have it linked in my site since store.php don't work. Also I am using 2.0.6
http://kischat.com/forum/store.php

I did what it said. I only changed the store id and copied into a blank page and named it store.php
Let me know what you come up with. I really could use this. :D

User avatar
scanman20
Registered User
Posts: 157
Joined: Tue Oct 01, 2002 8:23 pm
Contact:

Credit

Post by scanman20 » Thu Nov 27, 2003 4:06 am

Since you're using the Store.php script I created as the basis for your mod, I would appreciate credit.

Tom_S
Registered User
Posts: 524
Joined: Tue Jul 29, 2003 6:54 pm
Location: 127.0.0.1
Contact:

Post by Tom_S » Thu Nov 27, 2003 4:10 am

I will tell you what! You figure out how to make it work and I will give you all the credit in the world! You got it! :D
I went back in Time...
Image

User avatar
scanman20
Registered User
Posts: 157
Joined: Tue Oct 01, 2002 8:23 pm
Contact:

Post by scanman20 » Thu Nov 27, 2003 4:11 am

I'm not currently interested in turning my script into a mod just yet. My previous comment was directed toward ejaan.

Tom_S
Registered User
Posts: 524
Joined: Tue Jul 29, 2003 6:54 pm
Location: 127.0.0.1
Contact:

Post by Tom_S » Thu Nov 27, 2003 4:12 am

Darn! I sure could use that too. :(

Let me know when you do make it a mod please :D
I went back in Time...
Image

Dan-jr
Registered User
Posts: 370
Joined: Sat Apr 20, 2002 3:28 pm
Location: Québec
Contact:

about the shop

Post by Dan-jr » Thu Nov 27, 2003 9:41 am

I've tried it and make few ajustments and the script works fine for me!

thanks!

Wyr!H@x!mu$
Registered User
Posts: 802
Joined: Fri Jan 24, 2003 12:06 pm
Location: Koedijk, Alkmaar, The Netherlands
Name: Cees-Jan
Contact:

Post by Wyr!H@x!mu$ » Thu Nov 27, 2003 12:27 pm

I did some little alters so it supports multiple shops :D
http://zion.wyrihaximus.net/store.php

Locked

Return to “[2.0.x] MODs in Development”