// fix product live preview and duplication
This commit is contained in:
1 parent
472fbc4628
commit
d529b8a9ed
6 files changed
+11
-12
No files matched your search
+3
-3
@@ -432,9 +432,9 @@ if (Tools::getValue('submitPublishProduct'))
|
||||
if (Tools::getIsset('id_product'))
|
||||
{
|
||||
$id_product = (int)(Tools::getValue('id_product'));
|
||||
$id_tab_catalog = (int)(Tab::getIdFromClassName('AdminCatalog'));
|
||||
$token = Tools::getAdminToken('AdminCatalog'.(int)($id_tab_catalog).(int)$context->employee->id);
|
||||
$bo_product_url = dirname($_SERVER['PHP_SELF']).'/index.php?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.$token;
|
||||
$id_tab_catalog = (int)(Tab::getIdFromClassName('AdminProducts'));
|
||||
$token = Tools::getAdminToken('AdminProducts'.(int)($id_tab_catalog).(int)$context->employee->id);
|
||||
$bo_product_url = dirname($_SERVER['PHP_SELF']).'/index.php?tab=AdminProducts&id_product='.$id_product.'&updateproduct&token='.$token;
|
||||
|
||||
if (Tools::getValue('redirect'))
|
||||
die($bo_product_url);
|
||||
|
||||
@@ -268,7 +268,7 @@ $(document).ready(function(){
|
||||
<div class="warn draft" >
|
||||
<p>
|
||||
<span style="float: left">
|
||||
<img src="../img/admin/warn2.png" />{l s='Your product will be saved as draft'}</span>
|
||||
{l s='Your product will be saved as draft'}</span>
|
||||
<span style="float:right"><a href="#" class="button" style="display: block" onclick="submitAddProductAndPreview()" >{l s='Save and preview'}</a></span>
|
||||
<input type="hidden" name="fakeSubmitAddProductAndPreview" id="fakeSubmitAddProductAndPreview" />
|
||||
<br />
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
{l s='Enabled'}</label>
|
||||
<br class="clear" />
|
||||
<input style="float:left;" 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="t"><img src="../img/admin/disabled.gif" alt="{l s='Disabled'}" title="{l s='Disabled'}" style="float:left; padding:0px 5px 0px 5px" />{l s='Disabled'} {if !$product->active} (<a href="{$preview_url}" alt="" target="_blank">{l s='View product in shop'}</a>){/if}</label>
|
||||
<label for="active_off" class="t"><img src="../img/admin/disabled.gif" alt="{l s='Disabled'}" title="{l s='Disabled'}" style="float:left; padding:0px 5px 0px 5px" />{l s='Disabled'} </label>
|
||||
</td>
|
||||
</tr>
|
||||
{if $feature_shop_active}
|
||||
|
||||
@@ -1288,13 +1288,15 @@ class AdminProductsControllerCore extends AdminController
|
||||
$preview_url .= 'adtoken='.$token.'&ad='.$admin_dir;
|
||||
}
|
||||
$this->redirect_after = $preview_url;
|
||||
} else if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') || ($id_image && $id_image !== true)) // Save and stay on same form
|
||||
// Save and stay on same form
|
||||
}
|
||||
else if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') || ($id_image && $id_image !== true)) // Save and stay on same form
|
||||
{// Save and stay on same form
|
||||
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
|
||||
$this->redirect_after = self::$currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&addproduct&conf=4&tabs='.(int)(Tools::getValue('tabs')).'&token='.($token ? $token : $this->token);
|
||||
|
||||
// Default behavior (save and back)
|
||||
$this->redirect_after = self::$currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=4&token='.($token ? $token : $this->token);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1595,8 +1597,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (empty($this->action))
|
||||
$this->action = 'Informations';
|
||||
|
||||
|
||||
|
||||
if(method_exists($this, 'initForm'.$this->action))
|
||||
$this->tpl_form = 'products/'.strtolower($this->action).'.tpl';
|
||||
|
||||
@@ -1779,7 +1779,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
$content = '<div class="warn draft" style="'.($active ? 'display:none' : '').'">
|
||||
<p>
|
||||
<span style="float: left">
|
||||
<img src="../img/admin/warn2.png" />
|
||||
'.$this->l('Your product will be saved as draft').'
|
||||
</span>
|
||||
<span style="float:right"><a href="#" class="button" style="display: block" onclick="submitAddProductAndPreview()" >'.$this->l('Save and preview').'</a></span>
|
||||
|
||||
@@ -87,7 +87,7 @@ class ProductControllerCore extends FrontController
|
||||
*/
|
||||
if (!$this->product->isAssociatedToShop()
|
||||
|| ((!$this->product->active && ((Tools::getValue('adtoken') != Tools::encrypt('PreviewProduct'.$this->product->id))
|
||||
|| !file_exists(dirname(__FILE__).'/../'.Tools::getValue('ad').'/ajax.php')))))
|
||||
|| !file_exists(_PS_ROOT_DIR_.'/'.Tools::getValue('ad').'/ajax.php')))))
|
||||
{
|
||||
header('HTTP/1.1 404 page not found');
|
||||
$this->errors[] = Tools::displayError('Product is no longer available.');
|
||||
|
||||
+1
-1
@@ -865,7 +865,7 @@ function showOptions(show)
|
||||
function submitAddProductAndPreview()
|
||||
{
|
||||
$('#fakeSubmitAddProductAndPreview').attr('name','submitAddProductAndPreview');
|
||||
$('#product').submit();
|
||||
$('#product_form').submit();
|
||||
}
|
||||
|
||||
function submitAddcmsAndPreview()
|
||||
|
||||
Reference in new issue
Block a user