Add to Cart URL link + Multi Prod + Coupon (1.5/2.x/3.x)

Add to Cart URL link + Multi Prod  + Coupon (1.5/2.x/3.x)
Demos:
(Paste these in your browser url)

Add Single product to cart:
http://demo20.unbannable.com/index.php?route=checkout/cart/addlink&product_id=32
Add 2 products to cart:
http://demo20.unbannable.com/index.php?route=checkout/cart/addlink&product_id[0]=44&product_id[1]=48
Add 2 products + coupon
http://demo20.unbannable.com/index.php?route=checkout/cart/addlink&product_id[0]=44&product_id[1]=48&coupon=2222



Supported OpenCart Versions:
================
1.5.x
2.x
3.x

What does it do:
================
Adds the ability to add an item to cart by direct link (GET) rather than needing a form post (POST).
Also adds alternative methods of adding by product_id, sku, or model.
Supports options as well (See examples below)


Requirements:
==============
* You will need to have the latest vQmod engine installed (http://vQmod.com)


Main features:
==============
* Simple vQmod script plug and play. No files to edit or overwrite.
* Supports lookup by product_id, sku, or model
* Instantly adds to cart and redirect to cart page
* Supports adding coupon code as part of url
* If product has required options that were not specified, it will redirect to the product page to allow proper choice
* Can be expanded to support ANY unique field (isbn, upc, location, etc)
* Passable Parameters:
- product_id
- xproduct_id (alternative if running 2.0.3.1)
- model
- sku
- quantity
- option
- redirect (eg: checkout/checkout)
- recurring_id
- coupon

Examples of use:
==================
Single Product examples:
---------------------------
For single products, pass in the key=value format
product_id=15&quantity=2
sku=123&quantity=3

For options, pass the product_option_id inside a square bracket equal to the product_option_value_id
You can get these 2 values from the html source for the option. For example, the select will have the product_option_id and the option will have the product_option_value_id
&option[459]=160
etc

Product with no options (product_id):
http://www.mysite.com/index.php?route=checkout/cart/addlink&product_id=47
Product with qty of 2 (product_id):
http://www.mysite.com/index.php?route=checkout/cart/addlink&product_id=47&quantity=2
Product with 1 option (product_id):
http://www.mysite.com/index.php?route=checkout/cart/addlink&product_id=47&option[8]=22
Product with 1 option and qty of 2 (product_id):
http://www.mysite.com/index.php?route=checkout/cart/addlink&product_id=47&quantity=2&option[8]=22
Product via sku with qty of 2:
http://www.mysite.com/index.php?route=checkout/cart/addlink&sku=ABC123&quantity=2
Product via model with qty of 5:
http://www.mysite.com/index.php?route=checkout/cart/addlink&model=MO2452&quantity=5
Product via product_id with qty of 2 and redirect to the checkout page:
http://www.mysite.com/index.php?route=checkout/cart/addlink&model=MO2452&quantity=2&redirect=checkout/checkout
Product with recurring_id set:
http://www.mysite.com/index.php?route=checkout/cart/addlink&model=MO2452&recurring_id=12345
Product with coupon and quantity set:
http://www.mysite.com/index.php?route=checkout/cart/addlink&product_id=47&quantity=2&coupon=12345
Product with text option set:
http://www.mysite.com/index.php?route=checkout/cart/addlink&product_id=47&option[8]=This+is+a+text+option


Multi product examples:
------------------------
For multiple products, use the square brackets with the index (starting from 0) []
product_id[0]=15&quantity[0]=2
product_id[1]=34&quantity[1]=4
model[2]=ABC&quantity[1]=4

For options, first use the indexed square bracket as shown above, then pass the product_option_id inside a second square bracket equal to the product_option_value_id
option[0][459]=160&option[1][324]=56
etc

2 Products
http://www.mysite.com/index.php?route=checkout/cart/addlink&product_id[0]=66&product_id[1]=40
2 Products, different quantity
http://www.mysite.com/index.php?route=checkout/cart/addlink&product_id[0]=66&quantity[0]=3&product_id[1]=40&quantity[1]=4
2 Products with options
http://localhost/v230/index.php?route=checkout/cart/addlink&product_id[0]=30&product_id[1]=40&option[0][459]=160&option[1][459]=160
2 Product with coupon:
http://www.mysite.com/index.php?route=checkout/cart/addlink&product_id[0]=30&product_id[1]=40&coupon=12345
How to figure out the option id for options in url:
===============================
In my above url examples you can see the part with "&option[8]=22"
That means the option id is "8" and the option value id is "22"
To Look this up
1. Use the "View Source" on your browser while looking at a product page with options.
2. Search for this exact string. Be sure not to add the final quote.
name="option
3. Now you should be able to see which option corresponds to the option id and option value id.
4. For text or textarea, you would use the option id = the actual text you want with spaces replaced by plus symbols (e.g. &option[25]=This+is+my+Text).


Other great uses:
=================
To allow for creating custom invoices by adding an item to the cart with a custom price and then redirecting them right to checkout:

Combine with my Custom Price Product mod
Then call the url passing the custom price and redirect:
http://www.mysite.com/index.php?route=checkout/cart/addlink&product_id=33&option[227]=123.25&redirect=checkout/checkout




Buy
Price
$49.99

  • Developed by OpenCart Partner
  • Documentation Included

Rating

Compatibility
1.5.4, 1.5.4.1, 1.5.5.1, 1.5.6, 1.5.6.1, 1.5.6.2, 1.5.6.3, 1.5.6.4, 2.0.0.0, 2.0.1.0, 2.0.1.1, 2.0.2.0, 2.0.3.1, 2.1.0.1, 2.1.0.2, 2.2.0.0, 2.3.0.0, 2.3.0.1, 2.3.0.2, 3.0.0.0, 3.0.1.1, 3.0.1.2, 3.0.2.0, 3.1.0.0_b, 3.0.3.0, 3.0.3.1

Last Update
7 Jan 2019

Created
14 Apr 2013
220 Sales
74 Comments
qphoria
qphoria
Member since: 23 Apr 2010

View all extensions Get Support