Skip to content

Instantly share code, notes, and snippets.

@kugimiya
Created January 15, 2018 13:44
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 kugimiya/342e6ebff89c06c61020d51f0d5bdd04 to your computer and use it in GitHub Desktop.
Save kugimiya/342e6ebff89c06c61020d51f0d5bdd04 to your computer and use it in GitHub Desktop.
diff --git a/app/functions/fn.catalog.php b/app/functions/fn.catalog.php
index 4998bf3..959693a 100644
--- a/app/functions/fn.catalog.php
+++ b/app/functions/fn.catalog.php
@@ -8040,6 +8040,7 @@ function fn_apply_options_rules($product)
// Change product code and amount
if (!empty($product['tracking']) && $product['tracking'] == ProductTracking::TRACK_WITH_OPTIONS) {
$product['hide_stock_info'] = false;
+
if ($product['options_type'] == 'S') {
foreach ($product['product_options'] as $option) {
$option_id = $option['option_id'];
@@ -8049,6 +8050,14 @@ function fn_apply_options_rules($product)
break;
}
}
+ } else {
+ $show_stock_info = true;
+
+ foreach ($product['product_options'] as $option) {
+ $show_stock_info = $show_stock_info && (!empty($option['value']));
+ }
+
+ $product['hide_stock_info'] = !$show_stock_info;
}
if (!$product['hide_stock_info']) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment