Print Page | Close Window

Add to cart from external site

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Customizing ProductCart
Forum Description: Exchange messages with other users that are customizing ProductCart.
URL: https://forum.productcart.com/forum_posts.asp?TID=634
Printed Date: 30-November-2024 at 8:05pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Add to cart from external site
Posted By: virtualimage
Subject: Add to cart from external site
Date Posted: 06-February-2007 at 11:12am
Hi,

I'd like the ability to create a link/button on an external site that will add a product to the cart. I receive an error message from PC when I try this.

Here's the link I tried http://66.232.122.250/sgi/pc/instPrd.asp?idproduct=14&add=1 - http://66.232.122.250/sgi/pc/instPrd.asp?idproduct=14&ad d=1

If you click this you'll receive an error saying that the item doesn't exist. If you then click it again, the product will be added to your cart. This leads me to believe that it's a session issue. Anyone know a way around this?

Thanks!

-Quinn



Replies:
Posted By: derekw
Date Posted: 26-March-2007 at 2:43pm

I am having the same problem adding an item from a page on the same server as the cart.The form I use to add the item is the same as provided in the PC documentation.  First you get a "product id not found" error, then when you try the second time it works, and the item is added to the cart. Anybody have a solution?



Posted By: virtualimage
Date Posted: 27-March-2007 at 1:16pm
Hey,

I solved this by building a "capture" page. The problem is that a session isn't started when trying to add the product. I only have this working with a link, not a form. Here's my code. Some items may not be required.

<%@language="VBScript"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>


<!--#INCLUDE FILE="../includes/settings.asp"-->
<!--#INCLUDE FILE="../includes/storeconstants.asp"-->
<!--#INCLUDE FILE="../includes/opendb.asp"-->
<!--#INCLUDE FILE="../includes/languages.asp"-->
<!--#INCLUDE FILE="../includes/currencyformatinc.asp"-->
<!--#INCLUDE FILE="../includes/shipFromSettings.asp"-->
<!--#INCLUDE FILE="../includes/taxsettings.asp"-->
<!--#INCLUDE FILE="../includes/languages_ship.asp"-->
<!--#INCLUDE FILE="../includes/adovbs.inc"-->
<!--#INCLUDE FILE="../includes/stringfunctions.asp"-->
<!--#include FILE="../includes/ErrorHandler.asp"-->
<!--#include FILE="../includes/pcProductOptionsCode.asp"-->
<%
Response.Buffer = True
'-------------------------------
' declare local variables
'-------------------------------

Dim conntemp, tIndex, tUpdPrd, pIdCategory, strBreadCrumb, pIdProduct, query, rs, dblpcCC_Price
Dim pcv_strViewPrdStyle, pcv_strFormAction, pcv_intValidationFile, pcv_blnBTOisConfig, iRewardPoints, pDescription, pMainProductName
Dim pSku, pconfigOnly, pserviceSpec, pPrice, pBtoBPrice, pDetails, pListPrice, plistHidden, pimageUrl, pLgimageURL
Dim pArequired, pBrequired, pStock, pWeight, pEmailText, pFormQuantity, pnoshipping, pcustom1, pcontent1
Dim pcustom2, pcontent2, pcustom3, pcontent3, pxfield1, px1req, pxfield2, px2req, pxfield3, px3req, pnoprices
Dim pIDBrand, psDesc, pNoStock, pnoshippingtext, intIdProduct, intWeight, optionA, optionB
Dim pcv_intHideBTOPrice, pcv_intQtyValidate, pcv_lngMinimumQty, intpHideDefConfig, pnotax, BrandName
Dim FirstCnt, strDescription, intReward, pcv_BTORP, strConfigProductCategory, dblPrice, dblWPrice, intIdCategory
Dim VardiscGo, dblQuantityFrom, dblQuantityUntil, dblPercentage, dblDiscountPerWUnit, dblDiscountPerUnit
Dim intIdOptOptGrp, intIdOption, strOptionDescrip, OptInActive, optPrice, tempIdOptA, tempIdOptB
Dim xrequired, xfieldCnt, reqstring, TextArea, widthoffield, rowlength
Dim scCS, cs_showprod, cs_showcart, cs_showimage, crossSellText
Dim pcv_strOptionGroupDesc, pcv_intOptionGroupCount, pcv_strOptionGroupCount, pcv_strOptionGroupID, pcv_strOptionRequired
Dim xOptionsCnt, pcv_strNumberValidations, pcv_strFuntionCall, pcv_strReqOptString, xOtionrequired, pcv_strCSDiscounts , pcv_strPrdDiscounts
Dim pcv_strProdImage_Url, pcv_strProdImage_LargeUrl, pcv_intProdImage_Columns, pcv_strShowImage_LargeUrl, pcv_strShowImage_Url, pcv_strCurrentUrl
Dim pcv_strAdditionalImages, cCounter, pcv_strWishListLink, BTOCharges, pcv_strCSString, pcv_strReqCSString, cs_RequiredIds, xCSCnt
Dim iAddDefaultWPrice, iAddDefaultPrice, pcv_intActive
'--> open database connection
call opendb()
%>
<!--#include file="pcStartSession.asp"-->

   
<%
     Response.Write Request.QueryString("idproduct")
     Response.Redirect("http://66.232.122.250/sgi/pc/instPr d.asp?idproduct="& Request.QueryString("idproduct"))
%>

</body>
</html>



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net