Welcome to Geeklog, Anonymous Sunday, November 24 2024 @ 10:43 pm EST
Geeklog Forums
Fix your CafePress Script
Status: offline
ScurvyDawg
Forum User
Full Member
Registered: 11/06/02
Posts: 523
Important: CafePress has made some changes and it stops your items from displaying in your cafepress store.
All you need to do to correct this is replace the word cafeshops to cafepress everywhere within the script.
I will provide a new release soon.
Thanks
ScurvyDawg
ScurvyDawg.com
17
14
Quote
crickett
Anonymous
thanks for the update!!
13
14
Quote
Status: offline
cropcirclegear
Forum User
Newbie
Registered: 09/13/04
Posts: 4
When I try to make the script work, I get the following error:
Parse error: parse error, unexpected T_STRING in /home/gear/public_html/store.php on line 149
Any ideas? Here is the URL
http://www.cropcirclegear.com/store.php
Thanks!
Parse error: parse error, unexpected T_STRING in /home/gear/public_html/store.php on line 149
Any ideas? Here is the URL
http://www.cropcirclegear.com/store.php
Thanks!
11
12
Quote
Status: offline
comicbookguy
Forum User
Regular Poster
Registered: 05/15/04
Posts: 97
Without being able to see the changes you made I would think you probably just made a mistake editing the page. Did you use a WYSIWYG editor? WYSIWYG editors can corrupt these pages easily. You should make your changes in Notepad or Wordpad and then ftp the file to your site.
Double check the store.php file on your server to see if it looks correct. And of course be sure to make the changes as per the ScurvyDawg.
Double check the store.php file on your server to see if it looks correct. And of course be sure to make the changes as per the ScurvyDawg.
13
17
Quote
Status: offline
ScurvyDawg
Forum User
Full Member
Registered: 11/06/02
Posts: 523
I would need to see your script. I do not know what has caused this.
I see you have not yet fixed it.
Let me see your code and maybe then I can tell you.
I see you have not yet fixed it.
Let me see your code and maybe then I can tell you.
15
16
Quote
idora
Anonymous
This is great! are the free shipping and add to cart images always showing up as red x's?
18
16
Quote
Lunarex
Anonymous
The script isn't calling the AddtoCart.gif or the color swatch gifs from cafepress. Instead it is trying to display them from your own server. Another words it is writing the url with my domain for the images. I don't know php that well to know where to change it in the script or if there needs to be additions made to it. Also it doesn't display the ViewCart.gif.
Scurvydawg, how do you have them showing on your page? Did you have to make changes to the code?
Thanks!
Scurvydawg, how do you have them showing on your page? Did you have to make changes to the code?
Thanks!
13
9
Quote
lunarex
Anonymous
Ok, I have picked the script apart and figured out how to correct the images being called correctly from cafepress. Which fixes the add to cart button and the t-shirt thickness gif and fixed the holiday banner that was showing a "?" on the front of the store at the top.
The only things left ,unless someone else chimes in with a fix, is the link about direct printing and adding the view cart button which doesn't seem to work in the orginal script. This is what I know is wrong with the it so far.
I'll keep plugin and learnin!
The only things left ,unless someone else chimes in with a fix, is the link about direct printing and adding the view cart button which doesn't seem to work in the orginal script. This is what I know is wrong with the it so far.
I'll keep plugin and learnin!
15
11
Quote
lunarex
Anonymous
Well, I feel really goofy.
I should have realized to fix the direct printing url was to just add to the preg_replace. Duh!
O.K. I can't seem to figure out how to get the view cart button to show up on the page. Any clues from anyone?
I should have realized to fix the direct printing url was to just add to the preg_replace. Duh!
O.K. I can't seem to figure out how to get the view cart button to show up on the page. Any clues from anyone?
12
16
Quote
lunarex
Anonymous
Ok, I am crying uncle. I can't get the veiw cart script to work. So I don't know what I am doing or doing wrong. Has anyone tried to get the veiw cart button to work?
16
10
Quote
Status: offline
congleal
Forum User
Full Member
Registered: 11/08/04
Posts: 179
I've found an answer of sorts... I went to the following site and downloaded the free cafepress script... it however is missing the statement to encompass your website around your cafepress site so I copied and pasted the following in the top of the script after the
// This path should point to your lib-common.php
require_once('C:/yoursite/public_html/lib-common.php'); // You MUST enter the correct path here
$start_display .= COM_siteHeader(); // use 'none' if you do not want the left blocks
echo $start_display;
// Put your php code here and add everything to the $display variable you want displayed
/*
Then everything displayed except "check your basket", which I can live without for now.
Lee
require_once('C:/yoursite/public_html/lib-common.php'); // You MUST enter the correct path here
$start_display .= COM_siteHeader(); // use 'none' if you do not want the left blocks
echo $start_display;
// Put your php code here and add everything to the $display variable you want displayed
/*
Then everything displayed except "check your basket", which I can live without for now.
Lee
15
11
Quote
Max
Anonymous
I guess I'm still the ubernoob - how in the heck do I install this code? What do I need to do?
Thanks,
Max
Thanks,
Max
9
16
Quote
Status: offline
congleal
Forum User
Full Member
Registered: 11/08/04
Posts: 179
Max,
Far from being an expert, but if you've already installed your store and the problems I was having was that the icons from cafepress did not display properly. I simply downloaded some new code that displays all images except the view cart icon. You have to download the viewcart icon and save it in your store directory. The only thing that needs to be changed is the path to your lib-common.php and the name of your cafepress store...mine is "irish_shop". I am on a windows server... Here's the code I used after you can the path in the following code save it as your store.php file in your store directory:
// This path should point to your lib-common.php
require_once('C:/aohweb/public_html/lib-common.php'); // You MUST enter the correct path here
$start_display .= COM_siteHeader(); // use 'none' if you do not want the left blocks
echo $start_display;
// Put your php code here and add everything to the $display variable you want displayed
/*
-----------------------------------------
CafePress Custom Store Script 1.0.16
-----------------------------------------
This script is designed to allow CafePress Basic (free) store owners to incorporate
their store into their own web site. This script can also be used with my random
item script which features any randomly selected item from your store(s) on any
page of your site.
Created and copyright by admin@notonebit.com Mar-23-2003
Last updated: Jan-13-2006
This code is released under the terms of the GNU General Public License
A copy of the GPL can be found at http://www.gnu.org/copyleft/gpl.html
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; either version 2
of the License, or (at your option) any later version.
Please retain this message at the top of this script if you modify it in any way.
---------------------------------------------------------------------------------
INSTRUCTIONS:
1. First, your web server must have PHP 4.1.0 or later installed for this script to function properly.
You must also be able to run the fsockopen() function.
2. This script will display all the products from the stores you specify on one page. Each item
is linked to a detailed version of itself using this same script. Items are retrieved in real time,
so if you have many items in many stores, your page may take several seconds to fully load all of
CafePress' hosted images.
3. To setup the script, edit the $stores variable below to be a list of your stores. THAT'S IT!
4. You can run this script as an include file within an existing PHP page, cutting-and-pasting the script
into your own PHP page, or as a standalone page. If you choose to run it as a standalone page, you'll
need to add the appropriate HTML around it in order for it to display properly ( etc...).
5. Rename this script to store.php.
Your feedback is welcomed. If you have any questions or comments please email me at scanman20@hotmail.com
-Admin
-------------- SCRIPT BEGINS AFTER THIS LINE -----------------------------------------------*/
// SET VARIABLES //
$start = '';
$end = '';
$stores = 'irish_shop'; //EDIT THIS VARIABLE TO BE A LIST OF YOUR STORES
$url = 'http://www.cafepress.com/';
$item = $_GET['item'];
// WRITE CAFEPRESS JAVASCRIPT TO PAGE //
echo '';
if ($item) { // Script has been called with a specific item, bring up detail page.
$detail = $url . $item;
$fp = fsockopen ("www.cafepress.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)
n";
} else {
fputs ($fp, "GET /$item HTTP/1.0rnHost: www.cafepress.comrnUser-Agent: MS Internet Explorerrnrn");
while (!feof($fp)) {
$content .= fgets($fp,1024);
}
fclose ($fp);
}
$null = eregi("$start(.*)$end", $content, $cparray);
$pattern = "//cp/";
$replacement = "http://www.cafepress.com/cp";
$itemdetail = preg_replace($pattern, $replacement, $cparray[1]);
$largeImgPattern = "/
$largeImgReplacement = "
$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 (very handy) and 3) change the link to the CP legal questions page //
// The view cart button can be found at http://www.notonebit.com/forum/viewtopic.php?t=95
$itemdetail = preg_replace("//i", "", $itemdetail);
$itemdetail = preg_replace("/
$itemdetail = preg_replace("/alt="Add to Cart">/", "alt="Add to Cart"> ", $itemdetail);
$itemdetail = preg_replace("/
$itemdetail = preg_replace("/src="/content//", "src="http://www.cafepress.com/content/", $itemdetail);
echo "";
echo "function e (z, h, w, b, g) {";
echo "document.write('')";
echo "}";
echo "";
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.0rnHost: www.cafepress.comrnUser-Agent: MS Internet Explorerrnrn";
$socket = @fsockopen("www.cafepress.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 = "/
$replacement = "
$storeitems = preg_replace($pattern, $replacement, $cparray[1]);
$storeitems = preg_replace("/src="/content/promo//", "src="http://www.cafepress.com/content/promo/", $storeitems);
$storeitems = preg_replace("//cp/img/saletag.gif/", "http://www.cafepress.com/cp/img/saletag.gif", $storeitems);
$storeitems = preg_replace("//cp/img/fathersday_prodtag.gif/", "http://www.cafepress.com/cp/img/fathersday_prodtag.gif", $storeitems);
$storeitems = preg_replace("//cp/popupsurvey.aspx/", "http://www.cafepress.com/cp/popupsurvey.aspx", $storeitems);
echo $storeitems;
}
//
//$display .= COM_endBlock(yes);
$display .= COM_siteFooter(yes); // use yes if you want the right blocks
echo $display;
?>
Far from being an expert, but if you've already installed your store and the problems I was having was that the icons from cafepress did not display properly. I simply downloaded some new code that displays all images except the view cart icon. You have to download the viewcart icon and save it in your store directory. The only thing that needs to be changed is the path to your lib-common.php and the name of your cafepress store...mine is "irish_shop". I am on a windows server... Here's the code I used after you can the path in the following code save it as your store.php file in your store directory:
// This path should point to your lib-common.php
require_once('C:/aohweb/public_html/lib-common.php'); // You MUST enter the correct path here
$start_display .= COM_siteHeader(); // use 'none' if you do not want the left blocks
echo $start_display;
// Put your php code here and add everything to the $display variable you want displayed
/*
-----------------------------------------
CafePress Custom Store Script 1.0.16
-----------------------------------------
This script is designed to allow CafePress Basic (free) store owners to incorporate
their store into their own web site. This script can also be used with my random
item script which features any randomly selected item from your store(s) on any
page of your site.
Created and copyright by admin@notonebit.com Mar-23-2003
Last updated: Jan-13-2006
This code is released under the terms of the GNU General Public License
A copy of the GPL can be found at http://www.gnu.org/copyleft/gpl.html
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; either version 2
of the License, or (at your option) any later version.
Please retain this message at the top of this script if you modify it in any way.
---------------------------------------------------------------------------------
INSTRUCTIONS:
1. First, your web server must have PHP 4.1.0 or later installed for this script to function properly.
You must also be able to run the fsockopen() function.
2. This script will display all the products from the stores you specify on one page. Each item
is linked to a detailed version of itself using this same script. Items are retrieved in real time,
so if you have many items in many stores, your page may take several seconds to fully load all of
CafePress' hosted images.
3. To setup the script, edit the $stores variable below to be a list of your stores. THAT'S IT!
4. You can run this script as an include file within an existing PHP page, cutting-and-pasting the script
into your own PHP page, or as a standalone page. If you choose to run it as a standalone page, you'll
need to add the appropriate HTML around it in order for it to display properly ( etc...).
5. Rename this script to store.php.
Your feedback is welcomed. If you have any questions or comments please email me at scanman20@hotmail.com
-Admin
-------------- SCRIPT BEGINS AFTER THIS LINE -----------------------------------------------*/
// SET VARIABLES //
$start = '';
$end = '';
$stores = 'irish_shop'; //EDIT THIS VARIABLE TO BE A LIST OF YOUR STORES
$url = 'http://www.cafepress.com/';
$item = $_GET['item'];
// WRITE CAFEPRESS JAVASCRIPT TO PAGE //
echo '';
if ($item) { // Script has been called with a specific item, bring up detail page.
$detail = $url . $item;
$fp = fsockopen ("www.cafepress.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)
n";
} else {
fputs ($fp, "GET /$item HTTP/1.0rnHost: www.cafepress.comrnUser-Agent: MS Internet Explorerrnrn");
while (!feof($fp)) {
$content .= fgets($fp,1024);
}
fclose ($fp);
}
$null = eregi("$start(.*)$end", $content, $cparray);
$pattern = "//cp/";
$replacement = "http://www.cafepress.com/cp";
$itemdetail = preg_replace($pattern, $replacement, $cparray[1]);
$largeImgPattern = "/
$largeImgReplacement = "
$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 (very handy) and 3) change the link to the CP legal questions page //
// The view cart button can be found at http://www.notonebit.com/forum/viewtopic.php?t=95
$itemdetail = preg_replace("//i", "", $itemdetail);
$itemdetail = preg_replace("/
$itemdetail = preg_replace("/alt="Add to Cart">/", "alt="Add to Cart"> ", $itemdetail);
$itemdetail = preg_replace("/
$itemdetail = preg_replace("/src="/content//", "src="http://www.cafepress.com/content/", $itemdetail);
echo "";
echo "function e (z, h, w, b, g) {";
echo "document.write('')";
echo "}";
echo "";
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.0rnHost: www.cafepress.comrnUser-Agent: MS Internet Explorerrnrn";
$socket = @fsockopen("www.cafepress.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 = "/
$replacement = "
$storeitems = preg_replace($pattern, $replacement, $cparray[1]);
$storeitems = preg_replace("/src="/content/promo//", "src="http://www.cafepress.com/content/promo/", $storeitems);
$storeitems = preg_replace("//cp/img/saletag.gif/", "http://www.cafepress.com/cp/img/saletag.gif", $storeitems);
$storeitems = preg_replace("//cp/img/fathersday_prodtag.gif/", "http://www.cafepress.com/cp/img/fathersday_prodtag.gif", $storeitems);
$storeitems = preg_replace("//cp/popupsurvey.aspx/", "http://www.cafepress.com/cp/popupsurvey.aspx", $storeitems);
echo $storeitems;
}
//
//$display .= COM_endBlock(yes);
$display .= COM_siteFooter(yes); // use yes if you want the right blocks
echo $display;
?>
12
15
Quote
Theophile
Anonymous
Does anyone have the fix for the issue where the script attempts to load Cafepress images off your own server?
And please, if you're posting scripts, encompass id with the CODE tags. The post above mine is completely useless.
And please, if you're posting scripts, encompass id with the CODE tags. The post above mine is completely useless.
16
17
Quote
All times are EST. The time is now 10:43 pm.
- 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