Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Simple html links with product option selected

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-03-2011, 03:44 PM
 
kryten kryten is offline
 

Newbie
  
Join Date: May 2007
Posts: 3
 

Default Simple html links with product option selected

Hi,

I use xcart only as a back end shopping cart and only use the generated html links for the add to cart buttons on my website. What I am trying to do is to create a one line html link that will add a product to the cart with a particular product option pre-selected, so that when the customer clicks the link 1 item is added to the cart with option 1, 2 or 3 already selected.

Below is the form that is generated by xcart but I just want a simple html link.

Thank you

<form name="orderform_16291" method="post" action="http://www.hollywood-collectibles.com/store/cart.php">
<input type="hidden" name="mode" value="add" />
<input type="hidden" name="productid" value="16291" />
<table width="100%">
<tr>
<td valign="top">
<br />
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="ProductPriceConverting" valign="top">Price:</td>
<td valign="top">
<font class="ProductDetailsTitle"><span class="currency">$299.95</span></font><font class="MarketPrice"> </font>
</td>
</tr>

<tr>
<td class="property-name product-input">
Order Option
</td>
<td class="property-value" colspan="2">


<select id="po448" name="product_options[448]">

<option value="4142" selected="selected">
Regular Order (1 payment, due when item ships)
</option>

<option value="4138">
4Pay (4 installments)
</option>

<option value="4139">
6Pay (6 installments)
</option>
</select>

</td>
</tr>


<tr>
<td height="25" width="30%">
Quantity </td>
<td>
<script type="text/javascript">
//<![CDATA[
var min_avail = 1;
var avail = 50;
var product_avail = 1001;
//]]>
</script>
<select id="product_avail" name="amount" onchange="javascript: check_wholesale(this.value);">
<option value="1">1</option>
<option value="2">2</option>
</select>

</td>
</tr>
<tr>
<td colspan="2">
<br />
<table cellspacing="0" class="SimpleButton"><tr><td><a class="simple-button simple-arrow-button" href="javascript:void(0);" onclick="javascript: document.orderform_16291.submit();">Add to cart</a></td></tr></table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
__________________
4.4
Reply With Quote
  #2  
Old 03-11-2011, 09:39 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Simple html links with product option selected

You can use the following link as a sample:

http://www.hollywood-collectibles.com/store/cart.php?mode=add&productid=16291&product_options[448]=4139&amount=2
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
gb2world (03-12-2011)
  #3  
Old 03-13-2011, 04:47 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Simple html links with product option selected

Thanks Alex.

Is there a similar method for an add-to-cart link when the product is 0 price, that is, the price would be entered by the customer? (in 4.4.2)

I would like to have an add to cart link where I can set a few other options, and provide an initial donation amount.

Something that would have the effect of:
cart.php?mode=add&productid=1&price=100&product_op tions[5]=9

If I can't set the price, it detects the cart as empty

---
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #4  
Old 03-18-2011, 03:06 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Simple html links with product option selected

Yes, this is possible.

Please have a look at the following sample URL:
Code:
http://.../4.4.x/cart.php?mode=add&productid=17517&product_options[444]=4129&product_options[445]=4130&product_options[446]=Custom%20text&product_options[447]=Text%20area%20text&amount=1&price=100
Attached Thumbnails
Click image for larger version

Name:	screenshot15.jpeg
Views:	348
Size:	31.4 KB
ID:	2496  
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
gb2world (03-21-2011)
  #5  
Old 03-21-2011, 05:43 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Simple html links with product option selected

Thanks for that Alex. It appears the price needs to be last in the URL for it work properly.

Any chance that product.php can also GET product options from the URL to pre-fill options on the product page, or is this feature only built into cart.php?

Turns out the add-to-cart won't help for what I need. I have to have a few options already selected, and have the amount open for the user to fill in a donation. When I direct them to the cart with a set price - they unfortunately don't have a way to update the price inside the cart once it is set. If this is not available for product.php - I see from the Generate Links that you do provide a form I can use to have the options set and have them fill out the price.

---
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #6  
Old 03-24-2011, 10:48 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Simple html links with product option selected

It is supported for the cart.php script only.

But it can be custom programmed if required.

The first option I guess will be changing the cart templates for the customers to be able to change the price for zero-priced products.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
gb2world (03-25-2011)
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:24 AM.

   

 
X-Cart forums © 2001-2020