diff --git a/admin-dev/themes/template/products/content.tpl b/admin-dev/themes/template/products/content.tpl deleted file mode 100644 index 53a44db3f..000000000 --- a/admin-dev/themes/template/products/content.tpl +++ /dev/null @@ -1,270 +0,0 @@ -{* -* 2007-2011 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision$ -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - - - - - - - -
-{if isset($product_tabs)} -
- - - {if isset($product)} -
-

{l s='Current product:'} 

-
- {/if} -
-
-
    - {foreach $product_tabs key=numStep item=tab} -
  • - {$tab.name}{*todo href when nojs*} -
  • - {/foreach} -
-
- -{***********************************************} -{********** TO CHECK !!!!!!!!!!!!!!! ***********} - - -
-{$draft_warning} - - -
- - {if !$newproduct} - {foreach $product_tabs key=numStep item=tab} -
-{if $tab.selected}{$content}{/if} -
- {/foreach} - {else}{* @todo : this is a temporary fix*} -
{$content}
- {/if} -
- -
-
-
-{l s='Back to list'}
-{else} -{$content} -{/if} - diff --git a/admin-dev/themes/template/products/features.tpl b/admin-dev/themes/template/products/features.tpl new file mode 100644 index 000000000..7ef1e033b --- /dev/null +++ b/admin-dev/themes/template/products/features.tpl @@ -0,0 +1,75 @@ + + + + +
+ {l s='Assign features to this product:'}
+
    +
  • {l s='You can specify a value for each relevant feature regarding this product, empty fields will not be displayed.'}
  • +
  • {l s='You can either set a specific value, or select among existing pre-defined values you added previously.'}
  • +
+
+

+ + + + + +
{l s='Feature'} + {l s='Pre-defined value'} + {l s='or'} {l s='Customized value'} +
+{foreach from=$available_features item=available_feature} + + + + + + + +{foreachelse} + +{/foreach} + + + + +
{$available_feature.name} + {if sizeof($available_feature.featureValues)} + + {else} + + {l s='N/A'} - + {l s='Add pre-defined values first'} + + {/if} + + {foreach from=$languages item=language} +
+ +
+ {/foreach} +
{l s='No features defined'}
+ +
+
+
+ + new_features {l s='Add a new feature'} + +
+ + diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 667c84d59..0179a97ae 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1837,7 +1837,7 @@ if (false) $token = Tools::encrypt('PreviewProduct'.$product->id); if (strpos($preview_url, '?') === false) $preview_url .= '?'; - $preview_url = ($this->context->link->getProductLink($this->getFieldValue($product, 'id'), $this->getFieldValue($product, 'link_rewrite', $this->_defaultFormLanguage), Category::getLinkRewrite($this->getFieldValue($product, 'id_category_default'), $this->context->language->id))); + $preview_url = ($this->context->link->getProductLink($this->getFieldValue($product, 'id'), $this->getFieldValue($product, 'link_rewrite', $this->default_form_language), Category::getLinkRewrite($this->getFieldValue($product, 'id_category_default'), $this->context->language->id))); if (!$product->active) { $admin_dir = dirname($_SERVER['PHP_SELF']); @@ -3161,119 +3161,43 @@ if (false) { if (!Feature::isFeatureActive()) { - $this->tpl_form_vars['custom_form'] = ''; $this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' '.$this->l('Performances').''); return; } - $content = ''; - + $data = $this->context->smarty->createData(); if ($obj->id) { - $feature = Feature::getFeatures($this->context->language->id); - $ctab = ''; - foreach ($feature as $tab) - $ctab .= 'ccustom_'.$tab['id_feature'].'¤'; - $ctab = rtrim($ctab, '¤'); + $features = Feature::getFeatures($this->context->language->id); - $content .= ' - - - - -
- '.$this->l('Assign features to this product:').'
-
    -
  • '.$this->l('You can specify a value for each relevant feature regarding this product, empty fields will not be displayed.').'
  • -
  • '.$this->l('You can either set a specific value, or select among existing pre-defined values you added previously.').'
  • -
-
-

'; - // Header - $nb_feature = Feature::nbFeatures($this->context->language->id); - $content .= ' - - - '; - if (!$nb_feature) - $content .= ''; - $content .= '
'.$this->l('Feature').' - '.$this->l('Pre-defined value').' - '.$this->l('or').' '.$this->l('Customized value').' -
'.$this->l('No features defined').'
'; - - // Listing - if ($nb_feature) + foreach ($features as $k => $tab_features) { - $content .= ' - '; + $features[$k]['current_item'] = false; + $features[$k]['val'] = array(); - foreach ($feature as $tab_features) - { - $current_item = false; - $custom = true; - foreach ($obj->getFeatures() as $tab_products) - if ($tab_products['id_feature'] == $tab_features['id_feature']) - $current_item = $tab_products['id_feature_value']; + $custom = true; + foreach ($this->object->getFeatures() as $tab_products) + if ($tab_products['id_feature'] == $tab_features['id_feature']) + $features[$k]['current_item'] = $tab_products['id_feature_value']; - $featureValues = FeatureValue::getFeatureValuesWithLang($this->context->language->id, (int)$tab_features['id_feature']); + $features[$k]['featureValues'] = FeatureValue::getFeatureValuesWithLang($this->context->language->id, (int)$tab_features['id_feature']); + if (sizeof($features[$k]['featureValues'])) + foreach ($features[$k]['featureValues'] as $value) + if ($features[$k]['current_item'] == $value['id_feature_value']) + $custom = false; - $content .= ' - - - - - '; - } - $content .= ' - - - '; + if($custom) + $features[$k]['val'] = FeatureValue::getFeatureValueLang($features[$k]['current_item']); } - $content .= '
'.$tab_features['name'].''; - - if (sizeof($featureValues)) - { - $content .= ' - '; - } - else - $content .= ''.$this->l('N/A').' - '.$this->l('Add pre-defined values first').''; - - $content .= ' - '; - $tab_customs = ($custom ? FeatureValue::getFeatureValueLang($current_item) : array()); - foreach ($this->_languages as $language) - $content .= ' -
- -
'; - $content .= ' -
-
-
- new_features '.$this->l('Add a new feature').' -
'; } - else - $content .= ''.$this->l('You must save this product before adding features').'.'; - $content .= ''; - $this->tpl_form_vars['custom_form'] = $content; + $data->assign('available_features', $features); + + $data->assign('product', $obj); + $data->assign('link', $this->context->link); + $data->assign('languages', $this->_languages); + $data->assign('default_form_language', $this->default_form_language); + $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch(); } public function ajaxProcessProductQuantity()