Skip to content

magento man

What is role of ‘type’ => ‘static’ in Magento 2 data patch?

Recently I saw Setup/Patch/Data with ‘type’ => ‘static’ $eavSetup->addAttribute( MagentoCatalogModelProduct::ENTITY, ‘attribute_code’, [ ‘group’ => ‘General’, ‘label’ => ‘Product Type ID’, ‘type’ => ‘static’, ‘input’ => ‘select’, ‘source’ => VendorModuleModelSourceSource::class, ‘required’ => false, ‘sort_order’ => 1, ‘global’ => Attribute::SCOPE_GLOBAL, ‘used_in_product_listing’ =>… Read More »What is role of ‘type’ => ‘static’ in Magento 2 data patch?

Updating total savings block in cart

I’ve successfully added a total_savings block to my theme. It works well by doing the calculation in the phtml file. themeMagento_Checkoutlayoutcheckout_cart_index.xml: <?xml version=”1.0″?> <page layout=”1column” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:View/Layout/etc/page_configuration.xsd”> <body> <referenceContainer name=”checkout.cart.totals.container”> <block class=”MagentoFrameworkViewElementTemplate” name=”checkout.cart.total.savings” after=”checkout.cart.totals” template=”Magento_Checkout::total_savings.phtml” /> </referenceContainer> </body> </page> But… Read More »Updating total savings block in cart

how to get SUM of value from the collection?

I’m trying to get some of the values from the collection, below is my code. <?php public function RentalPartnerRevenue() { $filter = $this->request->getParam(‘filter’); $operator_id = $this->request->getParam(‘operator_id’); try{ $completecollection1 = $this->_orderCollectionFactory->create() ->addAttributeToSelect(‘*’); if(isset($filter) && $filter == ‘totalrevenue’){ //$completecollection1->addAttributeToSelect(‘grand_total’)->getColumnValues(‘grand_total’); $completecollection1->getSelect()->joinLeft( ‘rider_detail as… Read More »how to get SUM of value from the collection?