Post by kylebirk » Tue Jun 14, 2011 3:59 am

Hi, we are trying to integrate opencart with another website that allows users to fully customize the product before shipping.

we need to be able to send the variables from that site to opencart and have the product placed into the basket on opencart.

Is there away to send products from another site to opencart like this?

can it be done with url varibles? Through xml? I can program php, but I dont understand how the variables are handled in opencart.

heres an example of what i need to get done.

user selects product and product opens on sitea.com.
sitea.com sends variables via url string to siteb.com?item1=barstool&option1=black&price=2.50


any ideas?

Newbie

Posts

Joined
Tue Jun 14, 2011 3:54 am

Post by kylebirk » Wed Jun 15, 2011 2:53 am

just so you know, i figured it out, you can add to cart through an http post (like a form post)


What i did to figure this out was copy the source code from a product page, change out the button from the open cart on to a standard html submit button, out it up on another domain and it works perfectly to add that product to the cart, even with product options.

Newbie

Posts

Joined
Tue Jun 14, 2011 3:54 am

Post by pierrelejohn » Sat Jun 25, 2011 1:56 am

Can any one elaborate more on how to do this for 1.4.9

ive figured this much

Code: Select all

<form action="http://www.mysite.com/shop/index.php?route=checkout/cart" method="post">
<input type="hidden" name="quantity" value="1" />
<input type="hidden" name="product_id" value="50" />
<input type="submit" value="Add to Cart" />
</form>
which works perfectly when it doesn't have options, but when it does nothing shows

thanks

Newbie

Posts

Joined
Fri Jun 10, 2011 4:28 pm

Post by pierrelejohn » Sun Jun 26, 2011 5:35 pm

Anyone ?

Newbie

Posts

Joined
Fri Jun 10, 2011 4:28 pm

Post by pierrelejohn » Wed Jul 06, 2011 8:07 pm

please ???

Newbie

Posts

Joined
Fri Jun 10, 2011 4:28 pm

Post by ahadkhan » Sat Jul 16, 2011 12:25 am

kylebirk wrote:just so you know, i figured it out, you can add to cart through an http post (like a form post)


What i did to figure this out was copy the source code from a product page, change out the button from the open cart on to a standard html submit button, out it up on another domain and it works perfectly to add that product to the cart, even with product options.

Dear kylebirk, appreciate if you could share your product.php

thnaks,

Newbie

Posts

Joined
Sun May 01, 2011 12:45 am

Post by pierrelejohn » Mon Jul 18, 2011 9:43 pm

Think i've worked i out ..........

this is an example from my shop - so please adjust it for yourself.

if you go to the product page - then click view source you will see the form written (similer to below just messier) this will give you the product ids and option ids that you will need to use

Code: Select all

<form action="http://www.myshop.co.uk/shop/index.php?route=checkout/cart" method="post" enctype="multipart/form-data" id="product">
<b>Available Options:</b><br />
<table style="width: 100%;">
<tr>
<td>Colour:
 <select name="option[763]">
 <option value="1629">Black </option>
 <option value="1630">Green </option>
 </select></td>
 </tr>
 <tr>
<td>demo Amount:
 <select name="option[764]">
 <option value="1631">500 </option>
 <option value="1632">1000 +£10.00</option>
 </select></td>
 </tr>
<tr>
<td>Worm Type:
<select name="option[765]">
<option value="1633">size 10 </option>
<option value="1634">size 12 </option>
</select></td>
</tr>
<tr>
<td>Worm Voucher:
<select name="option[766]">
<option value="1635">yes</option>

<option value="1636">no +£2.00</option>
</select></td>
</tr>
<tr>
<td>Extra Delivery Options:
<select name="option[767]">
<option value="1637">Now </option>
<option value="1638">Saturday Delivery  (Surcharge Of) +£6.00 </option>
</select>
</td>
</tr>
</table>
 <div class="content"> Qty: <input type="text" name="quantity" size="3" value="1" />
    <input type="hidden" name="product_id" value="67" />
    <input name="submit" type="submit" value="Add to Cart" />

</div>
</form>
this works perfectly in my store, hope it helps someone

Newbie

Posts

Joined
Fri Jun 10, 2011 4:28 pm

Post by footprint » Tue Jul 19, 2011 1:44 am

Thanking you!

This code works perfectly!

Newbie

Posts

Joined
Mon Jul 18, 2011 5:43 am

Post by ronnieb » Fri Feb 15, 2013 1:56 am

can anyone get this to work in 1.5.5 ?

New member

Posts

Joined
Tue May 24, 2011 3:44 pm
Who is online

Users browsing this forum: No registered users and 11 guests