diff --git a/Helper/Data.php b/Helper/Data.php index d166028..0922ca8 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -22,6 +22,7 @@ namespace Mageplaza\SameOrderNumber\Helper; use Mageplaza\Core\Helper\AbstractData; +use Mageplaza\SameOrderNumber\Model\System\Config\Source\Apply; /** * Class Data @@ -29,5 +30,26 @@ */ class Data extends AbstractData { - const CONFIG_MODULE_PATH = 'sameordernumber'; + const CONFIG_MODULE_PATH = 'mpsameordernumber'; + + public function getApplyForOption($storeId = null) + { + return explode(",", $this->getConfigGeneral('apply', $storeId)); + } + + public function isApplyInvoice($storeId = null) + { + return in_array(Apply::INVOICE, $this->getApplyForOption($storeId)); + } + + public function isApplyShipment($storeId = null) + { + return in_array(Apply::SHIPMENT, $this->getApplyForOption($storeId)); + } + + public function isApplyCreditMemo($storeId = null) + { + return in_array(Apply::CREDIT_MEMO, $this->getApplyForOption($storeId)); + } + } \ No newline at end of file diff --git a/Model/System/Config/Source/Apply.php b/Model/System/Config/Source/Apply.php new file mode 100644 index 0000000..aaedd57 --- /dev/null +++ b/Model/System/Config/Source/Apply.php @@ -0,0 +1,47 @@ + '', 'label' => '