MagePsycho / magento2-custom-shipping

Custom Shipping Module for Magento 2
https://www.magepsycho.com/extensions.html
70 stars 34 forks source link

How to hidden custom-shipping on frontent #1

Open balack opened 8 years ago

balack commented 8 years ago

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?

MagePsycho commented 8 years ago

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.

balack commented 8 years ago

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

MagePsycho commented 8 years ago

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 notifications@github.com 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