Skip to content

Instantly share code, notes, and snippets.

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 ichaykin/e61b216651bb00396283cca99f51b080 to your computer and use it in GitHub Desktop.
Save ichaykin/e61b216651bb00396283cca99f51b080 to your computer and use it in GitHub Desktop.
diff --git a/app/addons/product_variations/src/HookHandlers/ProductsHookHandler.php b/app/addons/product_variations/src/HookHandlers/ProductsHookHandler.php
index bd8f1aa..41ae2f6 100644
--- a/app/addons/product_variations/src/HookHandlers/ProductsHookHandler.php
+++ b/app/addons/product_variations/src/HookHandlers/ProductsHookHandler.php
@@ -24,6 +24,7 @@ use Tygh\Addons\ProductVariations\ServiceProvider;
use Tygh\Application;
use Tygh\Enum\NotificationSeverity;
use Tygh\Enum\ProductFeatures;
+use Tygh\Enum\YesNo;
use Tygh\Registry;
use Tygh\Tools\Url;
@@ -45,6 +46,7 @@ class ProductsHookHandler
* The "get_products_pre" hook handler.
*
* Actions performed:
+ * - Adds include_child_variations to the search parameters if search from the list of orders
* - Modifies also_bought_for_product_id search params with taking into account variation sub group products
*
* @see fn_get_products
@@ -53,6 +55,10 @@ class ProductsHookHandler
{
$product_id_map = ServiceProvider::getProductIdMap();
+ if (!empty($params['order_ids'])) {
+ $params['include_child_variations'] = YesNo::YES;
+ }
+
if (empty($params['also_bought_for_product_id']) || !$product_id_map->isVariationProduct($params['also_bought_for_product_id'])) {
return;
}
@@ -1284,7 +1290,8 @@ class ProductsHookHandler
&& empty($params['is_picker'])
&& empty($params['pid'])
&& empty($params['get_conditions'])
- && empty($params['variations_by_product_id']);
+ && empty($params['variations_by_product_id'])
+ && empty($params['order_ids']);
}
/**
diff --git a/design/themes/responsive/templates/views/orders/search.tpl b/design/themes/responsive/templates/views/orders/search.tpl
index d8fd458..8f723e8 100644
--- a/design/themes/responsive/templates/views/orders/search.tpl
+++ b/design/themes/responsive/templates/views/orders/search.tpl
@@ -64,7 +64,7 @@
but_meta="ty-btn-icon"
but_role="text"
but_title=__("search_products")
- but_href="products.search?search_performed=Y&order_ids=`$o.order_id`"
+ but_href="products.search?search_performed=Y&order_ids=`$o.order_id`"
but_icon="ty-orders__actions-icon ty-icon-search"}
</td>
</tr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment