diff --git a/admin-dev/ajax_products_list.php b/admin-dev/ajax_products_list.php
index 8650abd8d..64ee54211 100644
--- a/admin-dev/ajax_products_list.php
+++ b/admin-dev/ajax_products_list.php
@@ -51,13 +51,16 @@ else
// Excluding downloadable products from packs because download from pack is not supported
$excludeVirtuals = (bool)Tools::getValue('excludeVirtuals', false);
+$exclude_packs = (bool)Tools::getValue('exclude_packs', false);
$sql = 'SELECT p.`id_product`, `reference`, pl.name
FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.(int)Context::getContext()->language->id.Shop::addSqlRestrictionOnLang('pl').')
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'.
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
- ($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : '');
+ ($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : '').
+ ($exclude_packs ? 'AND (p.cache_is_pack IS NULL OR p.cache_is_pack = 0)' : '');
+
$items = Db::getInstance()->executeS($sql);
if ($items)
diff --git a/admin-dev/themes/default/template/controllers/products/informations.tpl b/admin-dev/themes/default/template/controllers/products/informations.tpl
index 26b38e36b..eabf0c984 100644
--- a/admin-dev/themes/default/template/controllers/products/informations.tpl
+++ b/admin-dev/themes/default/template/controllers/products/informations.tpl
@@ -97,9 +97,9 @@
-
+
-
+
diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php
index a3b1045bf..8284e3da9 100644
--- a/controllers/admin/AdminProductsController.php
+++ b/controllers/admin/AdminProductsController.php
@@ -3379,6 +3379,7 @@ class AdminProductsControllerCore extends AdminController
$product->tags = Tag::getProductTags($product->id);
$data->assign('product_type', (int)Tools::getValue('type_product', $product->getType()));
+ $data->assign('is_in_pack', (int)Pack::isPacked($product->id));
$check_product_association_ajax = false;
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL)
@@ -4115,10 +4116,6 @@ class AdminProductsControllerCore extends AdminController
$this->tpl_form_vars['custom_form'] = Hook::exec('displayAdminProductsExtra', array(), (int)$id_module);
}
-
-
-
-
/**
* delete all items in pack, then check if type_product value is 2.
* if yes, add the pack items from input "inputPackItems"
@@ -4143,7 +4140,9 @@ class AdminProductsControllerCore extends AdminController
list($qty, $item_id) = explode('x', $line);
if ($qty > 0 && isset($item_id))
{
- if (!Pack::addItem((int)$product->id, (int)$item_id, (int)$qty))
+ if (Pack::isPack((int)$item_id))
+ $this->errors[] = Tools::displayError('You can\'t add product packs into a pack');
+ elseif (!Pack::addItem((int)$product->id, (int)$item_id, (int)$qty))
$this->errors[] = Tools::displayError('An error occurred while adding products to the pack.');
}
}
diff --git a/js/admin-products.js b/js/admin-products.js
index 88f36d8eb..1867893ba 100644
--- a/js/admin-products.js
+++ b/js/admin-products.js
@@ -991,7 +991,8 @@ product_tabs['Pack'] = new function(){
},
extraParams: {
excludeIds : getSelectedIds(),
- excludeVirtuals : 1
+ excludeVirtuals : 1,
+ exclude_packs: 1
}
}).result(function(event, item){
$('#curPackItemId').val(item[1]);