Skip to content

Instantly share code, notes, and snippets.

@incrize
Created August 26, 2019 08:40
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 incrize/bca1a1e7cb8b8ee8052b8b2b67adc6bb to your computer and use it in GitHub Desktop.
Save incrize/bca1a1e7cb8b8ee8052b8b2b67adc6bb to your computer and use it in GitHub Desktop.
diff --git a/app/addons/product_variations/controllers/backend/product_variations_converter.php b/app/addons/product_variations/controllers/backend/product_variations_converter.php
index d5c549ca39..32f3a153d7 100644
--- a/app/addons/product_variations/controllers/backend/product_variations_converter.php
+++ b/app/addons/product_variations/controllers/backend/product_variations_converter.php
@@ -1205,7 +1205,7 @@ function fn_product_variations_convert_get_child_products($limit = 1000)
. ' LEFT JOIN ?:categories AS ac ON ac.category_id = pca.category_id ?p'
. ' LEFT JOIN ?:category_descriptions AS mcd ON mcd.category_id = mc.category_id AND mcd.lang_code = ?s'
. ' LEFT JOIN ?:category_descriptions AS acd ON acd.category_id = ac.category_id AND acd.lang_code = ?s'
- . ' WHERE p.product_type = ?s AND p.__variation_options IS NOT NULL AND p.parent_product_id > 0 LIMIT ?i OFFSET ?i',
+ . ' WHERE p.product_type = ?s AND p.__variation_options IS NOT NULL AND p.parent_product_id > 0 ORDER BY p.product_id ASC LIMIT ?i OFFSET ?i',
'product_id',
CART_LANGUAGE, CART_LANGUAGE, 'M', 'A', $join_main_category_conditions, $join_additional_category_conditions,
CART_LANGUAGE, CART_LANGUAGE, 'V', $limit, $offset
@@ -1249,7 +1249,7 @@ function fn_product_variations_convert_get_products_using_combinations($filter_p
. ' LEFT JOIN ?:category_descriptions AS mcd ON mcd.category_id = mc.category_id AND mcd.lang_code = ?s'
. ' LEFT JOIN ?:category_descriptions AS acd ON acd.category_id = ac.category_id AND acd.lang_code = ?s'
. ' ?p'
- . ' LIMIT ?i OFFSET ?i',
+ . ' ORDER BY p.product_id ASC LIMIT ?i OFFSET ?i',
CART_LANGUAGE, 'M', 'A', $join_main_category_conditions, $join_additional_category_conditions,
CART_LANGUAGE, CART_LANGUAGE, $condition, $limit, $offset
);
@@ -1289,6 +1289,7 @@ function fn_product_variations_convert_find_usage_options($by_variations = true,
'option_name' => null,
'option_inner_name' => null,
'position' => null,
+ 'feature_key' => null,
'variant_ids' => [],
'variants' => [],
];
@@ -1432,9 +1433,9 @@ function fn_product_variations_convert_get_features($options)
if (!isset($result[$key])) {
$result[$key] = [
- 'feature_code' => $key,
- 'feature_name' => $option['option_name'],
- 'position' => $option['position'],
+ 'feature_code' => (string) $key,
+ 'feature_name' => (string) $option['option_name'],
+ 'position' => (int) $option['position'],
'is_merged' => !empty($option['is_merged']),
'variants' => [],
'category_ids' => [],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment