If you're still looking for a way to add a product at the checkout screen, follow these steps:
1) Create a product that you'd like to sell on the checkout screen if it isn't already created. This product can have options, or not.
2) Get the product ID for this particular product. Go to the product page and the product ID is in the address bar at the very end of the URL after "product_id=" (i.e. For a product found on
http://www.mysite.com/index.php?route=p ... uct_id=123 the product ID would be 123).
2a) If your product has options, you will also need to know the option IDs for each.
3) For this example, I am editing the file catalog/view/theme/default/template/checkout/shipping.tpl
Edit this file to put the product on your shipping page.
The first bit of code will show how to enter a product with options, the second will show a product without options.
In shipping.tpl include the following form in between lines 13 and 14 (NOTE: change XXX's to the product/option IDs you found in step 2/2a):
Code: Select all
<form action="http://mysite.com/index.php?route=checkout/cart" method="post" enctype="multipart/form-data" id="product">
<input type="hidden" name="product_id" value="XXX">
<input type="hidden" name="redirect" value="http://mysite.com/index.php?route=product/product&product_id=XXX">
<select name="option[XXXXX]">
<option value="XXXX">Option 1</option>
<option value="XXXX">Option 2</option>
<option value="XXXX">Option 3</option>
</select>
Qty: <input type="text" name="quantity" size="3" value="1" />
<a onclick="$('#product').submit();" id="add_to_cart" class="button">
<span>Add to Cart</span>
</a>
</form>
Note: the option ID's can be found in your OC database table "product_option_value". The value that goes in the <select name="option[XXXXX]" spot is found in the "product_option_id" column. The value(s) that go in the <option value="XXXX"> spot(s) are found in the "product_option_value_id" column. Be sure to grab the option ID's for the correct product number.
Alternatively, you can go to the product page, right click and view the page's source code to find this code.
No product options:
Code: Select all
<form action="http://mysite.com/index.php?route=checkout/cart" method="post" enctype="multipart/form-data" id="product">
<input type="hidden" name="product_id" value="XXX">
<input type="hidden" name="redirect" value="http://mysite.com/index.php?route=product/product&product_id=XXX">
Qty: <input type="text" name="quantity" size="3" value="1" />
<a onclick="$('#product').submit();" id="add_to_cart" class="button">
<span>Add to Cart</span>
</a>
</form>
Include whatever language you need and style the code as necessary to fit your theme.
It wasn't as easy as I'd like it to be, but I got it working this way.
Update: This was done using OC 1.4.9.4. I don't know how, or if it will work in other versions. You'll have to test it out to see. PLEASE make a backup of any files you're editing first!!!