Post by rhenline » Wed Feb 08, 2012 4:45 am

I am looking for a mod that would allow me to offer additional options at checkout or based on the product in the cart. For example... If I sell some software I would like to offer the option of purchasing a CD/DVD to be shipped. I also have a network option and I have a maintenance program. So after they add the software to the cart I would like it to offer the option of upgrading to the network version, purchase 1-year of maintenance or have a CD/DVD shipped. Of course if they check the box on any of these the price would be updated. I also have some hardware items that have extended warranty. I think you see what I am getting at.

Newbie

Posts

Joined
Wed Feb 08, 2012 4:27 am

Post by eventpromotions » Thu Feb 09, 2012 3:55 am

That sounds like a great idea. That would be a good mod if you wanted to up sell accessories for a product like batteries.

A way you could have it as required option and they have to tick they don't want it? Might be idea or might just annoy people.

New member

Posts

Joined
Sun Feb 05, 2012 11:57 pm

Post by ogomo » Sat Feb 11, 2012 12:18 am

I'm looking for the same type of thing, but haven't had any luck yet.

New member

Posts

Joined
Thu Aug 04, 2011 1:35 am

Post by straightlight » Sat Feb 11, 2012 5:16 am

I do find this request interesting. However, each product option are assigned by individual products which means that upgrading purchase would require to append other products that may or may not be selected during the order while the orders only depends on a single order product ID per options at a time. With what would merchant rely on for integrating separated options amongst other products that the order won't be able to see momentarily ? ;)

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by gladysbus » Sat Feb 11, 2012 3:35 pm

ogomo wrote:I'm looking for the same type of thing, but haven't had any luck yet.

Me neither! :(

Newbie

Posts

Joined
Sat Feb 11, 2012 3:33 pm

Post by ogomo » Tue Feb 14, 2012 1:47 am

I've tried to sort of force this sort of up-sell feature to show up on the shipping page at checkout, without much luck.

I also posted this here: http://forum.opencart.com/viewtopic.php?f=20&t=53116

???

New member

Posts

Joined
Thu Aug 04, 2011 1:35 am

Post by ogomo » Tue Feb 14, 2012 6:20 am

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!!!

New member

Posts

Joined
Thu Aug 04, 2011 1:35 am

Post by jkwebco » Sat Mar 03, 2012 3:58 pm

I was able to use this fine on default template and add to shopping cart in cart.tpl, I ran into some problems with the onclick with shoppica theme. Seems as though I get undefined variables.

Notice: Undefined variable: option in catalog_controller_module_shoppica.php lin 530

line 530 shoppica.php ---> $this->cart->add($product_id, $quantity, $option);

when using onclick="$('#product').submit();"

can someone help me with the variables with this?

Newbie

Posts

Joined
Sat Mar 03, 2012 3:50 pm

Post by straightlight » Sat Mar 03, 2012 10:47 pm

This was covered on another topic I posted on.

Replace:

Code: Select all

$this->cart->add($product_id, $quantity, $option);
with:

Code: Select all

if (!empty($product_id) && !empty($quantity) && !empty($option)) {
    $this->cart->add($product_id, $quantity, $option);
}

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 5 guests