Merge pull request #1072 from PhpMadman/Boot-AutoSeoUrl

[*] BO : Option to always rewrite friendly url of product
This commit is contained in:
Lucas CERDAN
2013-12-03 06:15:28 -08:00
4 changed files with 18 additions and 3 deletions
@@ -93,6 +93,14 @@ class AdminPPreferencesControllerCore extends AdminController
0 => $this->l('Products:'),
1 => $this->l('Combinations')
)
),
'PS_FORCE_FRIENDLY_PRODUCT' => array(
'title' => $this->l('Force update of friendly url'),
'hint' => $this->l('When active, friendly url will be updated on every save'),
'validation' => 'isBool',
'cast' => 'intval',
'required' => false,
'type' => 'bool'
)
),
),
@@ -2577,6 +2577,8 @@ class AdminProductsControllerCore extends AdminController
$this->tpl_form_vars['post_data'] = Tools::jsonEncode($_POST);
$this->tpl_form_vars['save_error'] = !empty($this->errors);
$this->tpl_form_vars['ps_force_friendly_product'] = Configuration::get('PS_FORCE_FRIENDLY_PRODUCT');
// autoload rich text editor (tiny mce)
$this->tpl_form_vars['tinymce'] = true;
$iso = $this->context->language->iso_code;
@@ -3576,7 +3578,7 @@ class AdminProductsControllerCore extends AdminController
$product->$prop = $this->getFieldValue($product, $prop);
$product->name['class'] = 'updateCurrentText';
if (!$product->id)
if (!$product->id || Configuration::get('PS_FORCE_FRIENDLY_PRODUCT'))
$product->name['class'] .= ' copy2friendlyUrl';
$images = Image::getImages($this->context->language->id, $product->id);