Created
October 1, 2019 13:31
-
-
Save edavydova/912f9c6fb3431ed349530990dda78659 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/addons/wishlist/func.php b/app/addons/wishlist/func.php | |
index f75cebd..62995fa 100644 | |
--- a/app/addons/wishlist/func.php | |
+++ b/app/addons/wishlist/func.php | |
@@ -112,12 +112,6 @@ function fn_wishlist_get_carts(&$type_restrictions) | |
} | |
} | |
-function fn_wishlist_get_carts_before_select($params, $items_per_page, $fields, $join, &$condition, &$group, &$sorting, $limit) | |
-{ | |
- $group = ''; | |
- $sorting = db_quote(' ORDER BY ?:user_session_products.type = ?s ASC', 'C');; | |
-} | |
- | |
function fn_wishlist_get_additional_information(&$product, &$products_data) | |
{ | |
$_product = reset($products_data['product_data']); | |
@@ -151,3 +145,23 @@ function fn_wishlist_get_count() | |
return empty($result) ? -1 : $result; | |
} | |
+ | |
+/** | |
+ * The "save_cart_content_pre" hook handler. | |
+ * | |
+ * Actions performed: | |
+ * - Gets user data info from session and adds them into records with wishlist type | |
+ * | |
+ * @see fn_save_cart_content | |
+ */ | |
+function fn_wishlist_save_cart_content_pre(&$cart, $user_id, $type, $user_type) | |
+{ | |
+ if ($type == 'W') { | |
+ if (empty($cart['user_data']) && !empty(Tygh::$app['session']['cart']['user_data'])) { | |
+ $cart['user_data'] = Tygh::$app['session']['cart']['user_data']; | |
+ } | |
+ } elseif (!empty(Tygh::$app['session']['wishlist']) && !empty($cart['user_data'])) { | |
+ Tygh::$app['session']['wishlist']['user_data'] = $cart['user_data']; | |
+ fn_save_cart_content(Tygh::$app['session']['wishlist'], $user_id, 'W', $user_type); | |
+ } | |
+} | |
\ No newline at end of file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/addons/wishlist/init.php b/app/addons/wishlist/init.php | |
index bc40b3c..67bbef1 100644 | |
--- a/app/addons/wishlist/init.php | |
+++ b/app/addons/wishlist/init.php | |
@@ -21,7 +21,7 @@ fn_register_hooks( | |
'init_user_session_data', | |
'pre_add_to_cart', | |
'get_carts', | |
- 'get_carts_before_select', | |
'get_additional_information', | |
- 'sucess_user_login' | |
+ 'sucess_user_login', | |
+ 'save_cart_content_pre' | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/functions/fn.cart.php b/app/functions/fn.cart.php | |
index 7313841..c4cbe41 100644 | |
--- a/app/functions/fn.cart.php | |
+++ b/app/functions/fn.cart.php | |
@@ -9454,7 +9454,6 @@ function fn_get_carts($params, $items_per_page = 0) | |
'?:user_session_products.timestamp AS date', | |
'?:user_session_products.ip_address', | |
'?:user_session_products.extra', | |
- '?:user_session_products.type AS type' | |
); | |
// Define sort fields |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment