Post by k412m4z » Mon Jan 16, 2012 7:11 pm

Also included..
A solution for setting a minimum and maximum perimeter (posted a few posts down)

Difficulty: Easy
Time: 5 Minutes
Version used when writing this tutorial: 1.5.1.3

Presently, the installed payment modules have an option to set a 'minimum' amount required before a payment option becomes available. However, another very useful option is the ability to change this so that a payment option is disabled in the event that an order reaches a certain amount.

This change can easily be made on a per-payment option basis...

To make the change simply decide which payment option(s) you want to set limits for..

We will be making 2 file edits for each payment option; 1 configuration edit and 1 language file edit.

-----

Please note: Although these are simple edits, it's always best to create back-up copies of a file before you edit it in case you make an error editing the file, or if some other issue arises. It's as simple as dropping the original files into a separate temporary folder on your desktop. Be sure to note the directories of those files, since many file names are the same and can be accidentally used to overwrite a completely different file.

-----

Edit #1 - Find the model file which determines the limitation rules..

Open the model file for your payment option under the folder:
catalog/model/payment/

The file name will look something like: my_payment_option_name.php

Search for the line of code that looks like this:

Code: Select all

if ($this->config->get('my_payment_option_name') > $total) {
And simply change 1 character (the greater than or less than symbol from > to <):

Your update will now look like:

Code: Select all

if ($this->config->get(my_payment_option_name') < $total) {
-----

Edit #2 - Change the language in your admin panel so you know what the setting does..

Open the language file for your payment option under:
admin/language/english/payment/

Again the file name will look something like: my_payment_option_name.php

Search for:

Code: Select all

$_['entry_total']
To the right you can change the text.

The default will read:

Code: Select all

Total:<br /><span class="help">The checkout total the order must reach before this payment method becomes active.</span>
So let's change that to something like:

Code: Select all

Maximum Total:<br /><span class="help">Amounts GREATER than this will DISABLE this payment option.</span>
-----

Almost done... Now we just need to apply the setting to the payment option in your admin area.. Simply add the maximum amount you want to set for the payment option.

-----

Now you're all done.

Happy selling :)
Last edited by k412m4z on Thu Mar 22, 2012 2:18 am, edited 1 time in total.

http://www.Namerific.com


New member

Posts

Joined
Fri Oct 28, 2011 10:13 am

Post by karma » Sat Feb 25, 2012 10:27 pm

How to have both where we can define the minimum as well as the maximum amount ?

Newbie

Posts

Joined
Tue Dec 20, 2011 10:08 pm

Post by karma » Wed Mar 21, 2012 7:13 pm

*bump*

Newbie

Posts

Joined
Tue Dec 20, 2011 10:08 pm

Post by k412m4z » Thu Mar 22, 2012 2:11 am

Small adjustment.. Just add lines 3 and 4. catalog/model/payment/-------.php

Code: Select all

		if ($this->config->get('my_payment_option_name') < $total) {
			$status = false;
		} elseif (1000 > $total) {
			$status = false;
$1000 is your minimum amount.
The maximum amount is what you have set in the admin CP.

(Note: Be sure the < is pointed the correct way for line 1 in this example)

http://www.Namerific.com


New member

Posts

Joined
Fri Oct 28, 2011 10:13 am

Post by karma » Thu Mar 22, 2012 3:17 am

thanks for the code

Newbie

Posts

Joined
Tue Dec 20, 2011 10:08 pm

Post by k412m4z » Thu Mar 22, 2012 3:33 am

No prob. Normally I wouldn't bother (since I am not a programmer) but given your name is also karma.. I felt more inclined to figure out a solution lol :D

http://www.Namerific.com


New member

Posts

Joined
Fri Oct 28, 2011 10:13 am

Post by alexdaydreaming » Thu Apr 19, 2012 7:06 pm

Hello,

Does this mod apply also to 1.4.9.1?

Thanks!

New member

Posts

Joined
Thu May 14, 2009 10:33 am

Post by k412m4z » Thu Apr 19, 2012 7:36 pm

I am not sure.. I have only used 1.5.1.3

If the files look the same, it may very well work.

Backup, and see what happens.. :)

http://www.Namerific.com


New member

Posts

Joined
Fri Oct 28, 2011 10:13 am

Post by rdvapors » Sun Aug 11, 2013 1:11 am

Would it be possible to restrict payment and shipping on coupon code?

Example
Coupon Code = FREE
Conditions of Coupon Code:
Fixed amount = $x.xx

customer enters coupon code,
payment and shipping are disabled

also
if customer adds another item payment payment and shipping becomes active and coupon code fixed amount remains active.

also
if customer adds enough items to satisfy free shipping amount, coupon code remains active at fixed amount and shipping is disabled.

also
only this coupon code will work.

Visual example

Cart amount:
$5.98
Coupon Code FREE entered,
Coupon Code FREE Applied -$5.98
Cart total = $0.00
Shipping = Free
checkout success.

CONDITION 2
Cart amount:
$15.98
Coupon Code Free entered,
Coupon Code FREE Applied -$5.98
Cart total =$10.00
Shipping = "Whatever shipping"
Shipping selected,
Payment info entered,
checkout success.

CONDITION 3
Cart amount:
$50.00
Coupon Code FREE entered,
Coupon Code FREE applied -$5.98
Cart total =$44.02 "Free Shipping Triggered"
Payment info entered,
checkout success.

New member

Posts

Joined
Thu Dec 13, 2012 11:29 pm

Post by EttlesEssentialKit » Sun Sep 22, 2013 8:07 pm

Would this work on weight based shipping?


Posts

Joined
Fri Sep 06, 2013 10:20 pm
Who is online

Users browsing this forum: No registered users and 20 guests