marty.net 1001 Postcards Love Love Love Meep Meep ZenZodiac DailyQuotation

YOU ARE HERE:
How to embed cpshop in a PHP page

HOME

CPSHOP|

|

|

EMAIL MARTY
  marty.net message board
  « How to embed cpshop in a PHP page »
Welcome, Guest. Please Login or Register.
12/14/17 at 08:06:56
Home Help Search Login Register
   marty.net message board
   About cpshop
   Tutorials
   How to embed cpshop in a PHP page
(Moderator: Marty)
Pages: « 1 2 3 4 5 6 7 » Reply Notify of replies Send the topic Print 
   Author  Topic: How to embed cpshop in a PHP page  (Read 64368 times)
anton
White Dragon
**

Gender: male
Posts: 11



My Body Is A Temple.  Respect My Freedom of Religion.
   

WWW E-Mail
Re: How to embed cpshop in a PHP page
« Reply #45 on: 12/20/04 at 03:08:28 »
Reply with quote Modify message



on 07/27/02 at 22:34:39, Marty wrote:
Here's an idea: try setting the Clean URLs variable to "No".  I have a feeling that might be the problem.


Ah, now this solution HAS worked for me!  I originally ignored it because it hadn't worked for SmokinL...
Logged
anton
White Dragon
**

Gender: male
Posts: 11



My Body Is A Temple.  Respect My Freedom of Religion.
   

WWW E-Mail
Re: How to embed cpshop in a PHP page
« Reply #46 on: 12/20/04 at 04:09:52 »
Reply with quote Modify message

Okay, been testing it and found some other problem related to the embedding (I know its related to the embedding because the problem didn't happen when I was accessing the cpshop directly)

The problem is to do with the 'breadcrumbs'. Now I could turn the things off, but I think they are a useful navigation feature (at least they are when they work).  

This is the front page of the cafepress section of my shop (I also have some Amazon affiliate stuff and other things, so cpshop is just a subsection of the overall shop):

http://www.kiamagic.com/eitp/cafepress.php

As you can see the breadcrumbs read:
EyeInThePyramid > Stuff

Clicking through to any subsection and 'Stuff' should become a link back the menu.  But for some reason it now duplicates the main Home Page link...

...as I say, the 'Stuff' link worked fine accessing directly.  Actually it doesn't any more.  Hmm, obviously something I had to change when a configured it to be embedded in php has affected where the 'Stuff' link points to.

Any one got any ideas?
Logged
anton
White Dragon
**

Gender: male
Posts: 11



My Body Is A Temple.  Respect My Freedom of Religion.
   

WWW E-Mail
Re: How to embed cpshop in a PHP page
« Reply #47 on: 12/21/04 at 11:18:03 »
Reply with quote Modify message

I feel a bit foolish now, the breadcrumb problem was really easy to solve.  I guess I was just tired that night.  I should think before I post in future.

Basically, because I turned on the 'Homepage as SSI' option, I needed to make sure the page listed as my homepage was indeed the page that included the cpshop.

The bit that says 'Eye In The Pyramid' at the start of my breadcrumb trail is the 'start breadcrumb link with this text:' option.
Logged
Heather
Green Dragon
*

Gender: female
Posts: 7




   

WWW E-Mail
Re: How to embed cpshop in a PHP page
« Reply #48 on: 07/16/05 at 16:02:58 »
Reply with quote Modify message

Ok, trying to change mine over to PHP.  I've done the changes to the cpshop.cgi page - it seems to work, as I can load that page and view my shop just fine.  The problem is with the template...

Here's the code I'm using on my template:

<?php
$qs = urlencode($HTTP_SERVER_VARS['QUERY_STRING']);
$str = `/home/public_html/cgi-bin/store/cpshop.cgi http://www.contraryaspects.com/whimsy/store.php http://www.contraryaspects.com/cgi-bin/store/cpshop.cgi $qs`;
echo $str;
?>

But all I get is a blank spot in the code where this should occur, as if the str variable is empty or something.  

The PHP Config for my server shows that safe_mode should be turned off.  

I'm not sure what else to look at, could someone please help?

Thanks!

- Heather
Logged

- Heather

Contrary Aspects: http://www.contraryaspects.com
Heather
Green Dragon
*

Gender: female
Posts: 7




   

WWW E-Mail
Re: How to embed cpshop in a PHP page
« Reply #49 on: 07/16/05 at 18:24:04 »
Reply with quote Modify message

Nevermind on my question, I fixed it.

Odd thing - I put in a new template with the content tag, it didn't work.  And I DID switch it to the correct one in the admin menu.  Anyway, I stripped everything away from the prior template but the content tag, and now it works... for all I can tell, they're identical, but ... *shrug*  Whatever works  
Logged

- Heather

Contrary Aspects: http://www.contraryaspects.com
Joseph M. Boy,CPC
Guest

E-Mail
Embedding php code in the shop
« Reply #50 on: 09/09/05 at 22:48:02 »
Reply with quote Modify message

Ok I see how to embed the shop in a current php code and it works with some tweaking and you have to show the variables in the address bar (unsecure) but it is better than nothing. I am hoping to do the other way around.  I wanted to use a php file as a template file.  That way my menu can be made in php and I can include all my database info in the template.  Also when I change part of the page the template will change automatically.  Also if we are able to use a php file in the template we could then use php code in the product thumbnail grid layout code (which is my main objective) See if I put some php code in the product thumbnail grid layout I could change the frame of the product to be different per product on a row.  For example on my site I want to have each shirt in a round white circle with a random display of butterflys around it.  But if I put that code in the admin area it would be the same array of butterflies for each product.  But if I could use php in there I can make 20 different backdrops for the products and tell write the code to randomly pick one of the twenty and check to ensure that no two products have the same background that are next to each other.  It would also allow me to do alot more with the images and different effects that I use in php.

Joseph M. Boy,CPC
President
Your Computer Solutions Inc.
www.yourcomputersolutions.net
AKA
Breaker
Executive Director
SolgamesUSA Foundation
www.soglamesusa.com

cpshop working on is in temp location at:
http://www.solgamesusa.dyndns.org/www/faftshirts/store.php
Logged
Marty
Administrator Dragon
*****

Gender: male
Posts: a whole lot



That's me. :)
   

WWW E-Mail
Re: How to embed cpshop in a PHP page
« Reply #51 on: 09/10/05 at 00:50:06 »
Reply with quote Modify message

You can certainly use php as the template as well.  I'd make it a different php page entirely, and reference it as a fully-qualified URL in the Default HTML Template field.  That would allow PHP to do all the pre-processing of the page surrounding the cpshop code.

As for running PHP within cpshop, that's a totally different thing.  cpshop is a perl script, meaning the best you could do would be to use the php wrapper page to call cpshop, and then parse the output.  I wouldn't recommend it.
Logged

--
Regards,
Marty·.¸¸.·´¯`·.¸¸.-> marty@marty.net
Joseph M. Boy,CPC
Guest

E-Mail
Re: How to embed cpshop in a PHP page
« Reply #52 on: 09/10/05 at 09:35:39 »
Reply with quote Modify message

Yeah I thought of that yesterday and tried it but it would not process the php.  Instead it was treating it as a regular html file.  (And yes I have the php tags in place) Hence the reason for the question.  But since it does not allow me to put a variable in the fields of the admin page it really does not make much of a difference.  So then I only other solution is to ask is there a way in perl that I can make a variable that would produce an image. (like back01.jpg,back02.jpg,back03.jpg) where the only variable part is the number.  Then set up a randomizer in perl that will choose a number between 01 and an ending number.  This would allow me to have a changing border around my products. Any ideas. Usually I would pull the background file names from a database. (but I have NO idea how to use mysql with perl) So to make it easy I will just have to work with a variable if you can so me how to insert a variable with some perl script inside the code of the product display grid. Thanks for any ideas.

Joseph M. Boy,CPC
President
Your Computer Solutions Inc.
www.yourcomputersolutions.net
AKA
Breaker
Executive Director
SolgamesUSA Foundation
www.solgamesusa.com

cpshop working on is in temp location at:
http://www.solgamesusa.dyndns.org/www/faftshirts/store.php
Logged
Marty
Administrator Dragon
*****

Gender: male
Posts: a whole lot



That's me. :)
   

WWW E-Mail
Re: How to embed cpshop in a PHP page
« Reply #53 on: 09/10/05 at 13:18:58 »
Reply with quote Modify message

Were you referencing the php template as a file or a URL?  

In that case, the Default HTML Template field should be something like:
http://www.solgamesusa.dyndns.org/www/faftshirts/storetemplate.php

And not like:
C:/Apache2/htdocs/WWW/faftshirts/storetemplate.php
Logged

--
Regards,
Marty·.¸¸.·´¯`·.¸¸.-> marty@marty.net
Joseph M. Boy,CPC
Guest

E-Mail
Re: How to embed cpshop in a PHP page
« Reply #54 on: 09/13/05 at 23:33:32 »
Reply with quote Modify message

Yeah I tried that but it would instead not process the php commands. And it would display the <?php tags
Logged
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: How to embed cpshop in a PHP page
« Reply #55 on: 02/18/06 at 21:00:13 »
Reply with quote Modify message

EDIT:  


Hey marty, please add


 Set the Clean URLs variable to "No".  


to the initial post in this tutorial. It's a necessary step.

Brilliant solution, btw. This is going to be very, very useful.
« Last Edit: 02/21/06 at 20:16:14 by Hex Angel - Patrick » Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: How to embed cpshop in a PHP page
« Reply #56 on: 02/21/06 at 20:54:56 »
Reply with quote Modify message

I'm trying to embed cpshop in a script. The problem I'm running into is the script uses query strings as well, and the cpshop embed code isn't passing these through back to it.

Am I doing something wrong?

p.
Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: How to embed cpshop in a PHP page
« Reply #57 on: 02/25/06 at 14:09:18 »
Reply with quote Modify message

Still plugging away at this query string issue, but it's getting frustrating.

I have, however, discovered an apparent bug.

1> $HTTP_SERVER_VARS['QUERY_STRING'] always returns NULL.

At least on my server (FreeBSD + Apache). In that setup, at least, this statement must be coded as

 $qs = urlencode($_SERVER['QUERY_STRING']);


The script I'm embedding cpshop into uses the query string to pass vars. The cpshop embed code is not appending the query string to the links it generates.

For example, visit the following test page

http://www.tshirtcalendar.com/test.php?xxx=yyy

Note that this generates a page with links to a number of cpshop storeids, all of the form

http://www.tshirtcalendar.com/test.php?i=cpstoreid

For the script these are to be embedded in to work properly, I need them to be of the form

http://www.tshirtcalendar.com/test.php?i=cpstoreid&xxx=yyy

What do I need to do to get this to happen?

Development of my site is frustratingly stymied until I can resolve this issue.

Cheers,

p.
Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
sdimbert
Green Dragon
*

Posts: 8



Go Scots!
   

E-Mail
Re: How to embed cpshop in a PHP page
« Reply #58 on: 03/26/06 at 14:48:17 »
Reply with quote Modify message

Marty,

I've got the script working in a WordPress page; you can see it here:

http://www.biav.org/web/test-shop/

Problem is that, when you click on a product, you get the same page over and over again. Another user had this problem, but I think my issue is unrelated to his.

You see, in WordPress, "pages" are called from the database every time they are loaded. So, I'm not really embedding cpshop in a php file... I'm embedding it in a sql -generated page. Should that matter?

The issue is that the URL of the page is actually not the name of a php file... it's a pointer. See the issue?

Help?
Logged
Marty
Administrator Dragon
*****

Gender: male
Posts: a whole lot



That's me. :)
   

WWW E-Mail
Re: How to embed cpshop in a PHP page
« Reply #59 on: 03/26/06 at 22:39:02 »
Reply with quote Modify message

Uh...I don't see it.
Logged

--
Regards,
Marty·.¸¸.·´¯`·.¸¸.-> marty@marty.net
Pages: « 1 2 3 4 5 6 7 » Reply Notify of replies Send the topic Print 
Jump to:


marty.net message board (http://www.marty.net/cgi/marty/board/messageboard)

Powered by YaBB 1 Gold - Release (Yet Another Bulletin Board)
Copyright © 2000-2001, X-Null. All Rights Reserved.