Skip to content
This repository was archived by the owner on Feb 3, 2022. It is now read-only.

Commit 2923de0

Browse files
author
Nick Jones
committed
Merge branch 'release/2.7.6'
2 parents 2ae7c19 + 101abb4 commit 2923de0

File tree

4 files changed

+58
-4
lines changed

4 files changed

+58
-4
lines changed

app/code/community/Meanbee/Shippingrules/Model/Rule/Condition/Abstract.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function getDefaultOperatorInputByType()
1414
{
1515
if (null === $this->_defaultOperatorInputByType) {
1616
$this->_defaultOperatorInputByType = array(
17-
'string' => array('==', '!=', '{}', '!{}', '^', '$', '!^', '!$', '()', '!()', '//'),
17+
'string' => array('==', '!=', '{}', '!{}', '^', '$', '!^', '!$', '()', '!()', '^()', '!^()', '//'),
1818
'numeric' => array('==', '!=', '>=', '>', '<=', '<', '..', '!..', '()', '!()'),
1919
'numeric_b26' => array('==', '!=', '>=:b26', '>:b26', '<=:b26', '<:b26', '..:b26', '!..:b26', '()', '!()'),
2020
'numeric_b36' => array('==', '!=', '>=:b36', '>:b36', '<=:b36', '<:b36', '..:b36', '!..:b36', '()', '!()'),
@@ -70,6 +70,8 @@ public function getDefaultOperatorOptions()
7070
'$' => Mage::helper('meanship')->__('ends with'),
7171
'!^' => Mage::helper('meanship')->__('does not begin with'),
7272
'!$' => Mage::helper('meanship')->__('does not end with'),
73+
'^()' => Mage::helper('rule')->__('begins with one of'),
74+
'!^()' => Mage::helper('rule')->__('does not begin with one of'),
7375
'//' => Mage::helper('meanship')->__('matches regex'),
7476
);
7577
}
@@ -86,7 +88,7 @@ public function getDefaultOperatorOptions()
8688
*/
8789
public function isArrayOperatorType() {
8890
$op = $this->getOperator();
89-
return $op === '()' || $op === '!()' || in_array($this->getInputType(), $this->_arrayInputTypes);
91+
return $op === '()' || $op === '!()' || $op === '^()' || $op === '!^()' || in_array($this->getInputType(), $this->_arrayInputTypes);
9092
}
9193

9294
/**
@@ -350,14 +352,30 @@ public function validateAttribute($validatedValue)
350352
$result = (substr($validatedValue, -$length) === $value);
351353
}
352354
break;
355+
356+
case '^()': case '!^()':
357+
if (!is_string($validatedValue)) {
358+
return false;
359+
} else {
360+
$value = (array)$value;
361+
foreach ($value as $item) {
362+
$length = strlen($item);
363+
if (substr($validatedValue, 0, $length) === $item) {
364+
$result = true;
365+
break;
366+
}
367+
}
368+
}
369+
break;
370+
353371
case '//':
354372
if (Mage::helper('meanship')->isValidRegex($value)) {
355373
$result = (bool)preg_match($value, $validatedValue);
356374
}
357375
break;
358376
}
359377

360-
if (in_array($op, array('!=', '>', '<', '>:b26', '<:b26', '>:b36', '<:b36', '!..', '!..:b26', '!..:b36', '!{}', '!()', '!^', '!$'))) {
378+
if (in_array($op, array('!=', '>', '<', '>:b26', '<:b26', '>:b36', '<:b36', '!..', '!..:b26', '!..:b36', '!{}', '!()', '!^', '!$', '!^()'))) {
361379
$result = !$result;
362380
}
363381

app/code/community/Meanbee/Shippingrules/etc/config.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<config>
33
<modules>
44
<Meanbee_Shippingrules>
5-
<version>2.7.4</version>
5+
<version>2.7.6</version>
66
</Meanbee_Shippingrules>
77
</modules>
88
<global>
@@ -93,6 +93,7 @@
9393
<condense_countries_on_grid>flag</condense_countries_on_grid>
9494
<colapse_conditions_on_subcondition_on_grid>1</colapse_conditions_on_subcondition_on_grid>
9595
<use_emoji_one>1</use_emoji_one>
96+
<sallowspecific>0</sallowspecific>
9697
</meanship>
9798
</carriers>
9899
</default>

app/code/community/Meanbee/Shippingrules/etc/system.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,26 @@
9393
<show_in_website>1</show_in_website>
9494
<show_in_store>1</show_in_store>
9595
</collapse_conditions_on_subcondition_on_grid>
96+
<sallowspecific translate="label">
97+
<label>Ship to Applicable Countries</label>
98+
<frontend_type>select</frontend_type>
99+
<sort_order>100</sort_order>
100+
<frontend_class>shipping-applicable-country</frontend_class>
101+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
102+
<show_in_default>1</show_in_default>
103+
<show_in_website>1</show_in_website>
104+
<show_in_store>0</show_in_store>
105+
</sallowspecific>
106+
<specificcountry translate="label">
107+
<label>Ship to Specific Countries</label>
108+
<frontend_type>multiselect</frontend_type>
109+
<sort_order>101</sort_order>
110+
<source_model>adminhtml/system_config_source_country</source_model>
111+
<show_in_default>1</show_in_default>
112+
<show_in_website>1</show_in_website>
113+
<show_in_store>0</show_in_store>
114+
<can_be_empty>1</can_be_empty>
115+
</specificcountry>
96116
</fields>
97117
</meanship>
98118
</groups>

composer.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "meanbee/magento-shipping-rules",
3+
"description": "Magento 1 extension that uses the power of the promotion rules system to create flat rate shipping methods based on conditions",
4+
"homepage": "https://www.meanbee.com/magento-extensions/meanbee-shipping-rules.html",
5+
"type": "magento-module",
6+
"authors": [
7+
{
8+
"name": "Meanbee",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"require": {
13+
"magento-hackathon/magento-composer-installer": "^3.0.0"
14+
}
15+
}

0 commit comments

Comments
 (0)