Index: modules/in-commerce/units/orders/orders_item.php =================================================================== --- modules/in-commerce/units/orders/orders_item.php +++ modules/in-commerce/units/orders/orders_item.php @@ -93,15 +93,22 @@ /** * Checks if tangible items are present in order * - * @return bool + * @return boolean */ - function HasTangibleItems() + public function HasTangibleItems() { + $oi_table = TABLE_PREFIX . 'OrderItems'; + + if ( $this->IsTempTable() ) { + $oi_table = $this->Application->GetTempName($oi_table, 'prefix:' . $this->Prefix); + } + $sql = 'SELECT COUNT(*) - FROM '.TABLE_PREFIX.'OrderItems orditems - LEFT JOIN '.TABLE_PREFIX.'Products p ON p.ProductId = orditems.ProductId - WHERE (orditems.OrderId = '.$this->GetID().') AND (p.Type = '.PRODUCT_TYPE_TANGIBLE.')'; - return $this->Conn->GetOne($sql) ? true : false; + FROM ' . $oi_table . ' orditems + LEFT JOIN ' . TABLE_PREFIX . 'Products p ON p.ProductId = orditems.ProductId + WHERE (orditems.OrderId = ' . $this->GetID() . ') AND (p.Type = ' . PRODUCT_TYPE_TANGIBLE . ')'; + + return $this->Conn->GetOne($sql) > 0; } /**