ancimage.phtml
5.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
/**
*
* @var $this anc_image/catalog_product_view_options_type_ancimage
*
* @package anc_image
* @anc_image_eingabetyp -- Formular bzw ansicht im Frontend im Warenkorb beim Produkt konfigurieren
* @copy Grundlage: Magento18/app/design/frontend/base/default/template/catalog/product/view/options/type/text.phtml
* @since 20140416
* @author netz.coop eG*
*/
?>
<?php
/**
* @cache problem
*/
Mage::app()->cleanCache();
?>
<?php $DropzoneIndex = Mage::helper('anc_lib/data')->getElementIndexForId(); ?>
<?php $dropzone_id = 'ancimage-dropzone-id'.$DropzoneIndex; ?>
<?php $ancnote_id = 'ancnote-id'; ?>
<?php $_option = $this->getOption(); ?>
<?php $input_id = 'options_'.$_option->getId().'_text'; ?>
<div class="ancimage-ancimage anc-productview">
<script type="text/javascript">
function loadNcImageIntoProductGalleryThumbnailButton() {
jQuery('.anc_image_choose').unbind("click").click(function(e){
e.preventDefault();
Anc_Image_Type.loadImageInto(
jQuery(this).data('anc_image_id'),
jQuery('#<?php echo $input_id; ?>'),
jQuery(this).data('anc_image_url'),
jQuery('#<?php echo $dropzone_id; ?>')
);
});
}
</script>
<div class="ancimage_type anc-productview-type" id="<?php echo $_option->getSku(); ?>">
<div class="ancimage_type-fakewrapper anc-productview-type-fakewrapper">
<div id="<?php echo $ancnote_id; ?>"></div>
<input type="hidden" onchange="opConfig.reloadPrice()" id="<?php echo $input_id ?>" class="input-text<?php echo $_option->getIsRequire() ? ' required-entry' : '' ?> <?php echo $_option->getMaxCharacters() ? ' validate-length maximum-length-'.$_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?php echo $_option->getId() ?>]" value="<?php echo $this->escapeHtml($this->getDefaultValue()) ?>" />
<div class="ancimage-info">
<div class="editor"></div>
<div class="image"></div>
</div>
<div class="<?php echo $_option->getSku(); ?>" id="ancimage-imageeditorarea-id">
<div id="<?php echo $dropzone_id; ?>"
class="dropzone ancimage-dropzone"
title=""
data-pxwidth="<?php echo $_option->getImageSizeX() ?>"
data-pxheight="<?php echo $_option->getImageSizeY() ?>"
data-maxfilesizemb="<?php echo $_option->getMaxCharacters() ?>"
>
<?php $path = Mage::helper('anc_image/ncimage')->getNcImagePath($this->getDefaultValue(), 'relative', 'original'); ?>
<?php // $Currentpageinfos = Mage::helper('anc_lib/data')->getCurrentcheckoutcartinfos(); ?>
<?php $ItemInfos= Mage::helper('anc_lib/data')->getCheckoutCartItemInfos(); ?>
<?php $Cropdata = Mage::helper('anc_image/ncimage')->getCropdata($ItemInfos['item_id']); ?>
<div class="preview-database-image"
data-imagesrc="<?php echo DS.$path; ?>"
<?php if(is_array($Cropdata)): ?>
data-cropH="<?php echo $Cropdata['cropH']; ?>"
data-cropW="<?php echo $Cropdata['cropW']; ?>"
data-imgH="<?php echo $Cropdata['imgH']; ?>"
data-imgW="<?php echo $Cropdata['imgW']; ?>"
data-imgInitH="<?php echo $Cropdata['imgInitH']; ?>"
data-imgInitW="<?php echo $Cropdata['imgInitW']; ?>"
data-imgX1="<?php echo $Cropdata['imgX1']; ?>"
data-imgY1="<?php echo $Cropdata['imgY1']; ?>"
<?php endif; ?>
>
<?php // if($path):?>
<!--<img src="<?php // echo $path; ?>" />-->
<?php // endif; ?>
</div>
</div>
</div>
</div>
</div>
<!-- Gallerien zum auswählen -->
<?php $gallerie_dropzone_id = 'ancimage-dropzone-id'.Mage::helper('anc_lib/data')->getElementIndexForId(); ?>
<div class="ancimage_type-possibility anc-productview-possibility">
<?php echo $this->getLayout()
->getBlockSingleton('anc_image/galleriesmanager')
->setTemplate('anc/image/customer_galleries.phtml')
->setIfGalleryCategory(true)
->setSelectorIdDropzoneOwn($gallerie_dropzone_id)
->toHtml(); ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
// damit initialen laden der Gallerie auch die Thumbnail-Bilder-Button funktionieren
loadNcImageIntoProductGalleryThumbnailButton();
});
</script>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
var dropzone_params = {
url: "<?php echo $this->getUrl('ancimage/customer/uploadImage', array()) ?>",
dictDefaultMessage: 'Bild hochladen',
success: function() { this.removeAllFiles(); }
}
var gallery_ajaxData = {
url: "<?php echo $this->getUrl('ancimage/customer/gallerysimple', array()) ?> ul.gallery",
context: jQuery(".ancimage-customer_galleriesown > .ancimage-gallerie-content > .ancimage-gallerie-content-view"),
success: function(reponse) {
// damit das hochgeladene Bild auch in der dropbopx angezeigt wird
Anc_Image_Type.loadImageInto(
reponse.id,
// jQuery('#<?php // echo $_option->getSku(); ?> > dd > .input-box > input'),
jQuery('#<?php echo $input_id; ?>'),
'<?php echo DS; ?>'+reponse.path,
jQuery('#<?php echo $dropzone_id; ?>')
);
// damit nach hochladen eines bildes und darauf folgende reloaden der gallerie,
// die (anderen) galleriebilder wieder in die dropbox geladen werden können
loadNcImageIntoProductGalleryThumbnailButton();
},
};
Anc_Image_Type.droppableFile(
jQuery(" #<?php echo $gallerie_dropzone_id; ?>"),
dropzone_params,
jQuery(" #<?php echo $input_id; ?>"),
jQuery(" #<?php echo $ancnote_id; ?>"),
gallery_ajaxData,
false
);
});
</script>
</div>