Index: branches/5.2.x/units/products/products_tag_processor.php =================================================================== diff -u -N -r14918 -r14957 --- branches/5.2.x/units/products/products_tag_processor.php (.../products_tag_processor.php) (revision 14918) +++ branches/5.2.x/units/products/products_tag_processor.php (.../products_tag_processor.php) (revision 14957) @@ -1,6 +1,6 @@ Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params); + $object =& $this->getObject($params); + /* @var $object kDBItem */ - if (!$object->GetDBField('InventoryStatus')) return true; + if ( !$object->GetDBField('InventoryStatus') ) { + return true; + } $backordering = $this->Application->ConfigValue('Comm_Enable_Backordering'); - if ($object->GetDBField('InventoryStatus') == 2) { + if ( $object->GetDBField('InventoryStatus') == 2 ) { $poc_table = $this->Application->getUnitOption('poc', 'TableName'); - $sql = 'SELECT SUM(IF(QtyInStock > '.$object->GetDBField('QtyInStockMin').', 1, 0)) - FROM '.$poc_table.' - WHERE (ProductId = '.$object->GetID().') AND (Availability = 1)'; + $sql = 'SELECT SUM(IF(QtyInStock > ' . $object->GetDBField('QtyInStockMin') . ', 1, 0)) + FROM ' . $poc_table . ' + WHERE (ProductId = ' . $object->GetID() . ') AND (Availability = 1)'; $stock_available = $this->Conn->GetOne($sql) > 0; // at least one option combination present } else { - $stock_available = $object->GetDBField('QtyInStock') > $object->GetDBField('QtyInStockMin'); + $stock_available = $object->GetDBField('QtyInStock') > $object->GetDBField('QtyInStockMin'); } $prod_backordering = $object->GetDBField('BackOrder'); - if ($stock_available) return true; + if ( $stock_available ) { + return true; + } // stock is NOT available: - if (!$backordering || $prod_backordering == 0) return false; // if backordering is generaly disabled or disabled for product (Never) + if ( !$backordering || $prod_backordering == 0 ) { + // if backordering is generaly disabled or disabled for product (Never) + return false; + } // backordering enabled; (auto or always mode) return true;