We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    Disable MSI module in magento 2.3.X and 2.4.X

    Run the below command to disable MSI in Magento 2.3.3 or Magento 2.3.4:

    php bin/magento module:disable -f 
    Magento_Inventory
    Magento_InventoryAdminUi
    Magento_InventoryApi
    Magento_InventoryBundleProduct
    Magento_InventoryBundleProductAdminUi
    Magento_InventoryCatalog
    Magento_InventorySales
    Magento_InventoryCatalogAdminUi
    Magento_InventoryCatalogApi
    Magento_InventoryCatalogSearch
    Magento_InventoryConfigurableProduct
    Magento_InventoryConfigurableProductAdminUi
    Magento_InventoryConfigurableProductIndexer
    Magento_InventoryConfiguration
    Magento_InventoryConfigurationApi
    Magento_InventoryGroupedProduct
    Magento_InventoryGroupedProductAdminUi
    Magento_InventoryGroupedProductIndexer
    Magento_InventoryImportExport
    Magento_InventoryIndexer
    Magento_InventoryLowQuantityNotification
    Magento_InventoryLowQuantityNotificationAdminUi
    Magento_InventoryLowQuantityNotificationApi
    Magento_InventoryMultiDimensionalIndexerApi
    Magento_InventoryProductAlert
    Magento_InventoryReservations
    Magento_InventoryReservationsApi
    Magento_InventoryCache
    Magento_InventorySalesAdminUi
    Magento_InventorySalesApi
    Magento_InventorySalesFrontendUi
    Magento_InventoryShipping
    Magento_InventorySourceDeductionApi
    Magento_InventorySourceSelection
    Magento_InventorySourceSelectionApi
    Magento_InventoryShippingAdminUi
    Magento_InventoryDistanceBasedSourceSelectionAdminUi
    Magento_InventoryDistanceBasedSourceSelectionApi
    Magento_InventoryElasticsearch
    Magento_InventoryExportStockApi
    Magento_InventoryReservationCli
    Magento_InventoryExportStock
    Magento_CatalogInventoryGraphQl
    Magento_InventorySetupFixtureGenerator
    Magento_InventoryAdvancedCheckout
    Magento_InventoryDistanceBasedSourceSelection
    Magento_InventoryRequisitionList
    Magento_InventoryGraphQl

    Run the below command to disable MSI in Magento 2.4.X:

    php bin/magento module:disable -f
    Magento_Inventory
    Magento_InventoryAdminUi
    Magento_InventoryAdvancedCheckout
    Magento_InventoryApi
    Magento_InventoryBundleProduct
    Magento_InventoryBundleProductAdminUi
    Magento_InventoryCatalog
    Magento_InventorySales
    Magento_InventoryCatalogAdminUi
    Magento_InventoryCatalogApi
    Magento_InventoryCatalogSearch
    Magento_InventoryConfigurableProduct
    Magento_InventoryConfigurableProductAdminUi
    Magento_InventoryConfigurableProductIndexer
    Magento_InventoryConfiguration
    Magento_InventoryConfigurationApi
    Magento_InventoryDistanceBasedSourceSelection
    Magento_InventoryDistanceBasedSourceSelectionAdminUi
    Magento_InventoryDistanceBasedSourceSelectionApi
    Magento_InventoryElasticsearch
    Magento_InventoryExportStockApi
    Magento_InventoryIndexer
    Magento_InventorySalesApi
    Magento_InventoryGroupedProduct
    Magento_InventoryGroupedProductAdminUi
    Magento_InventoryGroupedProductIndexer
    Magento_InventoryImportExport
    Magento_InventoryCache
    Magento_InventoryLowQuantityNotification
    Magento_InventoryLowQuantityNotificationApi
    Magento_InventoryMultiDimensionalIndexerApi
    Magento_InventoryProductAlert
    Magento_InventoryRequisitionList
    Magento_InventoryReservations
    Magento_InventoryReservationCli
    Magento_InventoryReservationsApi
    Magento_InventoryExportStock
    Magento_InventorySalesAdminUi
    Magento_InventorySalesFrontendUi
    Magento_InventorySetupFixtureGenerator
    Magento_InventoryShipping
    Magento_InventorySourceDeductionApi
    Magento_InventorySourceSelection
    Magento_InventorySourceSelectionApi
    Magento_InventoryLowQuantityNotificationAdminUi
    Magento_InventoryShippingAdminUi
    Magento_InventoryGraphQl

     

    Why Magento is the right platform for eCommerce Development? – Discussion with Matthijs Burki from Cream

    We are pleased to have Matthijs Burki, E-commerce Project Manager at Cream to discuss on the right platform for e-commerce development and validate the challenges faced during the implementation of Marketplace development.

    During the initial discussion, Matthijs said that Magento is still the best platform to build a shop if you want to build customized solutions that work in sync with your eCommerce business needs owing to the flexibility of the Magento platform. He states there is the risk behind every other platform.

    Taking about the Best Software development tool to maintain good relationships with clients, Matthijs said Jira is the best tool for them to manage daily task and be transparent with the customer all the time and client can review the implementation going on and if they want to change anything in between they can request the team to priorities the task based on the need.

    Being said that, he said the most important and most difficult challenges are to make customers happy and communicate well during the development phase and stand on the clients’ goals.

    We are thankful to him to share insight on the E-commerce project development.

    Challenges handling Custom Software Solution related to eCommerce Projects and Industry based IoT Project Discussion with Sergei Vandomatski from HQ Software

    We had Sergei Vardomatski, CEO at HQ Software and we discussed the major challenges on the solving custom software development E-commerce project which also includes the IOT based solution.

    Sergei said they work on platform requests by the clients, and majorly focused on Drupal due to its flexibility and can easily handle high traffic and mostly utilized by the enterprise clients. So choosing the right platform depends on the client’s budget and the market.

    Moving forward we have discussed the Software development methodology, Sergei’s team majorly works on Scrum and said scrum allows to have regular and continuous improvement and maintain backlog, and give the advantage of rapid and fast delivery. It is easy to identify what is going wrong and which technical feature should be taken care initially and priorities the tasks

    While taking about the challenges beside the development phase is to get the right talent and skilled team and hire people and spend much time on Staffing, and second most challenge is the clients has a fixed budget or a time frame so to we need to make sure the right team is working on it to satisfy the client’s needs.

    Sergei’s said when we are handling projects in the web world like eCommerce projects it is easier to solve the problem based on the marketplace, but when we handle IoT (Internet of Things) projects, it is related to the Physical world and industry solution and we need to be nearby the location to solve the product related issue.

    We are thankful to Sergei to give us the insights on Software projects, IoT projects, software development practices and what not.

    Magento 2: How to add store code to body class in multi store view?

    In some cases, you will need to add a class to the body tag of your Magento stores. To process it, you’ll need to set-up an event observer for the layout_render_before event.

    1. Create file events.xml on app/code/Magemonkeys/Addbodyclass/etc/frontend

    <?xml version="1.0" ?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
      <event name="layout_render_before">
         <observer instance="MagemonkeysAddbodyclassObserverFrontendLayoutLoadBefore" name="add_bodystorecode_class_observer"/>
      </event>
    </config>

    2. Create file LoadBefore.php on app/code/Magemonkeys/Addbodyclass/Observer/Frontend/Layout

    <?php
    namespace MagemonkeysAddbodyclassObserverFrontendLayout;
     
    use MagentoFrameworkEventObserver;
    use MagentoFrameworkViewPageConfig;
    use MagentoStoreModelStoreManagerInterface; 
    
    class LoadBefore implements MagentoFrameworkEventObserverInterface
    {
       protected $storeManager;
    
       public function __construct(
           Config $config,
           StoreManagerInterface $storeManager
       ) {
           $this->config = $config;
           $this->storeManager = $storeManager;
       }
     
       public function execute(Observer $observer)
       {
           $store = $this->storeManager->getStore();
           $storeCode = $store->getCode();
           $websiteCode = $store->getWebsite()->getCode();
           $this->config->addBodyClass($storeCode);
           $this->config->addBodyClass($websiteCode);
       }
    }

     

     

    Send shipment email programmaticaly through cronjob

    Let’s say I have this requirement to send the shipment email every 5 minutes or 10 minutes. To perform the task, I chose to create a custom cronjob and its file to achieve the functionality. Follow the below steps for more details.

    Step 1: Create a crontab.xml

    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
        <group id="default">
            <job name="sendshipmentemail" instance="MagemonkeysShipmentemailsendCronSend" method="execute">
                <schedule>0,15,30,45 * * * *</schedule>
            </job>
        </group>
    </config>

    Step 2: Create a Send.php file. Please follow the below code

    <?php
    
    namespace MagemonkeysShipmentemailsendCron;
    
    use MagentoFrameworkApiSearchFilterGroupBuilder;
    use MagentoFrameworkApiSearchCriteriaBuilder;
    use MagentoFrameworkAppObjectManager;
    use MagentoSalesModelOrderShipmentRepository;
    use MagentoSalesModelOrderRepository;
    use MagentoFrameworkApiFilterBuilder;
    use PsrLogLoggerInterface;
    
    class Send
    {
    
        private $orderRepository;
        private $searchCriteriaBuilder;
    
        public function __construct(
    
            OrderRepository $orderRepository,
            SearchCriteriaBuilder $searchCriteriaBuilder,
            ShipmentRepository $shipmentRepository,
            FilterBuilder $filterBuilder,
            FilterGroupBuilder $filterGroupBuilder,
            LoggerInterface $logger
        )
        {
            $this->orderRepository = $orderRepository;
            $this->shipmentRepository = $shipmentRepository;
            $this->searchCriteriaBuilder = $searchCriteriaBuilder;
            $this->filterBuilder = $filterBuilder;
            $this->filterGroupBuilder = $filterGroupBuilder;
            $this->objectManager = ObjectManager::getInstance();
            $this->logger = $logger;
        }
    
    
        public function execute()
        {
    
            $filtergroup_date = $this->filterGroupBuilder
                ->addFilter(
                    $this->filterBuilder
                        ->setField('created_at')
                        ->setConditionType('gt')
                        ->setValue('2020-01-01')
                        ->create()
                )
                ->create();
    
    
            $filtergroup_email_sent = $this->filterGroupBuilder
                ->addFilter(
                    $this->filterBuilder
                        ->setField('email_sent')
                        ->setConditionType('null')
                        ->create()
                )
                ->create();
    
            $filtergroup_send_email = $this->filterGroupBuilder
                ->addFilter(
                    $this->filterBuilder
                        ->setField('send_email')
                        ->setConditionType('null')
                        ->create()
                )
                ->create();
    
            $searchCriteria = $this->searchCriteriaBuilder
                ->setFilterGroups([
                    $filtergroup_date,
                    $filtergroup_email_sent,
                    $filtergroup_send_email
                ])
                ->create();;
    
            $shipmentList = $this->shipmentRepository->getList($searchCriteria)->getItems();
    
            foreach ($shipmentList as $shipment) {
                if (count($shipment->getTracks()) > 0) {
                    $this->objectManager->create('MagentoShippingModelShipmentNotifier')->notify($shipment);
                    $shipment->setEmailSent("1");
                    $shipment->save();
                } else {
                    $this->logger->warning("Unable to send shipment email for order");
                }
            }
        }
    }

    Now, when the cron runs it will execute our code and if any shipment mail needs to send then it will be sent.

    How to get salable quantity in Magento 2?

    Today we are going to share that how to get the actual salable quantity on the product detail page?

    Let’s say our requirement is to show available qty on the site

    You can use the below code by using object manager directly use in your phtml file.

    <?php 
        $objectManager = MagentoFrameworkAppObjectManager::getInstance();
        echo __('Quantity available: '); 
        $StockState = $objectManager->get('MagentoInventorySalesAdminUiModelGetSalableQuantityDataBySku');
        $qty = $StockState->execute($_product->getSku());
        echo $qty[0]['qty'];
    ?>

    That’s it.

    Magento 2: How to add new body class on all pages in your theme?

    If your want to add body class in all page in your theme then follow below code.

    Create default.xml file in app/design/frontend/Vendername/Themename/Magento_Theme/layout folder and paste below code

    <?xml version="1.0"?>a
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
    <attribute name="class" value="theme-tpb"/> 
    </body>

    How to Call Script in Magento 2 Root?

    For example, if you want to get the order data and print it, you can create a root script in Magento 2 by executing the below code.

    <?php
    use MagentoFrameworkAppBootstrap;
    require 'app/bootstrap.php';
    $bootstrap = Bootstrap::create(BP, $_SERVER);
    $objectManager = $bootstrap->getObjectManager();
    $state = $objectManager->get('MagentoFrameworkAppState');
    $state->setAreaCode('frontend');
    echo 'My Script';

     

    Challenges Implementing eCommerce Project Discussion with Dan Brag, the Founder at Brag Deal Inc

    It was a great pleasure to have Dan Brag, the Founder at Brag Deal Inc giving us valuable time and insights on the Best Project management Practices on E-commerce projects.

    Dan has shared that fulfilling the customer need is the top priority and Brag Deal Inc choose the e-commerce platform based on the business needs and what is suited best for them. He also shared that the deep truth of different platforms for e-commerce like every platform has its own pros and cons, and their team mostly uses the Woo-commerce platform reason being its flexibility, stability, and ease of using its functionality.

    While speaking about the Project Management Practices, Dan is more flexible while choosing the best practices and due to the nature of the E-commerce project, the scope keeps changing, so it is hard to stick to a definite Project Management practice like Lean or Agile.

    Dan has shared that the most challenging part of an e-commerce project is you start a project in a day and the next day business encounters a new challenge in the market so they need to change a few things in the development and keeping align with those changes to fulfill the customer demands and when the scope is so big it is hard to cover everything, every little detail, so it is our responsibility to communicate well, keep track on the development phase with the Business and get the project reviewed in every development phase.

    He shared that before going live, he prefers to make sure that all development has been taken care of seamlessly. Every little thing has been checked during the development phase so it is quite easy for the team to review the whole project and make it live and analyze the site later on once the business is on its goo.