Dynamically adding items to cart/receiving response

General ShopSite user discussion

Dynamically adding items to cart/receiving response

Postby d_day » Sun Jul 24, 2011 3:56 pm

I searched the forum and knowledge base and couldn't find information on my questions.

I have installed a ShopSite site in our HostMonster account to handle the eCommerce of the website running on another server. I selected the orderanywhere option since we only need eCommerce. This seemed like it would meet our needs until I realized that we need to recieve and store the feedback from the payment processing vendor in our local database to track our customers status (whether the payment was approved or not) so we can either provide the service being sold on the website if the payment is approved, basically to enable the users account.

Question 1: Can a list be looped through to add products to the shopping cart and not force the user to click a button for each item?

Question 2: Is there a way to return the browser to the original site once processing is complete with the feedback from the payment processing. The ideal situation for us would be that once the customer clicks the button to complete the order and the response is received from the payment processing, the browser would be redirected back to the original site with the feedback from the payment processor and we would display a response screen based on the outcome (thank-you for your order or sorry your transaction failed).

If that is not possible, would the ShopSite API be able to handle these requirements? When installing the ShopSite site I didn't see that as one of the options.

Please let me know if you need additional information or a better explanation of what is needed.
d_day
 
Posts: 1
Joined: Sun Jul 24, 2011 3:32 pm

Re: Dynamically adding items to cart/receiving response

Postby ShopSite Lauren » Mon Jul 25, 2011 9:49 am

For your first question, you can setup a multi-add-to-cart button on your website. With the OrderAnywhere buttons, are they hrefs or forms? If they are hrefs, then you will want to go to Products > Edit Product Layout, and check the checkbox to display the product's ordering options. This will make the OrderAnywhere buttons forms instead of hrefs. Once you have forms, you can copy the form and paste it where you would like on your website. You can then add additional products that need to be added to the cart, but adding the following line of code within the form, and changing [product itemnum] with the itemnum or the additional products. You can view the other product's OrderAnywhere HTML to get the itemnum.

<input type="hidden" name="itemnum" value="[product itemnum]">

For example, if you want to add 3 products to the cart, with the itemnums 34, 11, and 59, the code would look similar to the following:

<form action="http://beta.shopsite.com/cgi-bin/internal/sc/order.cgi" method="post">
<input type=hidden name="storeid" value="*1a40f041a0365b8c098f628ec99acd">
<input type=hidden name="dbname" value="products">
<input type=hidden name="function" value="add">

<input type=hidden name="itemnum" value="34">
<input type=hidden name="itemnum" value="11">
<input type=hidden name="itemnum" value="59">

<input type="image" src="/btn-addtocart.png" alt="Add to Cart" name="Add to Cart">
</form>

For your second question, sounds like you will want to use the Order API and write your own custom program to send the order information somewhere (along with the customer if you'd like).
http://www.shopsite.com/help/current/en-US/sc/pro/order.api.html
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT


Return to User Forum

Who is online

Users browsing this forum: Bing [Bot] and 113 guests