[+] BO : added a new option for the products : do they appear in the catalog, in the search, both or neither
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13638 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -85,24 +85,32 @@
|
||||
<table cellpadding="5" style="width: 40%; float: left; margin-left: 10px;">
|
||||
<tr>
|
||||
<td class="col-left">
|
||||
|
||||
|
||||
<label class="text">{l s='Status:'}</label></td>
|
||||
<label class="text">{l s='Status:'}</label>
|
||||
</td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<ul class="listForm">
|
||||
<li>
|
||||
<input onclick="toggleDraftWarning(false);showOptions(true);" type="radio" name="active" id="active_on" value="1" {if $product->active}checked="checked" {/if} />
|
||||
<label for="active_on" class="radioCheck">
|
||||
{l s='Enabled'}</label>
|
||||
</li>
|
||||
|
||||
<label for="active_on" class="radioCheck">{l s='Enabled'}</label>
|
||||
</li>
|
||||
<li>
|
||||
<input onclick="toggleDraftWarning(true);showOptions(false);" type="radio" name="active" id="active_off" value="0" {if !$product->active}checked="checked"{/if} />
|
||||
<label for="active_off" class="radioCheck">{l s='Disabled'} </label>
|
||||
<label for="active_off" class="radioCheck">{l s='Disabled'}</label>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left"><label>{l s='Visibility:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
<select name="visibility" id="visibility">
|
||||
<option value="both" {if $product->visibility == 'both'}selected="selected"{/if} >{l s='Everywhere'}</option>
|
||||
<option value="catalog" {if $product->visibility == 'catalog'}selected="selected"{/if} >{l s='Catalog only'}</option>
|
||||
<option value="search" {if $product->visibility == 'search'}selected="selected"{/if} >{l s='Search only'}</option>
|
||||
<option value="none" {if $product->visibility == 'none'}selected="selected"{/if}>{l s='Nowhere'}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="product_options" {if !$product->active}style="display:none"{/if} >
|
||||
<td class="col-left"><label>{l s='Options:'}</label></td>
|
||||
<td style="padding-bottom:5px;">
|
||||
|
||||
@@ -579,7 +579,11 @@ class CategoryCore extends ObjectModel
|
||||
$context = Context::getContext();
|
||||
if (!$check_access || !$this->checkAccess($context->customer->id))
|
||||
return false;
|
||||
|
||||
|
||||
$front = true;
|
||||
if (!in_array($context->controller->controller_type, array('front', 'modulefront')))
|
||||
$front = false;
|
||||
|
||||
if ($p < 1) $p = 1;
|
||||
|
||||
if (empty($order_by))
|
||||
@@ -618,6 +622,7 @@ class CategoryCore extends ObjectModel
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`
|
||||
WHERE cp.`id_category` = '.(int)$this->id.
|
||||
($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').
|
||||
($active ? ' AND p.`active` = 1' : '').
|
||||
($id_supplier ? 'AND p.id_supplier = '.(int)$id_supplier : '');
|
||||
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
@@ -666,6 +671,7 @@ class CategoryCore extends ObjectModel
|
||||
WHERE asso_shop_product.`id_shop` = '.(int)Context::getContext()->shop->id.'
|
||||
AND cp.`id_category` = '.(int)$this->id
|
||||
.($active ? ' AND p.`active` = 1' : '')
|
||||
.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '')
|
||||
.($id_supplier ? ' AND p.id_supplier = '.(int)$id_supplier : '');
|
||||
|
||||
if ($random === true)
|
||||
|
||||
+23
-12
@@ -276,6 +276,10 @@ class ManufacturerCore extends ObjectModel
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$front = true;
|
||||
if (!in_array($context->controller->controller_type, array('front', 'modulefront')))
|
||||
$front = false;
|
||||
|
||||
if ($p < 1)
|
||||
$p = 1;
|
||||
|
||||
@@ -299,6 +303,7 @@ class ManufacturerCore extends ObjectModel
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE p.id_manufacturer = '.(int)$id_manufacturer
|
||||
.($active ? ' AND p.`active` = 1' : '').'
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -350,8 +355,9 @@ class ManufacturerCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m
|
||||
ON (m.`id_manufacturer` = p.`id_manufacturer`)
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE p.`id_manufacturer` = '.(int)$id_manufacturer.($active ? '
|
||||
AND p.`active` = 1' : '').'
|
||||
WHERE p.`id_manufacturer` = '.(int)$id_manufacturer.'
|
||||
'.($active ? ' AND p.`active` = 1' : '').'
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -376,15 +382,20 @@ class ManufacturerCore extends ObjectModel
|
||||
|
||||
public function getProductsLite($id_lang)
|
||||
{
|
||||
$sql = 'SELECT p.`id_product`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
)
|
||||
WHERE p.`id_manufacturer` = '.(int)$this->id;
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
$context = Context::getContext();
|
||||
$front = true;
|
||||
if (!in_array($context->controller->controller_type, array('front', 'modulefront')))
|
||||
$front = false;
|
||||
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT p.`id_product`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').'
|
||||
)
|
||||
WHERE p.`id_manufacturer` = '.(int)$this->id.
|
||||
($front ? ' AND p.`visibility` IN ("both", "catalog")' : ''));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -454,4 +465,4 @@ class ManufacturerCore extends ObjectModel
|
||||
|
||||
return ($result1 && $result2);
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
-1
@@ -174,8 +174,12 @@ class ProductCore extends ObjectModel
|
||||
/** @var boolean Show price of Product */
|
||||
public $show_price = true;
|
||||
|
||||
/** @var boolean is the product indexed in the search index? */
|
||||
public $indexed = 0;
|
||||
|
||||
/** @var string ENUM('both', 'catalog', 'search', 'none') front office visibility */
|
||||
public $visibility;
|
||||
|
||||
/** @var string Object creation date */
|
||||
public $date_add;
|
||||
|
||||
@@ -260,6 +264,7 @@ class ProductCore extends ObjectModel
|
||||
'ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isEan13', 'size' => 13),
|
||||
'upc' => array('type' => self::TYPE_STRING, 'validate' => 'isUpc', 'size' => 12),
|
||||
'indexed' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'visibility' => array('type' => self::TYPE_STRING, 'validate' => 'isProductVisibility', 'values' => array('both', 'catalog', 'search', 'none'), 'default' => 'both'),
|
||||
'cache_is_pack' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'cache_default_attribute' => array('type' => self::TYPE_INT),
|
||||
'is_virtual' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
@@ -925,6 +930,10 @@ class ProductCore extends ObjectModel
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$front = true;
|
||||
if (!in_array($context->controller->controller_type, array('front', 'modulefront')))
|
||||
$front = false;
|
||||
|
||||
if (!Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way))
|
||||
die (Tools::displayError());
|
||||
if ($order_by == 'id_product' || $order_by == 'price' || $order_by == 'date_add')
|
||||
@@ -955,6 +964,7 @@ class ProductCore extends ObjectModel
|
||||
($id_category ? 'LEFT JOIN `'._DB_PREFIX_.'category_product` c ON (c.`id_product` = p.`id_product`)' : '').'
|
||||
WHERE pl.`id_lang` = '.(int)$id_lang.
|
||||
($id_category ? ' AND c.`id_category` = '.(int)$id_category : '').
|
||||
($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').
|
||||
($only_active ? ' AND p.`active` = 1' : '').'
|
||||
ORDER BY '.(isset($order_by_prefix) ? pSQL($order_by_prefix).'.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).
|
||||
($limit > 0 ? ' LIMIT '.(int)$start.','.(int)$limit : '');
|
||||
@@ -969,11 +979,16 @@ class ProductCore extends ObjectModel
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$front = true;
|
||||
if (!in_array($context->controller->controller_type, array('front', 'modulefront')))
|
||||
$front = false;
|
||||
|
||||
$sql = 'SELECT p.`id_product`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p', false).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.Shop::addSqlRestrictionOnLang('pl').')
|
||||
WHERE pl.`id_lang` = '.(int)$id_lang.'
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
ORDER BY pl.`name`';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
@@ -1775,6 +1790,10 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$front = true;
|
||||
if (!in_array($context->controller->controller_type, array('front', 'modulefront')))
|
||||
$front = false;
|
||||
|
||||
if ($page_number < 0) $page_number = 0;
|
||||
if ($nb_products < 1) $nb_products = 10;
|
||||
@@ -1808,6 +1827,7 @@ class ProductCore extends ObjectModel
|
||||
INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY
|
||||
)
|
||||
) > 0
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -1851,6 +1871,8 @@ class ProductCore extends ObjectModel
|
||||
Product::sqlStock('p', 0, false, null, $sql);
|
||||
|
||||
$sql->where('p.`active` = 1');
|
||||
if ($front)
|
||||
$sql->where('p.`visibility` IN ("both", "catalog")');
|
||||
$sql->where('
|
||||
DATEDIFF(
|
||||
p.`date_add`,
|
||||
@@ -1923,6 +1945,10 @@ class ProductCore extends ObjectModel
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$front = true;
|
||||
if (!in_array($context->controller->controller_type, array('front', 'modulefront')))
|
||||
$front = false;
|
||||
|
||||
$current_date = date('Y-m-d H:i:s');
|
||||
$ids_product = Product::_getProductIdByDate((!$beginning ? $current_date : $beginning), (!$ending ? $current_date : $ending), $context);
|
||||
|
||||
@@ -1965,7 +1991,8 @@ class ProductCore extends ObjectModel
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE p.id_product = '.(int)$id_product;
|
||||
WHERE p.id_product = '.(int)$id_product.'
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '');
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
|
||||
return Product::getProductProperties($id_lang, $row);
|
||||
@@ -2000,6 +2027,10 @@ class ProductCore extends ObjectModel
|
||||
$current_date = date('Y-m-d H:i:s');
|
||||
$ids_product = Product::_getProductIdByDate((!$beginning ? $current_date : $beginning), (!$ending ? $current_date : $ending), $context);
|
||||
|
||||
$front = true;
|
||||
if (!in_array($context->controller->controller_type, array('front', 'modulefront')))
|
||||
$front = false;
|
||||
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
|
||||
@@ -2010,6 +2041,7 @@ class ProductCore extends ObjectModel
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE p.`active` = 1
|
||||
AND p.`show_price` = 1
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
'.((!$beginning && !$ending) ? 'AND p.`id_product` IN('.((is_array($ids_product) && count($ids_product)) ? implode(', ', array_map('intval', $ids_product)) : 0).')' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
@@ -2053,6 +2085,7 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`)
|
||||
WHERE p.`active` = 1
|
||||
AND p.`show_price` = 1
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
'.((!$beginning && !$ending) ? ' AND p.`id_product` IN ('.((is_array($ids_product) && count($ids_product)) ? implode(', ', $ids_product) : 0).')' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
|
||||
+6
-3
@@ -214,6 +214,7 @@ class SearchCore
|
||||
'.Shop::addSqlAssociation('product', 'p', false).'
|
||||
WHERE c.`active` = 1
|
||||
AND p.`active` = 1
|
||||
AND p.`visibility` IN ("both", "search")
|
||||
AND indexed = 1
|
||||
AND cg.`id_group` '.(!$id_customer ? '= 1' : 'IN (
|
||||
SELECT id_group FROM '._DB_PREFIX_.'customer_group
|
||||
@@ -381,7 +382,8 @@ class SearchCore
|
||||
LEFT JOIN '._DB_PREFIX_.'manufacturer m
|
||||
ON m.id_manufacturer = p.id_manufacturer
|
||||
WHERE p.indexed = 0
|
||||
'.($id_product ? 'AND p.id_product = '.(int)$id_product : '').'
|
||||
AND p.visibility IN ("both", "search")
|
||||
'.($id_product ? 'AND p.id_product = '.(int)$id_product : '').'
|
||||
LIMIT '.(int)$limit
|
||||
);
|
||||
}
|
||||
@@ -401,11 +403,12 @@ class SearchCore
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do it even if you already know the product id in order to be sure that it exists
|
||||
// Do it even if you already know the product id in order to be sure that it exists and it needs to be indexed
|
||||
$products = $db->executeS('
|
||||
SELECT id_product
|
||||
FROM '._DB_PREFIX_.'product
|
||||
WHERE '.($id_product ? 'id_product = '.(int)$id_product : 'indexed = 0')
|
||||
WHERE visibility IN ("both", "search")
|
||||
AND '.($id_product ? 'id_product = '.(int)$id_product : 'indexed = 0')
|
||||
);
|
||||
|
||||
$ids = array();
|
||||
|
||||
@@ -193,6 +193,11 @@ class SupplierCore extends ObjectModel
|
||||
public static function getProducts($id_supplier, $id_lang, $p, $n,
|
||||
$order_by = null, $order_way = null, $get_total = false, $active = true, $active_category = true)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$front = true;
|
||||
if (!in_array($context->controller->controller_type, array('front', 'modulefront')))
|
||||
$front = false;
|
||||
|
||||
if ($p < 1) $p = 1;
|
||||
if (empty($order_by) || $order_by == 'position') $order_by = 'name';
|
||||
if (empty($order_way)) $order_way = 'ASC';
|
||||
@@ -213,6 +218,7 @@ class SupplierCore extends ObjectModel
|
||||
WHERE ps.`id_supplier` = '.(int)$id_supplier.'
|
||||
AND ps.id_product_attribute = 0'.
|
||||
($active ? ' AND p.`active` = 1' : '').'
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -271,6 +277,7 @@ class SupplierCore extends ObjectModel
|
||||
'.Product::sqlStock('p').'
|
||||
WHERE ps.`id_supplier` = '.(int)$id_supplier.
|
||||
($active ? ' AND p.`active` = 1' : '').'
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
@@ -294,6 +301,11 @@ class SupplierCore extends ObjectModel
|
||||
|
||||
public function getProductsLite($id_lang)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$front = true;
|
||||
if (!in_array($context->controller->controller_type, array('front', 'modulefront')))
|
||||
$front = false;
|
||||
|
||||
$sql = '
|
||||
SELECT p.`id_product`,
|
||||
pl.`name`
|
||||
@@ -306,6 +318,7 @@ class SupplierCore extends ObjectModel
|
||||
ps.`id_product` = p.`id_product`
|
||||
AND ps.`id_supplier` = '.(int)$this->id.'
|
||||
)
|
||||
'.($front ? ' WHERE p.`visibility` IN ("both", "catalog")' : '').'
|
||||
GROUP BY p.`id_product`';
|
||||
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
@@ -608,6 +608,17 @@ class ValidateCore
|
||||
return preg_match('/^[^!<>;?=+#"°{}_$%]*$/u', $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for product visibility
|
||||
*
|
||||
* @param string $s visibility to check
|
||||
* @return boolean Validity is ok or not
|
||||
*/
|
||||
public static function isProductVisibility($s)
|
||||
{
|
||||
return preg_match('/^both|catalog|search|none$/i', $s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for an integer validity
|
||||
*
|
||||
|
||||
@@ -259,6 +259,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->controller_type = 'admin';
|
||||
$this->controller_name = get_class($this);
|
||||
if (strpos($this->controller_name, 'Controller'))
|
||||
$this->controller_name = substr($this->controller_name, 0, -10);
|
||||
|
||||
@@ -74,6 +74,8 @@ abstract class ControllerCore
|
||||
|
||||
protected $redirect_after = null;
|
||||
|
||||
public $controller_type;
|
||||
|
||||
/**
|
||||
* check that the controller is available for the current user/visitor
|
||||
*/
|
||||
|
||||
@@ -60,6 +60,8 @@ class FrontControllerCore extends Controller
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->controller_type = 'front';
|
||||
|
||||
global $useSSL;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
@@ -34,9 +34,11 @@ abstract class ModuleAdminControllerCore extends AdminController
|
||||
* @var Module
|
||||
*/
|
||||
public $module;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->controller_type = 'moduleadmin';
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$tab = new Tab($this->id);
|
||||
|
||||
@@ -37,6 +37,8 @@ class ModuleFrontControllerCore extends FrontController
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->controller_type = 'modulefront';
|
||||
|
||||
$this->module = Module::getInstanceByName(Tools::getValue('module'));
|
||||
if (!$this->module->active)
|
||||
Tools::redirect('index');
|
||||
|
||||
@@ -440,7 +440,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
Hook::exec('actionProductAdd', array('product' => $product));
|
||||
Search::indexation(false, $product->id);
|
||||
if (in_array($product->visibility, array('both', 'search')))
|
||||
Search::indexation(false, $product->id);
|
||||
$this->redirect_after = self::$currentIndex.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=19&token='.($token ? $token : $this->token);
|
||||
}
|
||||
}
|
||||
@@ -1436,7 +1437,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
Hook::exec('actionProductAdd', array('product' => $this->object));
|
||||
Search::indexation(false, $this->object->id);
|
||||
if (in_array($this->object->visibility, array('both', 'search')))
|
||||
Search::indexation(false, $this->object->id);
|
||||
}
|
||||
|
||||
// If the product is virtual, set out_of_stock = 1 (allow sales when out of stock)
|
||||
@@ -1505,7 +1507,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
$this->_removeTaxFromEcotax();
|
||||
$this->copyFromPost($object, $this->table);
|
||||
|
||||
$object->indexed = 0;
|
||||
|
||||
if ($object->update())
|
||||
{
|
||||
$this->addCarriers();
|
||||
@@ -1529,7 +1532,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
elseif (empty($this->errors))
|
||||
{
|
||||
Hook::exec('actionProductUpdate', array('product' => $object));
|
||||
Search::indexation(false, $object->id);
|
||||
if (in_array($object->visibility, array('both', 'search')))
|
||||
Search::indexation(false, $object->id);
|
||||
|
||||
// Save and preview
|
||||
if (Tools::isSubmit('submitAddProductAndPreview'))
|
||||
|
||||
@@ -1366,6 +1366,7 @@ CREATE TABLE `PREFIX_product` (
|
||||
`condition` ENUM('new', 'used', 'refurbished') NOT NULL DEFAULT 'new',
|
||||
`show_price` tinyint(1) NOT NULL default '1',
|
||||
`indexed` tinyint(1) NOT NULL default '0',
|
||||
`visibility` ENUM('both', 'catalog', 'search', 'none') NOT NULL default 'both',
|
||||
`cache_is_pack` tinyint(1) NOT NULL default '0',
|
||||
`cache_has_attachments` tinyint(1) NOT NULL default '0',
|
||||
`is_virtual` tinyint(1) NOT NULL default '0',
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
SET NAMES 'utf8';
|
||||
|
||||
ALTER TABLE `PREFIX_product` ADD `visibility` ENUM('both', 'catalog', 'search', 'none') NOT NULL default 'both' AFTER `indexed`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user