diff --git a/app/code/community/Llian/FreeAdminShipping/Model/Carrier/Freeadminshipping.php b/app/code/community/Llian/FreeAdminShipping/Model/Carrier/Freeadminshipping.php index 6582aa1..eb56295 100644 --- a/app/code/community/Llian/FreeAdminShipping/Model/Carrier/Freeadminshipping.php +++ b/app/code/community/Llian/FreeAdminShipping/Model/Carrier/Freeadminshipping.php @@ -51,6 +51,16 @@ protected function isAdmin() Mage::getSingleton('core/session', ['name' => $this->_sessionNamespace])->start(); return $isLoggedIn; } + + /** + * Returns the allowed flag which lets scripts overwrite the admin check + * + * @return bool + */ + protected function forceIsAllowFlag() + { + return (bool)Mage::registry('force_allow_freeadmin'); + } /** * Returns freeadminshipping shipping rate, if this method is activated and the user is logged in as admin @@ -60,7 +70,7 @@ protected function isAdmin() */ public function collectRates(Mage_Shipping_Model_Rate_Request $request) { - if (!$this->getConfigFlag('active') || !$this->isAdmin()) { + if (!$this->getConfigFlag('active') || (!$this->isAdmin() && !$this->forceIsAllowFlag())) { return false; } @@ -83,4 +93,4 @@ public function getAllowedMethods() } -} \ No newline at end of file +}