public function populateSelect(\Magento\Sales\Model\ResourceModel\Order\Grid\Collection $collection) { $select = $collection->getSelect(); /* LEFT JOIN `prxgt_pv_sale` */ $tbl = [self::AS_TBL_PV_SALES => $this->_resource->getTableName(Sale::ENTITY_NAME)]; $on = self::AS_TBL_PV_SALES . '.' . Sale::ATTR_SALE_ID . '=main_table.' . Cfg::E_SALE_ORDER_A_ENTITY_ID; $cols = [self::AS_FLD_PV_TOTAL => Sale::ATTR_TOTAL, self::AS_FLD_PV_DISCOUNT => Sale::ATTR_DISCOUNT, self::AS_FLD_PV_SUBTOTAL => Sale::ATTR_SUBTOTAL]; $select->joinLeft($tbl, $on, $cols); }
public function populateSelect(\Magento\Sales\Model\ResourceModel\Order\Grid\Collection $collection) { $select = $collection->getSelect(); /* LEFT JOIN `prxgt_odoo_sale` */ $tbl = [self::AS_TBL_ODOO_SALE => $this->_resource->getTableName(SaleOrder::ENTITY_NAME)]; $on = self::AS_TBL_ODOO_SALE . '.' . SaleOrder::ATTR_MAGE_REF . '=main_table.' . Cfg::E_SALE_ORDER_A_ENTITY_ID; $exp = new Expression('!ISNULL(' . self::AS_TBL_ODOO_SALE . '.' . SaleOrder::ATTR_MAGE_REF . ')'); $cols = [self::AS_FLD_IS_IN_ODOO => $exp]; $select->joinLeft($tbl, $on, $cols); return $select; }