Skip to content

Instantly share code, notes, and snippets.

@edavydova
Created December 25, 2019 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edavydova/7b9e23b1c2ca646b6ebaa787fae82d86 to your computer and use it in GitHub Desktop.
Save edavydova/7b9e23b1c2ca646b6ebaa787fae82d86 to your computer and use it in GitHub Desktop.
diff --git a/app/functions/fn.catalog.php b/app/functions/fn.catalog.php
index cbbbd3f..8633705 100644
--- a/app/functions/fn.catalog.php
+++ b/app/functions/fn.catalog.php
@@ -5403,7 +5403,7 @@ function fn_update_product_feature($feature_data, $feature_id, $lang_code = DESC
} else {
$action = 'update';
- $old_feature_data = fn_get_feature_data_with_subfeatures($feature_id, $lang_code);
+ $old_feature_data = fn_get_feature_data_with_subfeatures($feature_id, $lang_code, ['statuses' => []]);
if (!$old_feature_data) {
fn_set_notification(
@@ -12598,20 +12598,21 @@ function fn_delete_global_option_link($product_id, $option_id)
/**
* Gets current feature data when updating it.
*
- * @param int $feature_id
- * @param string $lang_code
+ * @param int $feature_id Feature identifier
+ * @param string $lang_code Two-letter language code
+ * @param array $params Additional param for searching features
*
* @return array|null
*
* @internal
*/
-function fn_get_feature_data_with_subfeatures($feature_id, $lang_code)
+function fn_get_feature_data_with_subfeatures($feature_id, $lang_code, array $params = [])
{
- list($feature_data,) = fn_get_product_features([
+ list($feature_data,) = fn_get_product_features(array_merge($params, [
'feature_id' => $feature_id,
'plain' => true,
'exclude_group' => true,
- ], 0, $lang_code);
+ ]), 0, $lang_code);
if (!$feature_data) {
return null;
@@ -12620,9 +12621,9 @@ function fn_get_feature_data_with_subfeatures($feature_id, $lang_code)
$feature_data = reset($feature_data);
if ($feature_data['feature_type'] === ProductFeatures::GROUP) {
- list($feature_data,) = fn_get_product_features([
+ list($feature_data,) = fn_get_product_features(array_merge($params, [
'parent_id' => $feature_id,
- ], 0, $lang_code);
+ ]), 0, $lang_code);
$feature_data = reset($feature_data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment