// fix bug tag image in AdminProductsController

This commit is contained in:
lLefevre
2011-12-14 14:37:28 +00:00
parent 5c2359f257
commit 47c5656dd6
2 changed files with 12 additions and 11 deletions
@@ -484,20 +484,20 @@ var textFieldLabel = 0;
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
changeTagImage(); changeTagImage();
$("#createImageDescription input").change(function(){ $('#createImageDescription input').change(function(){
changeTagImage(); changeTagImage();
}); });
var i = 0; var i = 0;
$(".addImageDescription").click(function(){ $('.addImageDescription').click(function(){
if (i == 0){ if (i == 0){
$("#createImageDescription").animate({ $('#createImageDescription').animate({
opacity: 1, height: "toggle" opacity: 1, height: 'toggle'
}, 500); }, 500);
i = 1; i = 1;
}else{ }else{
$("#createImageDescription").animate({ $('#createImageDescription').animate({
opacity: 0, height: "toggle" opacity: 0, height: 'toggle'
}, 500); }, 500);
i = 0; i = 0;
} }
@@ -505,10 +505,11 @@ var textFieldLabel = 0;
}); });
function changeTagImage(){ function changeTagImage(){
var smallImage = $("input[name=smallImage]:checked").attr("value"); var smallImage = $('input[name=smallImage]:checked').attr('value');
var leftRight = $("input[name=leftRight]:checked").attr("value"); var leftRight = $('input[name=leftRight]:checked').attr('value');
var imageTypes = $("input[name=imageTypes]:checked").attr("value"); var imageTypes = $('input[name=imageTypes]:checked').attr('value');
$("#resultImage").val("{img-"+smallImage+"-"+leftRight+"-"+imageTypes+"}"); var tag = '[img-'+smallImage+'-'+leftRight+'-'+imageTypes+']';
$('#resultImage').val(tag);
} }
</script> </script>
{/if} {/if}
+1 -1
View File
@@ -440,7 +440,7 @@ class ProductControllerCore extends FrontController
public function transformDescriptionWithImg($desc) public function transformDescriptionWithImg($desc)
{ {
$reg = '/{img-([0-9]+)-(left|right)-([a-z]+)}/'; $reg = '/\[img-([0-9]+)-(left|right)-([a-z]+)\]/';
while (preg_match($reg, $desc, $matches)) while (preg_match($reg, $desc, $matches))
{ {
$link_lmg = $this->context->link->getImageLink($this->product->link_rewrite, $this->product->id.'-'.$matches[1], $matches[3]); $link_lmg = $this->context->link->getImageLink($this->product->link_rewrite, $this->product->id.'-'.$matches[1], $matches[3]);