Skip to content

Commit cfa23f0

Browse files
committed
- add min/max order for GTD POA
1 parent b8bd9b8 commit cfa23f0

File tree

4 files changed

+94
-1
lines changed

4 files changed

+94
-1
lines changed

app/code/community/GlobalExperts/Hypercharge/Model/Mobile.php

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,4 +575,60 @@ public function getAllConfigChannels()
575575
return $hypercharge_channels;
576576
}
577577

578+
public function isApplicableToQuote($quote, $checksBitMask)
579+
{
580+
if ($checksBitMask & self::CHECK_USE_FOR_COUNTRY) {
581+
if (!$this->canUseForCountry($quote->getBillingAddress()->getCountry())) {
582+
return false;
583+
}
584+
}
585+
if ($checksBitMask & self::CHECK_USE_FOR_CURRENCY) {
586+
if (!$this->canUseForCurrency($quote->getStore()->getBaseCurrencyCode())) {
587+
return false;
588+
}
589+
}
590+
if ($checksBitMask & self::CHECK_USE_CHECKOUT) {
591+
if (!$this->canUseCheckout()) {
592+
return false;
593+
}
594+
}
595+
if ($checksBitMask & self::CHECK_USE_FOR_MULTISHIPPING) {
596+
if (!$this->canUseForMultishipping()) {
597+
return false;
598+
}
599+
}
600+
if ($checksBitMask & self::CHECK_USE_INTERNAL) {
601+
if (!$this->canUseInternal()) {
602+
return false;
603+
}
604+
}
605+
if ($checksBitMask & self::CHECK_ORDER_TOTAL_MIN_MAX) {
606+
$total = $quote->getBaseGrandTotal();
607+
$minTotal = $this->getConfigData('min_order_total');
608+
$maxTotal = $this->getConfigData('max_order_total');
609+
610+
if ($quote->getBillingAddress()->getCompany()) {
611+
$minTotal = $this->getConfigData('min_order_total_bb');
612+
$maxTotal = $this->getConfigData('max_order_total_bb');
613+
}
614+
615+
if (!empty($minTotal) && $total < $minTotal || !empty($maxTotal) && $total > $maxTotal) {
616+
return false;
617+
}
618+
}
619+
if ($checksBitMask & self::CHECK_RECURRING_PROFILES) {
620+
if (!$this->canManageRecurringProfiles() && $quote->hasRecurringItems()) {
621+
return false;
622+
}
623+
}
624+
if ($checksBitMask & self::CHECK_ZERO_TOTAL) {
625+
$total = $quote->getBaseSubtotal() + $quote->getShippingAddress()->getBaseShippingAmount();
626+
if ($total < 0.0001 && $this->getCode() != 'free'
627+
&& !($this->canManageRecurringProfiles() && $quote->hasRecurringItems())
628+
) {
629+
return false;
630+
}
631+
}
632+
return true;
633+
}
578634
}

app/code/community/GlobalExperts/Hypercharge/etc/config.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@
177177
<allowspecific>0</allowspecific>
178178
<test>1</test>
179179
<terms><![CDATA[Mit der &Uuml;bermittlung der f&uuml;r die Abwicklung des Rechnungskaufes und einer Identit&auml;ts- und Bonit&auml;tspr&uuml;fung erforderlichen Daten an payolution bin ich einverstanden. <a style="float:none; display:inline; margin: 0" href="https://payment.payolution.com/payolution-payment/infoport/dataprivacyconsent?mId=SMOkbmRsZXIgeHh4" target="_blank">Meine Einwilligung</a> kann ich jederzeit mit Wirkung f&uuml;r die Zukunft widerrufen.]]></terms>
180+
<min_order_total>10</min_order_total>
181+
<max_order_total>1500</max_order_total>
182+
<min_order_total_bb>50</min_order_total_bb>
183+
<max_order_total_bb>1500</max_order_total_bb>
180184
</hypercharge_mobile_purchase_on_account_gtd>
181185
<hypercharge_wpf_purchase_on_account>
182186
<active>0</active>

app/code/community/GlobalExperts/Hypercharge/etc/system.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,38 @@
487487
<show_in_website>1</show_in_website>
488488
<show_in_store>1</show_in_store>
489489
</terms>
490+
<min_order_total translate="label">
491+
<label>Minimum Order Total B2C</label>
492+
<frontend_type>text</frontend_type>
493+
<sort_order>120</sort_order>
494+
<show_in_default>1</show_in_default>
495+
<show_in_website>1</show_in_website>
496+
<show_in_store>0</show_in_store>
497+
</min_order_total>
498+
<max_order_total translate="label">
499+
<label>Maximum Order Total B2C</label>
500+
<frontend_type>text</frontend_type>
501+
<sort_order>130</sort_order>
502+
<show_in_default>1</show_in_default>
503+
<show_in_website>1</show_in_website>
504+
<show_in_store>0</show_in_store>
505+
</max_order_total>
506+
<min_order_total_bb translate="label">
507+
<label>Minimum Order Total B2B</label>
508+
<frontend_type>text</frontend_type>
509+
<sort_order>140</sort_order>
510+
<show_in_default>1</show_in_default>
511+
<show_in_website>1</show_in_website>
512+
<show_in_store>0</show_in_store>
513+
</min_order_total_bb>
514+
<max_order_total_bb translate="label">
515+
<label>Maximum Order Total B2B</label>
516+
<frontend_type>text</frontend_type>
517+
<sort_order>150</sort_order>
518+
<show_in_default>1</show_in_default>
519+
<show_in_website>1</show_in_website>
520+
<show_in_store>0</show_in_store>
521+
</max_order_total_bb>
490522
</fields>
491523
</hypercharge_mobile_purchase_on_account_gtd>
492524
<hypercharge_mobile_gtd translate="label" module="bithypercharge">

skin/frontend/base/default/hypercharge/js/hypercharge.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Hyper = Class.create({
157157
}
158158
}
159159

160-
json += "\"header_origin\" : \"" + this.headerOrigin + "\"," ;
160+
//json += "\"header_origin\" : \"" + this.headerOrigin + "\"," ;
161161
json += "\"payment_method\" : \"" + this.paymentMethod + "\" } } ";
162162

163163
var data = json.evalJSON(true);
@@ -175,6 +175,7 @@ Hyper = Class.create({
175175
data: data,
176176
dataType: "xml",
177177
headers: { 'origin': this.headerOrigin },
178+
contentType: "application/text; charset=utf-8",
178179
success: function(result) {
179180
var xml = jQuery(result);
180181
var transactionStatus = xml.find("status").text();

0 commit comments

Comments
 (0)