Zen Cart Logo
Forums / General Questions / Embeding product onto a 3rd party site

Embeding product onto a 3rd party site

Locked

Views: 9,933

Results 1 to 20 of 25
This thread is locked. New replies are disabled.
2 Jan 2008, 3:37 AM
#1
systemagic avatar

systemagic

New Zenner

Join Date:
Jan 2008
Posts:
11
Plugin Contributions:
0

Embeding product onto a 3rd party site

Hi All,

We are setting up a zc webs tore.

We have several web pages that feed into the cart for different purposes.

So for one instance: We have one site where we have one product for sell. We would like them to be able to click on the item and have it add to their cart.

So, we are looking for something like Amazon.com has where you see the product on a 3rd party site but the product's data is coming from Amazon.

Any suggestions?

Happy New Year!

Leonard

2 Jan 2008, 3:48 AM
#2
systemagic avatar

systemagic

New Zenner

Join Date:
Jan 2008
Posts:
11
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

I hit send too soon,

All of the domains we have are on the same server.

Question 1:
As far as posting the add to the cart, can we just have the form on the page with the button to say "add to cart"?

Question 2:
How can we get the data? I of course, can make an sql query to pull the data out and then embed the results with a PHP script, but is there a "right" way?

Happy New Year!

Leonard

2 Jan 2008, 3:50 AM
#3
afo avatar

afo

Totally Zenned

Join Date:
Aug 2004
Location:
New York City
Posts:
6,800
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

Zen Cart is not a backend operation. I suppose there might be a way to do what you want, but it's not the way Zen Cart is designed to be used.

2 Jan 2008, 11:40 AM
#4
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

Short answer: no, you can not do that.
Long answer: nothing is impossible, yes you can do that. You will have to check how ZC add product to cart, you will also see how it uses session id to store the cart content, and see if you can somehow do that, please note that sessions can not be shared across domains (for a very good reason)

2 Jan 2008, 11:46 AM
#5
misty avatar

misty

Inactive

Join Date:
Apr 2004
Location:
UK
Posts:
5,752
Plugin Contributions:
1

Re: Embeding product onto a 3rd party site

Closest option is to show rss feed from your zencart onto an external
site i.e.
http://www.dezinashop.com/demo/
Second box on right shows rss feed to another zencart site on
different server

2 Jan 2008, 6:22 PM
#6
systemagic avatar

systemagic

New Zenner

Join Date:
Jan 2008
Posts:
11
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

HI All,

What I have done sofar is create a non-zc script that queries the database based upon a products_id passed to it, then reply with an html doc that can be read with my php script and inserted into the third party webpage.

Thanks for the replies.

16 Jan 2008, 10:23 PM
#7
knighs2 avatar

knighs2

New Zenner

Join Date:
May 2007
Posts:
42
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

Do you have a website where we can see this working ?

Thanks

19 Jan 2008, 4:20 PM
#8
kadesign avatar

kadesign

Totally Zenned

Join Date:
Feb 2005
Location:
New Jersey
Posts:
593
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

Hi systemagic,

I downloaded your script but unfortunately I'm a little confused on how you actually implement it.
Would you please elaborate on the instructions??

Thanks in advance,
Kelly

19 Jan 2008, 4:31 PM
#9
kadesign avatar

kadesign

Totally Zenned

Join Date:
Feb 2005
Location:
New Jersey
Posts:
593
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

Nevermind...I got it. :blush: Not enough caffeine yet...

Thanks,
Kelly

19 Jan 2008, 4:46 PM
#10
kadesign avatar

kadesign

Totally Zenned

Join Date:
Feb 2005
Location:
New Jersey
Posts:
593
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

One more question...What is the best way to display the items on the 3rd party page? How do I show them?

Thanks,
Kelly

19 Jan 2008, 9:00 PM
#11
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Embeding product onto a 3rd party site

@systemagic

Sorry that I didn't stumble into this thread earlier. Apologies to those well-meaning Zen Carters who tried to help you earlier, but the correct answer to this question is YES, you can do exactly what you asked in your original post.

I'm doing exactly on a site where the client has another designer doing a flash front end with a buy now button that needs to jump the visitor into the shopping cart with the product sitting there ready for checkout.

I was chatting to an SEO consultant recently who told me that he favors Zen Cart because he can build search friendly microsites for a product or group of products and build in links to Zen Cart for all the complicated cart and account stuff.

So how is this done ...?

Well the product must exist in the Zen Cart database, If it has attributes you will want to make sure they're set up too. Then all you do is create a link on your external site to:> www . yourzencart . com/index.php?main_page=index&action=buy_now&products_id=???
When your visitor clicks on this link they will jump into Zen Cart which will spot the buy now action and take the visitor the product_info page if there are attributes that need choosing, or straight to the shopping cart page otherwise.

The only other change that you might want to make is to disable the continue shopping button on your shopping cart page, though that may still be appropriate, depending upon your circumstances.

19 Jan 2008, 11:30 PM
#12
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: Embeding product onto a 3rd party site

Thats a kool thing, however what happens if they go back where they were before,
does the session carry, or does it drop?

19 Jan 2008, 11:45 PM
#13
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Embeding product onto a 3rd party site

If the visitor presses the back to shopping button, they'll end up back at the main index page. If they press the browser back button, they'll go back to the original site, but the session will still be active if they return to the Zen Cart in the same browser window before the session expires. So for example if they came to the home page of a default installation, they would see the shopping cart link indicating goods waiting to be checked out.

This is the magic of some little known, highly cunning and rarely mentioned code early in the process of constructing a Zen Cart page. Neat huh?

12 May 2008, 5:13 PM
#14
bigbadboy avatar

bigbadboy

Totally Zenned

Join Date:
Apr 2008
Location:
London
Posts:
557
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

I'm looking for a way to do this but with a specific category.
Why? My client has a complicated product info page with has a lot of attributes plus needs to include the ability to select something from another category at the same time.

Using something like:
Quote:
www . yourzencart . com/index.php?main_page=index&action=buy_now&products_ id=???

But with categories might just work.

27 Jun 2008, 5:56 PM
#15
sensory avatar

sensory

New Zenner

Join Date:
May 2008
Posts:
5
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

Hi All
Here is how I did it.

<body> <script language="JavaScript" src="http://www.sensorycraver.com/embedjs.php?products_id=589" type="text/javascript"> </script> </body>

This will pull the info from your the shopping cart.

Download the file embedjs.php to the second domain. Here is the link to the file Embed Products onto 3rd Party Site.
Hope this helps.

Sensory
https://www.sensorycritters.com
https://www.sensorycraver.com
https://www.scpropackage.com

31 Mar 2009, 6:26 PM
#16
traypup avatar

traypup

New Zenner

Join Date:
May 2007
Posts:
56
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

Oh man, this is perfect for what I need to do, with a few tweaks, but I'm not sure how to tweak it.

  1. I want to embed a random number of product that are in the "new products" category into the non-cart pages of my client's site. Preferably in the sidebar, sitewide, so that customers will see something random and new on any page of the site.

  2. When the page refreshes, different products will show up.

I am baffled and would love some input on this.
Thanks,
Tracey

7 Jun 2009, 6:34 AM
#17
xtracool avatar

xtracool

New Zenner

Join Date:
Feb 2009
Posts:
46
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

Hello All,

I used the script that Sensory sugested

<script language="JavaScript" src="http://www.xtracool.com.au/zencart/embedjs.php?products_id=184" type="text/javascript"> </script>

and it works OK but

I have a special price of $170 set in the Products Price Manager in Admin, however only the the usual price of $190 is displayed
and
When I click on "Buy now" the product is not added to the cart. Instead the cart is displayed with "Your Shopping Cart is Empty"

Any advice on how to fix these would be appreciated
url is https://www.xtracool.com.au/TestEmbed
I am using Zencart V.1.3.8
Regards
Alan

10 Jun 2009, 10:48 AM
#18
xtracool avatar

xtracool

New Zenner

Join Date:
Feb 2009
Posts:
46
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

xtracool:

Hello All,

I used the script that Sensory sugested

<script language="JavaScript" src="http://www.xtracool.com.au/zencart/embedjs.php?products_id=184" type="text/javascript"> </script>

and it works OK but

I have a special price of $170 set in the Products Price Manager in Admin, however only the the usual price of $190 is displayed
and
When I click on "Buy now" the product is not added to the cart. Instead the cart is displayed with "Your Shopping Cart is Empty"

Any advice on how to fix these would be appreciated
url is https://www.xtracool.com.au/TestEmbed
I am using Zencart V.1.3.8
Regards
Alan

Further to my post, I have been able to find how to change the code in embedjs.php ( from the Embed Products onto 3rd Party Site module) to pull info from the products database.

Line23 $line[] = sprintf("%.2f",$product->fields['products_price']);

Can be changed to

Line23 $line[] = sprintf("%.2f",$product->fields['products_weight']);
and It retreives the product weight ok

but when I change Line 23 to
$line[] = sprintf("%.2f",$product->fields['specials_price']);
it does not retrieve the special price from the products cataloge.

I would appreciate it if someone can confirm for me the database field name for the product special price (if I don't have it right).

Also would appreciate some code to display the special price if one is available , and not display if a special price is not available

Thanks in advance
Alan

12 Jun 2009, 11:43 AM
#19
xtracool avatar

xtracool

New Zenner

Join Date:
Feb 2009
Posts:
46
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

xtracool:

Further to my post, I have been able to find how to change the code in embedjs.php ( from the Embed Products onto 3rd Party Site module) to pull info from the products database.

Line23 $line[] = sprintf("%.2f",$product->fields['products_price']);

Can be changed to

Line23 $line[] = sprintf("%.2f",$product->fields['products_weight']);
and It retreives the product weight ok

but when I change Line 23 to
$line[] = sprintf("%.2f",$product->fields['specials_price']);
it does not retrieve the special price from the products cataloge.

I would appreciate it if someone can confirm for me the database field name for the product special price (if I don't have it right).

Also would appreciate some code to display the special price if one is available , and not display if a special price is not available

Thanks in advance
Alan

I'm getting there....... But I still need some assistance please

I have managed to display the special price (see http://www.xtracool.com.au/TestEmbed) by creating through trial and error (I know nothing about javascript) an additional PHP file (embedjsss.php) with the following code

<body> $pID = zen_db_prepare_input($_REQUEST['products_id']); $special = $db->Execute("select * from specials where products_id ='" . (int)$pID . "'");

while (!$special->EOF){
if ($special['status'] !== "1"){
$line[] = "Special Price: $";
$line[] = sprintf("%.2f",$special->fields['specials_new_products_price']);

}

{

$line[] =  "<br />Available Until $";
$line[] =  sprintf("%.2f",$special->fields['expires_date']);

}

break;
}
foreach ($line as $print){

print "document.write('";
print $print;
print "');\n";

}

</body>

Now I need to change the following - and would appreciate some help please - I have spent hours googling javascript but have not found the answers

1/ Display the Available Until Date as dd/mm/yyyy
2/ provide a line break after the image so that the price is on the next line
3/ get rid of the space between the buy now button and the following line
4/ some code to strikeout the normal price (with a line through it) f there is a special price
5/ change the color of the special price to red

And then I think I'm done.

Thanks in advance

Alan
Xtracool

14 Jun 2009, 10:24 PM
#20
xtracool avatar

xtracool

New Zenner

Join Date:
Feb 2009
Posts:
46
Plugin Contributions:
0

Re: Embeding product onto a 3rd party site

Its OK .. I have found and modified everything I needed to do

Just a note for anyone reading this thread that may have trouble getting the add to cart part working, I found that as well as changing the URL's to your own store, I had to add in the www as well to make it work

ie

$image = "<img src="http://shopilm.com/images/";
and
$url = "http://shopilm.com/index.php?";

become

$image = "<img src="http://www.yourshop.com/images/";
and
$url = "http://www.yourshop.com/index.php?";

Alan