magento2-custom-shipping icon indicating copy to clipboard operation
magento2-custom-shipping copied to clipboard

How to hidden custom-shipping on frontent

Open balack opened this issue 8 years ago • 3 comments

Thanks a lot for your extension. It works well in my new system. One question I have is that if it's possible just to expose the custom shipping to Admin interface only when making order, not front-end customer interfce?

balack avatar Jan 25 '16 21:01 balack

Yes you can. In Magento 1, you can do it simply by replacing the condition with if (!$this->getConfigFlag('active') || !Mage::app()->getStore()->isAdmin()) { from https://github.com/MagePsycho/magento2-custom-shipping/blob/master/Model/Carrier/Customshipping.php#L65

So try to find the Mage::app()->getStore()->isAdmin() equivalent method in Magento 2 and add the same in above line.

MagePsycho avatar Jan 26 '16 20:01 MagePsycho

Thank you!

I'm find equivalent method in Magento 2 and modify code

if (!$this->getConfigFlag('active') || ($this->getAreaCode() != \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE)) { return false; }

But it does not work, It's hide both frontend and admin

balack avatar Jan 27 '16 05:01 balack

Hi there,

OK, if you need my assistance on this will work on this and update you. But you have wait for a day or so.

Regards

On Wed, Jan 27, 2016 at 9:01 AM, Balack Huynh [email protected] wrote:

Thank you!

I'm find equivalent method in Magento 2 and modify code

if (!$this->getConfigFlag('active') || !$this->_state->setAreaCode('adminhtml')) { return false; }

But it does not work

— Reply to this email directly or view it on GitHub https://github.com/MagePsycho/magento2-custom-shipping/issues/1#issuecomment-175400039 .


Thanks Best Regards Er. Rajendra K Bhatta

http://www.magentocommerce.com/certification/directory/dev/561/ http://www.zend.com/zce.php?c=ZEND013967&r=236487590

http://www.magentocommerce.com/magento-connect/developer/MagePsycho

MagePsycho avatar Jan 29 '16 12:01 MagePsycho