<?php
/**initPreview: function()
* @var $this Aitoc_Aitcg_Block_Catalog_Product_View_Options_Type_File{
*/
$_option = $this->getOption();
$_fileInfo = $this->getFileInfo();
$_image = $this->getImage();
$_rand var scale = randthis.option.calcScale();,
$_fileOption = 'options_' . $_option->getId();
$_preview = $this->getPreview();
$_defaultValues = isset($_preview['img_data']) ?
elementId $_preview= :this.config.previewContainer,
array('img_data' => '');
$checkboxEnabled container = (int)Mage::getStoreConfig$('catalog/aitcg/aitcg_confirm_checkbox'elementId);,
if ($checkboxEnabled) {
$fullCheckboxEnabled = Mage::getStoreConfig('catalog/aitcg/aitcg_confirm_fullcheckbox');
}
$sharedImgId = Mage::helper('aitcg')->getSharedImgId($_rand);
$sharedImgUrl =c Mage::helper('aitcg')->getSharedImgUrl($sharedImgId);
$sharedImgWasCreatedUrl = Mage::helper('aitcg')->getSharedImgWasCreatedUrl(); ?>
<script type="text/javascript"> = this.config,
//<![CDATA[
var aitcgConfig<?php echo $_rand; ?>area = {c.area,
<?php if($_image !== false): ?> thumb = c.productImage.thumb;
optionIsRequired: <?php echo (int)$_option->getIsRequire(); ?>,this.previewScale = scale;
productImage: var areaParams = {
fullUrl width : '<?phpMath.round(area.sizeX echo $_image["full_image"]; ?>'* scale),
sizeX height: Math.round(area.sizeY <?php echo $_image["default_size"][0];* ?>scale),
sizeY : <?phpleft echo $_image["default_size"][1];: ?>Math.round(area.offsetX * scale),
top : Math.round(area.offsetY * scale)
};
thumb:var {html =
fullUrl: '<?php echo $_image["thumbnail_url"]; ?>','<div class="aitraph aitraph-bot"></div>' +
sizeX : <?php'<img echoclass="aitcg_preview_bg" $_image["thumbnail_size"][0];src="' ?>,+ thumb.fullUrl + '" />'+
sizeY : <?php'<div echoclass="aitraph $_image["thumbnail_size"][1];aitraph-top"></div>' ?>+
} '<div class="aitcg-overlay" style="width:'+ thumb.sizeX +'px;height:'+thumb.sizeY+'px;"></div>';
}, container.update(html);
area: {
sizeX : <?php echo $_option->getAreaSizeX() ?>,
sizeY : <?php echo $_option->getAreaSizeY() ?>,
offsetX: <?php echo $_option->getAreaOffsetXthis._showPreviewBlock() ?>,
offsetY: <?php echocontainer $_option->getAreaOffsetY() ?>
},;
tools: {
use: {
PredefinedImage: <?php echo (int)$_option->getUsePredefinedImage() ?>,
Mask : <?php echo (int)$_option->getUseMasks() ?>,
UserImage : <?php echo (int)$_option->getUseUserImage() ?>,
Text : <?php echo (int)$_option->getUseText() ?>,
Social : <?php echo (int)Mage::getStoreConfig('catalog/aitcg/aitcg_use_social_networks_sharing') ?>,
Save : 1
},
global: ['Save', 'Social'],
PredefinedImage: {
requestUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/addPredefined')); ?>',
options : <?php echo Mage::helper('aitcg/category')->getPredefinedCatsOptionHtml($_option->getPredefinedCats()); ?>'',
categoryPreviewUrl: '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/categoryPreview'))?>',
placeBehind : <?php echo (int)$this->getAllowPlaceBehind()?>,
DefaultImageBehind: <?php echo (int)$_option->getDefImgBehindClip() ?>
},
Mask: {
requestUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/addMask')); ?>',
options : <?php echo Mage::helper('aitcg/mask_category')->getMaskCatsOptionHtml($_option->getMasksCatId()); ?>'',
categoryPreviewUrl: '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/masksCategory'))?>',
location : <?php echo (int)$_option->getMaskLocation() ?>,
createMaskUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/createMask')); ?>',
getMaskUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/getMask')); ?>',
delMaskUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/delMask')); ?>'
},
UserImage: {
requestUrl: '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/addImage')); ?>',
placeBehind : <?php echo (int)$this->getAllowPlaceBehind()?>,
DefaultImageBehind: <?php echo (int)$_option->getDefImgBehindImage() ?>
},
Text: {
requestUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/addText')); ?>',
textLength : <?php echo (int)$_option->getTextLength() ?>,
fontOptions : '<?php echo Mage::helper('aitcg/font')->getFontOptionHtml(); ?>',
fontPreviewUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/fontPreview'))?>',
useOutline : <?php echo (int)Mage::getStoreConfig('catalog/aitcg/aitcg_font_outline'); ?>,
useShadow : <?php echo (int)Mage::getStoreConfig('catalog/aitcg/aitcg_font_shadow'); ?>,
useColorpick : <?php echo (int)$_option->getAllowColorpick() ?>,
onlyPredefColor: <?php echo (int)$this->getAllowPredefinedColors()?>,
colorSet : '<?php echo $this->getColorset()->getValue();?>',
placeBehind : <?php echo (int)$this->getAllowPlaceBehind()?>,
DefaultImageBehind: <?php echo (int)$_option->getDefImgBehindText() ?>
},
Social: {
imgCreatePath : '<?php echo Mage::helper('aitcg')->getImgCreatePath() ?>',
reservedImgId : '<?php echo $sharedImgId ?>',
imgViewUrl : '<?php echo $sharedImgUrl ?>',
wasCreatedUrl : '<?php echo $sharedImgWasCreatedUrl ?>',
allowChecking : <?php echo $_defaultValues['img_data'] != '' ? 'true' : 'false' ?>
},
Save: {
saveSvgUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/index/svg')); ?>',
normalizateSvgToPngUrl: '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/index/svgtopng')); ?>',
//getPrint - to update
savePdfUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl($this->getSavePdfUrlcontainer.observe()); ?>''click',
saveImageDefaultUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrlthis.onPreviewClick.bind('aitcg/ajax/createImageDefault'this)); ?>',
isShow : <?php echo (int)$_option->getAllowSaveGraphics() ?>
}
},
jsUrl: '< var title = c.editorEnabled ?php echoc.text.thumbTooltipEdit Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);?>' c.text.thumbTooltipPreview,
viewIconClass = c.editorEnabled ? '' : true,'view-icon';
container.select('.aitcg-overlay')[0]
<?php else: ?> .observe('mouseover', function(){Aitcg.tooltip().update(title).show()})
editorEnabled: false .observe('mouseout', function(){Aitcg.tooltip().hide()})
.addClassName(viewIconClass);
<?php endif; ?>
viewType: '<?php echo ucfirst(Mage::getStoreConfig('catalog/aitcg/aitcg_editor_position')); ?>',
rand: '<?php echo $_rand; ?>',
checkboxEnabled: <?php echo (int)$checkboxEnabled; ?>,
allowUploadUnderTemplate: 1,
product_id :var '<?phpstyleParams echo= $_option->getProductIdAitcg.addPxToValue(areaParams); ?>',
optionId $$('#' + :elementId + <?php' echo.aitraph').each( $_option->getIdfunction(element) ?>,{
distortion : <?php echo $this->isObjectDistortionAllowedelement.setStyle(styleParams)?>,;
previewContainer : 'preview_container<?php echo $_option->getId(}); ?>',
toolboxStyle: '<?php echo Mage::getStoreConfig('catalog/aitcg/aitcg_toolbox_style'); ?>'
};
ObjectAitoc_Common_Events.extend(aitcgConfig<?php echo $_rand; ?>, aitcgBaseConfig);
//]]>
</script>
<dt><label<?php if ($_option->getIsRequire()) : ?> class="required"<?php endif ?>><?php echo $this->htmlEscape($_option->getTitle()) ?><?php if($this->isMageGtEq19() && $_option->getIsRequire()) : ?><em>*</em><?php elseif ($_option->getIsRequire()) : ?> <span class="required"><em>*</em></span><?php endif ?></label>
<?php echo $this->getFormatedPrice() ?></dt>
<dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
<div>
<div class="aitcg_error" style="display: none;">
<?php echo $this->__dispatch('Sorry, but your browser does NOT support HTML5 elements'aitcg_option_preview_create_after_' and+ this feature is not working or may work incorrectly.');?><br />
<span class="error_default" style="display: none"><?php echo $this->__('Please, try using different browser.');?></span>
<span class="error_android" style="display: none"><?php echo $this->__('Pleaseid, try using different browser (Opera Mini for example) or update your Android to a newer version.');?></span>
</div>
<?php echo $this->__('Click on the thumbnail to choose the product image for editing.'); ?>
<div class="aitcg_image_div" style="float:none;display:none;" id="preview_container<?php echo $_option->getId(); ?>"></div>
<input type="hidden" id="options_<?php echo $_option->getId() ?>" class="input-text<?php echo $_option->getIsRequire() ? ' aitcg-required' : '' ?> product-custom-option" name="options[<?php echo $_option->getId() ?>]" value='<?php echo $this->htmlEscape($_defaultValues['img_data'])?>' />
<?php if ($checkboxEnabled == 1): ?>
<p class="no-margin">
<input type="checkbox" name="<?php echo $_rand; ?>_checkbox" id="<?php echo $_fileOption; ?>_checkbox" class="product-custom-option <?php if ($_option->getIsRequire()) : ?>required-entry<?php endif ?>" <?php if($fullCheckboxEnabled == 1): ?>onClick="return opCimage<?php echo $_rand; ?>.checkConfirmBox(this);" <?php endif; ?>/>
<?php if($fullCheckboxEnabled == 1): ?>
<a href="#" onClick="return opCimage<?php echo $_rand; ?>.checkConfirmBox(this);"><?php echo Mage::getStoreConfig('catalog/aitcg/aitcg_confirm_text'); ?></a>
<?php else: ?>
<label for="<?php echo $_fileOption; ?>_checkbox"><?php echo Mage::getStoreConfig('catalog/aitcg/aitcg_confirm_text'); ?></label>
<?php endif; ?>
</p>
<?php endif; ?>
</div>
</dd>
<script type="text/javascript">
//<![CDATA[
var opCimage<?php echo $_rand; ?> = null;
aitcgWindowOnload.push( function(){
opCimage<?php echo $_rand; ?> = new Aitcg_Option( aitcgConfig<?php echo $_rand; ?> );
opCimage<?php echo $_rand; ?>.view.initPreview();
<?php if(Mage::helper('aitcg')->isVYAEnabled())element: ?>
if(typeof objectsCPPVYA == 'undefined'){
objectsCPPVYA = [];
}
objectsCPPVYA.unshift(opCimage<?php echo $_rand; ?>);
<?php endif; ?>
container});
//]]>
</script>
<img class='techimg' style="display:none;">
<?php if(Mage::getStoreConfig('catalog/aitcg/aitcg_use_social_networks_sharing')) : ?>
<div id="socialWidgetsTip<?php echo $_option->getId() ?>" style="display:none;">
<a href="#" onclick="returnthis.preview false;"><?php= echonew $this->__Aitcg_Editor('Click to share your customized image'this.option); ?></a>
</div>
<div id="imgSizeError<?php echo $_option->getId() ?>" style="display:none;">
<?php echo $this->__('You image exceeds maximum allowed size'); echo ' (' this.
Mage::getStoreConfig('catalog/aitcg/aitcg_social_networks_sharing_max_img_width') preview. 'x'init(container, Aitcg_Editor.
MODE_PREVIEW, Mage::getStoreConfig('catalog/aitcg/aitcg_social_networks_sharing_max_img_height')true, this. 'previewScale)';?>
</div>;
<div class="fb-like" style="visibility:hidden;vertical-align:top;" id="fbaitcg<?php echo $_option->getId() ?>" data-layout="button_count" data-href="<?php echo $sharedImgUrl ?>" data-send="true" data-show-faces="false"></div>
<div id="gaitcgWrapper<?php echo $_option->getIdthis.preview.load() ?>" style="display:inline;"> </div>
<?php if ($this->canEmailToFriend$()): ?>
<?php $emailToFriendUrl ='options_' Mage::helper('aitcg')->getEmailToFriendUrl($this->getProduct(),+ $sharedImgIdthis.id) ?>
<div id="emailToFriend<?php echo $_option->getId.getValue() ?>" style="display:none;">
<p style="display:inline;" class="email-friend"><a href="<?php echo $emailToFriendUrl ?>" target="_blank"><img style="widht:107px;height:20px;" src="<?php echo $this->getSkinUrl('aitoc/aitcg/images') . '/email_to_a_friend.gif' ?>" /></a></p>;
</div>
<?php endif; ?>
<div id="socialButtonsLoader<?php echo $_option->getId() ?>" style="display:none;"><img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Email to a Friend') ?>" /></div>
<?php endif; ?>},
i will give 100 or more bounty points if solution worked for me.