Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 09-10-2007 01:36:15

Shopper
Member
Registered: 09-10-2007
Posts: 94

Remote API

Hi,
I am new to CCP and I've read the different posts for adding a remote "Add to Cart" button to our own catalog pages.

I've put the following form into the website:

<form action="/khxc/index.php" method="post" id="remoteadd" target="f1"  onclick="window.open('', 'f1', ''); focus();" />   
<input type="hidden" name="app" id="app" value="ccp0" />
<input type="hidden" name="ns" id="ns" value="addcart" />
<input type="hidden" name="cart_api" id="cart_api" value="Y" />
<input type="hidden" name="quantity" id="quantity" value="1" />
<input type="hidden" name="number" id="number" value="<?php echo $prod_id1; ?>" />
<input type="hidden" name="price" id="price" value="<?php echo $row_khxc1['regprice']; ?>" />
<input type="hidden" name="delivery_method" id="delivery_method" value="D" />
<input type="hidden" name="dlfile" id="dlfile" value="forward.php" />
<input type="hidden" name="usetaxcountry" id="usetaxcountry" value="1" />
<input type="hidden" name="usetaxstateprov" id="usetaxstateprov" value="0" />
<input type="submit" name="submit" value="Add to Cart" class="buy_button_1" />
</form>

and get the following reply:

"An error was encountered while adding the selected item to your shopping cart. Required information was not completed. Please try again."

Price, delivery method, downloadfile and tax information I've put in because it was recommended in different posts.

What am I missing and why do I have to submit all the information which I request from the CCP product database anyway?

When I submit only the first three lines, the quantity and the order number I get the same error message.

<form action="/khxc/index.php" method="post" id="remoteadd" target="f1"  onclick="window.open('', 'f1', ''); focus();" />   
<input type="hidden" name="app" id="app" value="ccp0" />
<input type="hidden" name="ns" id="ns" value="addcart" />
<input type="hidden" name="cart_api" id="cart_api" value="Y" />
<input type="hidden" name="quantity" id="quantity" value="1" />
<input type="hidden" name="number" id="number" value="<?php echo $prod_id1; ?>" />
<input type="submit" name="submit" value="Add to Cart" class="buy_button_1" />
</form>

On the admin pages I have set CCP to accept remote input to the shopping cart.

What do I have to change?
Thanks for any assistance.

Offline

 

#2 09-10-2007 03:01:53

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Remote API

Shopper wrote:

On the admin pages I have set CCP to accept remote input to the shopping cart.

Did you also put in the URL or partial URL where the remote requests will be coming from?

Offline

 

#3 09-10-2007 08:23:33

Shopper
Member
Registered: 09-10-2007
Posts: 94

Re: Remote API

Yes, I've put the main URL in it: wwwdigiworldtradecenter.com
Everything from there should be accepted. It's the same domain, where CCP is installed. CCP is installed in the folder khxc.

Offline

 

#4 09-10-2007 13:21:04

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Remote API

You will need to place the url for the page where the API is coming from in admin  Home > ClickCartPro > Settings: Application Settings Menu > Remote E-Commerce Settings > Allowed Remote Product Page URLs field, even if it is comeing from ccp itself, include both your secure and nonsecure url if they are different.

John

Offline

 

#5 09-10-2007 14:45:37

Shopper
Member
Registered: 09-10-2007
Posts: 94

Re: Remote API

Hello John,

now I've the following URLs in the Remote Settings:  http://www.digiworldtradecenter.com, https://www.digiworldtradecenter.com  and use the following form:

<form action="/khxc/index.php" method="post" id="remoteadd" target="f1"  onclick="window.open('', 'f1', ''); focus();" />   
<input type="hidden" name="app" id="app" value="ccp0" />
<input type="hidden" name="ns" id="ns" value="addcart" />
<input type="hidden" name="cart_api" id="cart_api" value="Y" />
<input type="hidden" name="quantity" id="quantity" value="1" />
<input type="hidden" name="id" id="id" value="<?php echo $prod_id1; ?>" />
<input type="submit" name="submit" value="Buy" class="buy_button_1" />
</form>

The php request gets the right order number from the table gbu0_prod and displays it in the source code of the website. This means that the form is complete and the article is in the database.

But still I get the error message. The shopping cart opens as expected and displays the error message.
Does the article have to belong to a category? I haven't defined any categories because I don't need them in the shopping cart.

For submitting the order number of the article I have set name=id and id=id. Is this correct?
<input type="hidden" name="id" id="id" value="<?php echo $prod_id1; ?>" />
Or do I need another field to get the article from the database?

Werner

Offline

 

#6 09-10-2007 16:22:06

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Remote API

Where are you getting the varaible $prod_id1, or what is it's value?

John

Offline

 

#7 09-10-2007 20:40:33

Shopper
Member
Registered: 09-10-2007
Posts: 94

Re: Remote API

Hello John,

I found the solution: I have copied the form of a ccp internal Add to Cart button and changed it the way we need it.
I think - but I'm not sure - it may be that the names and ids of the different form fields have to have the labeling as they are used for the ccp internal Add to Cart button.

Thanks to you and Dave for the assistance.

Werner

Offline

 

#8 09-11-2007 04:03:43

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Remote API

Werner, you may want to take a look at the example code for remote adding of items which you'll find in the {public}/media/ccp0/examples directory as productform.html.  It has all of the details you need.  Sorry for not posting this earlier but I wasn't in a position to find it for you.

Offline

 

#9 09-13-2007 14:41:32

Shopper
Member
Registered: 09-10-2007
Posts: 94

Re: Remote API

Thanks Dave, I found it.

Offline

 

#10 04-18-2008 12:46:26

kgillespie
Member
From: Sandy, Oregon
Registered: 06-10-2004
Posts: 164
Website

Re: Remote API

Looking for the way to add the discount code ability to a remote form for adding to the cart. The discount code works when you shop from within the main cart area but when i add an item from my remote html page it doesn't allow for the discount to work. The discount is setup as a specific product only. As the global discount codes does work without any special code in the remote form add to etc.. not sure why the "specific product" code wouldn't act the same.

Offline

 

Board footer