Index: branches/5.1.x/install/install_schema.sql =================================================================== diff -u -N -r13558 -r13809 --- branches/5.1.x/install/install_schema.sql (.../install_schema.sql) (revision 13558) +++ branches/5.1.x/install/install_schema.sql (.../install_schema.sql) (revision 13809) @@ -301,7 +301,7 @@ Modified int(10) unsigned DEFAULT NULL, Expire int(10) unsigned DEFAULT NULL, Hits double NOT NULL DEFAULT '0', - CachedRating decimal(11,10) NOT NULL DEFAULT '0.0000000000', + CachedRating varchar(10) NOT NULL default '0', CachedVotesQty int(11) NOT NULL DEFAULT '0', CachedReviewsQty int(11) NOT NULL DEFAULT '0', CreatedById int(11) NOT NULL DEFAULT '0', Index: branches/5.1.x/install/upgrades.sql =================================================================== diff -u -N -r13772 -r13809 --- branches/5.1.x/install/upgrades.sql (.../upgrades.sql) (revision 13772) +++ branches/5.1.x/install/upgrades.sql (.../upgrades.sql) (revision 13809) @@ -176,4 +176,7 @@ 'la_tooltip_New_Discount' ); -DELETE FROM Phrase WHERE Phrase = 'la_comm_ProductsByManuf'; \ No newline at end of file +DELETE FROM Phrase WHERE Phrase = 'la_comm_ProductsByManuf'; + +# ===== v 5.1.0 ===== +ALTER TABLE Products CHANGE CachedRating CachedRating varchar(10) NOT NULL default '0'; Index: branches/5.1.x/units/pricing/pricing_event_handler.php =================================================================== diff -u -N -r13745 -r13809 --- branches/5.1.x/units/pricing/pricing_event_handler.php (.../pricing_event_handler.php) (revision 13745) +++ branches/5.1.x/units/pricing/pricing_event_handler.php (.../pricing_event_handler.php) (revision 13809) @@ -1,6 +1,6 @@ redirect_params = Array('opener' => 's'); //stay! } + /** + * Resets primary mark for other pricings of given product, when current pricing is primary + * + * @param kEvent $event + */ function OnBeforeItemUpdate(&$event) { - // TODO: during import special of product is not empty as usual and this raises problems to getLinkedInfo + parent::OnBeforeItemUpdate($event); + $object =& $event->getObject(); - $table_info = $object->getLinkedInfo(); + /* @var $object kDBItem */ - $table_info['ParentId'] = ($table_info['ParentId']?$table_info['ParentId']:0); - - if ( $object->GetDBField('IsPrimary') == 1 ){ - $this->Conn->Query('UPDATE '.$object->TableName.' SET IsPrimary = 0 WHERE '.$table_info['ForeignKey'].' = '.$table_info['ParentId']); + if ($object->GetDBField('IsPrimary') == 1) { + // make all pricings non primary, when this one is + $sql = 'UPDATE ' . $object->TableName . ' + SET IsPrimary = 0 + WHERE (ProductId = ' . $object->GetDBField('ProductId') . ') AND (' . $object->IDField . ' <> ' . $object->GetID() . ')'; + $this->Conn->Query($sql); } - } /** Index: branches/5.1.x/units/products/products_config.php =================================================================== diff -u -N -r13745 -r13809 --- branches/5.1.x/units/products/products_config.php (.../products_config.php) (revision 13745) +++ branches/5.1.x/units/products/products_config.php (.../products_config.php) (revision 13809) @@ -1,6 +1,6 @@ 1, 'default' => 0, ), 'Priority' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), - 'CachedRating' => Array ('not_null' => 1, 'default' => 0, 'type' => 'float', 'formatter' => 'kFormatter', 'format' => '%0.2f'), + 'CachedRating' => Array ('type' => 'string', 'not_null' => 1, 'formatter' => 'kFormatter', 'default' => 0), 'CachedVotesQty' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), 'Hits' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%d', 'not_null' => 1, 'default' => 0), 'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'), Index: branches/5.1.x/admin_templates/products/products_access.tpl =================================================================== diff -u -N -r13100 -r13809 --- branches/5.1.x/admin_templates/products/products_access.tpl (.../products_access.tpl) (revision 13100) +++ branches/5.1.x/admin_templates/products/products_access.tpl (.../products_access.tpl) (revision 13809) @@ -83,7 +83,7 @@ - + Index: branches/5.1.x/admin_templates/products/products_files.tpl =================================================================== diff -u -N -r13100 -r13809 --- branches/5.1.x/admin_templates/products/products_files.tpl (.../products_files.tpl) (revision 13100) +++ branches/5.1.x/admin_templates/products/products_files.tpl (.../products_files.tpl) (revision 13809) @@ -111,7 +111,7 @@
- +