Index: in-commerce/install/install_schema.sql
===================================================================
--- in-commerce/install/install_schema.sql (revision 13558)
+++ in-commerce/install/install_schema.sql (working copy)
@@ -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: in-commerce/install/upgrades.sql
===================================================================
--- in-commerce/install/upgrades.sql (revision 13632)
+++ in-commerce/install/upgrades.sql (working copy)
@@ -157,4 +157,7 @@
ADD INDEX (PaymentTypes);
UPDATE Phrase SET Module = 'Core' WHERE Phrase IN ('la_btn_Add', 'la_fld_RecipientName', 'la_fld_SenderName');
-DELETE FROM Permissions WHERE Permission LIKE 'in-commerce:incommerce_configemail%';
\ No newline at end of file
+DELETE FROM Permissions WHERE Permission LIKE 'in-commerce:incommerce_configemail%';
+
+# ===== v 5.1.0-B2 =====
+ALTER TABLE Products CHANGE CachedRating CachedRating varchar(10) NOT NULL default '0';
\ No newline at end of file
Index: in-commerce/units/pricing/pricing_event_handler.php
===================================================================
--- in-commerce/units/pricing/pricing_event_handler.php (revision 13557)
+++ in-commerce/units/pricing/pricing_event_handler.php (working copy)
@@ -365,18 +365,25 @@
$event->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: in-commerce/units/products/products_config.php
===================================================================
--- in-commerce/units/products/products_config.php (revision 13632)
+++ in-commerce/units/products/products_config.php (working copy)
@@ -492,7 +492,7 @@
'not_null' => 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: in-news/admin_templates/category_properties.tpl
===================================================================
--- in-news/admin_templates/category_properties.tpl (revision 13557)
+++ in-news/admin_templates/category_properties.tpl (working copy)
@@ -24,9 +24,9 @@
-
+
-
-
+
+