Forums / All Other Contributions/Addons / Embed Products onto 3rd Party Site

Embed Products onto 3rd Party Site

Locked

Views: 3,575

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
2 Feb 2008, 10:17 PM
#1
beth_katherine avatar

beth_katherine

Zen Follower

Join Date:
Feb 2007
Posts:
158
Plugin Contributions:
0

Embed Products onto 3rd Party Site

Has anyone worked with this module yet? I would love to use it as it seems to be the perfect solution for integrating my old site's style of newsletters with products but for me there is not enough information on how to work it into pages.

Beth-katherine

27 Feb 2008, 10:50 PM
#2
andyii avatar

andyii

Zen Follower

Join Date:
Mar 2007
Posts:
153
Plugin Contributions:
0

Re: Embed Products onto 3rd Party Site

I would like to know more about it too, I downloaded the mod, its 1 file with little to no instructions except 'upload to path.
It has another site listed in the variables and not how to use, seems pretty hard to use, wouldn't find it in the admin section for each store.

19 Apr 2008, 9:38 PM
#3
divaboutiques avatar

divaboutiques

Zen Follower

Join Date:
Feb 2007
Location:
Worldwide Web
Posts:
191
Plugin Contributions:
0

Re: Embed Products onto 3rd Party Site

I wanted to know if there was any more information on using this module as the information that was given for this module is not enough information for the not so experience users.

Instructions:
Upload this file to domain.ext/zen/cart/path/embed.php
Then execute http://www.domain.ext/zen/cart/path/embed.php?products_id=3

Can someone explain where I would put this at I don't kow where these files are located?

Diva Boutiques
www.divaboutiques.com

20 Apr 2008, 2:57 PM
#4
beth_katherine avatar

beth_katherine

Zen Follower

Join Date:
Feb 2007
Posts:
158
Plugin Contributions:
0

Re: Embed Products onto 3rd Party Site

The best advice is to read back a few pages of posts and then start from the beginning to get a sense of how to use this template.

HOWEVER I am still a bit confused as to HOW to use this template.

From what I gather you insert the code wherever you want ZEN CART to be shown on an html document BUT what I would appreciate is a bit of more detailed info as to how this is done.

My goal is to SELL products from EZ PAGES in a newsletter manner just like the way I am able to do with regular plain ole html. From my readings of previous posts I understand that once you leave the Zen-Cart environment you loose everything in your shopping cart. This is true when you open up a new page but is it true when you open up a new tab?

Is this the way it is done?

Beth-katherine

14 Jul 2008, 3:54 AM
#5
trillian avatar

trillian

Zen Follower

Join Date:
Jun 2005
Location:
London, UK
Posts:
141
Plugin Contributions:
0

Re: Embed Products onto 3rd Party Site

Well, I can't get it to work at all.

I uploaded the embedjs.php file to my zencart directory (after updating the image file paths in the script to the my store details).

I then put the script on a test page but nothing happens (and the script is definitely modified to the path to the embedjs.php file).

It seems simple but obviously I am missing something that is not fully explained.

22 Feb 2009, 12:15 AM
#6
greepers avatar

greepers

New Zenner

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

Re: Embed Products onto 3rd Party Site

HELLO, i am using the code below for displaying the item on a third party site.

But the price is excluding VAT,

What am i doing wrong?
For example:

http://www.snelleveters.nl/embed.php?products_id=2
who can help?

<?php
/*


Instructions:
Upload this file to domain.ext/zen/cart/path/embed.php
Then execute http://www.domain.ext/zen/cart/path/embed.php?products_id=3

The Following variables can be included in the URL.

'showprice'  => &showprice=hide will hide the price
'showqty'    => &showqty=hide will hide the quantity
'showsubmit' => &showsubmit=hide will not allow the item to be added directly into the cart

*/




//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce                                       |
// |Module: Embeding Products onto 3rd Party Sites  0.20                  |
// |File: Including file with PHP                                         |
// +----------------------------------------------------------------------+
// | Copyright (c) 2008 Leonard Burton [email protected]            |
// | This code can be seen to work at http://24hourskin.com               |
// | Which adds the item to the cart at http://shopilm.com                |
// | Released under GPL 2.0                                               |
// |                                                                      |
// | http://www.zen-cart.com/index.php                                    |
// |                                                                      |
// | Portions Copyright (c) 2003 osCommerce                               |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | [email protected] so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
//  $Id: packingslip.php 6251 2007-04-22 19:21:48Z wilt $
//

  require('includes/application_top.php');


  $pID = zen_db_prepare_input($_REQUEST['products_id']);
  $product = $db->Execute("select * from products where products_id ='" . (int)$pID . "'");

while (!$product->EOF){
$image  = "<img src='http://www.snelleveters.nl/images/";
$image .= "{$product->fields['products_image']}' width=150/>";

$url  = "http://www.snelleveters.nl/index.php?";
$url .= "main_page=product_info";
$url .= "&products_id={$product->fields['products_id']}";
$url .= "&action=buy_now";

if ($_GET['showsubmit'] !== "hide"){
	print "<form method='post' ";
	print "action='$url'>\n";
}

print "$image\n";
if ($_GET['showprice'] !== "hide"){

        print "<br />Prijs: €";
        print sprintf("%.2f",$product->fields['products_price']);
        print "<input type='hidden' name='cart_quantity' value=1>\n";
}


print "<input type='hidden' name='products_id' ";
print "value={$product->fields['products_id']}>\n";

print "<br />";
if ($_GET['showqty'] !== "hide"){
        print "<input type='text' name='cart_quantity' value=1 size='4' />\n";
}
if ($_GET['showsubmit'] !== "hide"){
	print "<input type='submit' name='submit' value='Nu bestellen!'>\n";
	print "</form>";
}

break;
}






?>
23 Apr 2009, 9:21 AM
#7
minddigger avatar

minddigger

New Zenner

Join Date:
Nov 2008
Posts:
4
Plugin Contributions:
0

Re: Embed Products onto 3rd Party Site

Hello, you do nothing wrong, except the script is not complete to show prices inclusive VAT. :ohmy:
As you can see, it requests only the products fields and the product_price is the price exclusive VAT.
To include VAT you have to extend the query to get the tax_rate (from the tax_rates table) as well and calculate the price inclusive VAT (don't forget to mention the TAX as well: it's mandatory in the Netherlands as far as I know).

Now my problem with this script :dontgetit:
When I execute it, I get the webstore, but no product added to the shop-cart.
Just a message telling that the shop-cart is empty :huh:.
As I study the call to the webshop for a add_product action, the parameter cPath=... is also included in the URL, and not in the call from within the script :ohmy:.
But even when I add this parameter to the script, it still doesn't add the product to a shop-cart... Am I forgetting something :(??

Does anyone know if Zencart has a restriction in adding products to the shop-cart from within another website?

2 May 2009, 3:13 PM
#8
mbheald avatar

mbheald

New Zenner

Join Date:
Feb 2007
Posts:
28
Plugin Contributions:
0

Re: Embed Products onto 3rd Party Site

I uploaded the files (2) to the root folder of the website and I cannot get the embed function to work. Can anyone add a link to show that they have successfully made this mod work? I seem to get an error: http://www.hotnbottled.com/embed.php?products_id=1136

Matthew Heald
All Hot N' Bottled - Retail
http://hotnbottled.com

Hot Shots Hot Sauce - Wholesale
http://hotshotshotsauce.com

3 May 2009, 12:49 PM
#9
minddigger avatar

minddigger

New Zenner

Join Date:
Nov 2008
Posts:
4
Plugin Contributions:
0

Re: Embed Products onto 3rd Party Site

Hello mbheald, As I klick on your link I got a message :
1146 Table 'hotnbott_zc2.products' doesn't exist
in:
[select * from products where products_id ='1136']

When you have a PREFIX entered on your install of Zencart (before the tablename), you have to add the prefix as well in the query. This is not done by the original developper of the embed.php.
You also can change the code of embed.php line

$product = $db->Execute("select * from products where products_id ='" . (int)$pID . "'");

to

$product = $db->Execute("select * from ".TABLE_PRODUCTS." where products_id ='" . (int)$pID . "'");

wich also will solve this issue....

6 May 2009, 11:24 PM
#10
mbheald avatar

mbheald

New Zenner

Join Date:
Feb 2007
Posts:
28
Plugin Contributions:
0

Re: Embed Products onto 3rd Party Site

minddigger:

Hello mbheald, As I klick on your link I got a message :
1146 Table 'hotnbott_zc2.products' doesn't exist
in:
[select * from products where products_id ='1136']

When you have a PREFIX entered on your install of Zencart (before the tablename), you have to add the prefix as well in the query. This is not done by the original developper of the embed.php.
You also can change the code of embed.php line

$product = $db->Execute("select * from products where products_id ='" . (int)$pID . "'");

to

$product = $db->Execute("select * from ".TABLE_PRODUCTS." where products_id ='" . (int)$pID . "'");

wich also will solve this issue....

Thank you, this solved my problem. I also noticed that on both embed.php and embedjs.php you must change the website to match your url in order for your products to display correctly.

embed.php
Line 53 and 56: $image = "<img src='http://shopilm.com/images/"; should be changed to: $image = "<img src='http://YOUR_WEBSITE.com/images/";

embedjs.php
Line 57 and 60

I am now having a second problem... I tried adding the Javascript into a basic HTML site that I would like to display products on, but the code did not show anything on the website. https://www.asskickinshop.com

Here is how I implemented the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>###### Kickin Shop - hotnbottled.com</title> </head> <body> <script language="JavaScript" src="http://www.hotnbottled.com/embed.php?products_id=1136" type="text/javascript"></script> </body> </html>

Matthew Heald
All Hot N' Bottled - Retail
http://hotnbottled.com

Hot Shots Hot Sauce - Wholesale
http://hotshotshotsauce.com