Post by Qphoria » Sat Aug 15, 2009 2:39 am

If you sell products on your site but also offer free products, there is no way for you to set it up so that you customers can checkout if they have only the free items (like downloads). So there is an obvious need for a "Free" checkout module that only presents itself only when the cart total + shipping total + taxes = 0.00 on the final page.

I have this module ready to go, and would even like it to be added to the core in the next release of OpenCart. It works by checking the totals when loading and if there is 0.00 total between cart, shipping, and taxes, it will display itself. If there is any cost greater than 0.00 it will not display.

But there is a problem. Due to the way the checkout/payment page saves the "payment_methods" to the session, If you choose Free shipping, then choose Free payment, then went back to shipping and changed it to $10.00, the payment methods session variable would prevent rechecking to see if the total is still 0, so it would still offer the Free payment option, which we don't want.

I can see the purpose of having the shipping_methods saved to the session, so you don't have to get quotes each time. But for payment, there are no quotes to get really. So since there is no real need for the payment having a session set, removing the session for payment_methods would allow for this new payment module to work without breaking anything else. At the very least you could change the check to this:

Code: Select all

if (!isset($this->session->data['payment_methods']) || $this->config->get('free_checkout_status')) {
This is mainly a point for Daniel to think about.

In the meantime, i can release this with a quick explanation on how to comment out the 1 line of code that checks the session for payments.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Sat Aug 15, 2009 3:42 am


Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Amok » Tue Sep 15, 2009 11:45 pm

Code: Select all

EDIT: catalog/controller/checkout/payment.php
FIND:
--------------------------
if (!isset($this->session->data['payment_methods'])) {
--------------------------
REPLACE WITH:
--------------------------
if (!isset($this->session->data['payment_methods']) || $this->config->get('free_checkout_status')) {
--------------------------
Hmm .. only thing similar to this i've found is:

Code: Select all

if (!isset($this->session->data['payment_methods'][$this->request->post['payment']])) {
Am i right here? ;)

New member

Posts

Joined
Fri Sep 28, 2007 5:20 am

Post by Qphoria » Wed Sep 16, 2009 12:19 am

No.

RTFM
STEP 6 IS NOT NECESSARY IF USING v1.3.0 or LATER VERSIONS.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 128 guests