diff options
| -rw-r--r-- | views/mods/mod_productvariants/admin_edit.phtml | 2 | ||||
| -rw-r--r-- | views/mods/mod_productvariants/admin_html.phtml | 3 | ||||
| -rw-r--r-- | views/mods/mod_productvariants/produkt.phtml | 54 | ||||
| -rw-r--r-- | views/produkttemplates/standard.phtml | 24 | ||||
| -rw-r--r-- | views/warenkorb/basket.phtml | 31 | ||||
| -rw-r--r-- | views/warenkorb/overview.phtml | 29 |
6 files changed, 54 insertions, 89 deletions
diff --git a/views/mods/mod_productvariants/admin_edit.phtml b/views/mods/mod_productvariants/admin_edit.phtml index 987e076..0ee21dc 100644 --- a/views/mods/mod_productvariants/admin_edit.phtml +++ b/views/mods/mod_productvariants/admin_edit.phtml @@ -163,7 +163,7 @@ <?php if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) { ?>
<td class="col_action">
- <a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Variation löschen', 'wpsg'); ?>" onclick="return wpsg_mod_productvariation_del(<?php echo $vari['id']; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
+ <a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Variation löschen', 'wpsg'); ?>" onclick="return wpsg_mod_productvariation_del(<?php echo $this->view['product_id'].','.$vari['id']; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
</td>
<?php } ?>
diff --git a/views/mods/mod_productvariants/admin_html.phtml b/views/mods/mod_productvariants/admin_html.phtml index ca08ab2..7fc6fe6 100644 --- a/views/mods/mod_productvariants/admin_html.phtml +++ b/views/mods/mod_productvariants/admin_html.phtml @@ -73,7 +73,7 @@ } // function wpsg_mod_productvariants_del(variant_id)
- function wpsg_mod_productvariation_del(variation_id)
+ function wpsg_mod_productvariation_del(product_id, variation_id)
{
if (!confirm('<?php echo __('Sind Sie sich sicher, dass Sie die Variation löschen möchten?', 'wpsg'); ?>')) return false;
@@ -87,6 +87,7 @@ url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&noheader=1',
data: {
'subaction': 'admin_variation_del',
+ 'product_id': product_id,
'variation_id': variation_id,
'variant_id': vari_id
},
diff --git a/views/mods/mod_productvariants/produkt.phtml b/views/mods/mod_productvariants/produkt.phtml index bf8ddbd..4c7ace3 100644 --- a/views/mods/mod_productvariants/produkt.phtml +++ b/views/mods/mod_productvariants/produkt.phtml @@ -13,7 +13,7 @@ <div class="wpsg_vp_field wpsg_vp_field_<?php echo $this->getProduktId($this->view['data']['id']); ?>">
- <?php if ($var['typ'] != 'radio') { ?>
+ <?php if ($var['type'] != wpsg_mod_productvariants::TYPE_RADIO) { ?>
<label class="wpsg_vp_field_label" for="wpsg_vpfield_<?php echo $this->getProduktId($this->view['data']['id']); ?>_<?php echo $k; ?>">
<?php echo $var['name']; ?>
</label>
@@ -21,7 +21,7 @@ <span class="wpsg_vp_field"><?php echo $var['name']; ?></span>
<?php } ?>
- <div class="wpsg_vp_field_typ_<?php echo $var['typ']; ?>">
+ <div class="wpsg_vp_field_typ_<?php echo $var['type']; ?>">
<?php /* SELECT-Box START */ ?>
<?php if ($var['type'] == wpsg_mod_productvariants::TYPE_SELECT) { ?>
@@ -62,22 +62,21 @@ <?php } ?>
<?php } ?>
</select>
- <?php if ($this->get_option("wpsg_vp_showpic") == "1" && $this->hasMod('wpsg_mod_produktbilder')) { ?>
+ <?php if ($this->get_option("wpsg_vp_showpic") == "1") { ?>
<span class="wpsg_vp_field_image">
<?php foreach ($var['arVariation'] as $kv => $vari) {
if ($vari['active'] == "1" && isset($vari['showpic'])) { ?>
<span class="wpsg_vp_image wpsg_vp_image_<?php echo $kv; ?>" style="display:<?php echo (($this->view['wpsg_mod_productvariants']['set'][$k] == $kv)?'block':'none'); ?>;">
<?php
- /*
- $img_src = $this->callMod('wpsg_mod_produktbilder', 'makeTn', array(
- $this->getProduktId($this->view['data']['id']),
- $vari['showpic'],
- $this->get_option("wpsg_vp_showpic_width"),
- $this->get_option("wpsg_vp_showpic_height"),
- 's'
- ));
- */
+ if (isset($this->view['data']['product_key'])) {
+ $arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['data']['product_key']);
+ $attachmentID = $this->imagehandler->getAttachmentID($this->view['data']['product_key']);
+
+ echo wp_get_attachment_image($attachmentID, 'medium');
+
+ }
+
$pbw = $this->get_option("wpsg_vp_showpic_width");
$pbh = $this->get_option("wpsg_vp_showpic_height");
$img_src = $vari['guid'];
@@ -92,21 +91,24 @@ <?php } /* SELECT-Box ENDE */ ?>
<?php /* IMAGE START */ ?>
- <?php if ($var['type'] == wpsg_mod_productvariants::TYPE_IMAGE && $this->hasMod('wpsg_mod_produktbilder')) { ?>
+ <?php if ($var['type'] == wpsg_mod_productvariants::TYPE_IMAGE) { ?>
<div class="wpsg_mod_productvariants_imageselect wpsg_mod_productvariants_imageselect_<?php echo $k; ?>">
<span>
<input type="hidden" name="wpsg_vp[<?php echo $k; ?>]" id="wpsg_vp_<?php echo $k; ?>" value="<?php echo wpsg_getStr($this->view['wpsg_mod_productvariants']['set'][$k]); ?>" />
<?php $kkv = -1; foreach ($var['arVariation'] as $kv => $vari) { $kkv++;
if ($vari['active'] == '1' && (!$this->hasMod('wpsg_mod_stock') || $vari['stock'] > 0)) { ?>
- <?php $img = $vari['guid']; ?>
- <?php if (wpsg_isSizedString($img)) {
- $pbw = $this->get_option('wpsg_vp_imageselect_width');
- $pbh = $this->get_option('wpsg_vp_imageselect_height');
- ?>
- <a data-wpsg-id="<?php echo $kv; ?>" class="wpsg_vp_update_image image <?php echo ((wpsg_getStr($this->view['wpsg_mod_productvariants']['set'][$k]) == $kv)?'akt':''); ?>" onclick="jQuery(this).parent().find('a').removeClass('akt'); jQuery(this).addClass('akt'); return false;" href="#">
- <img src="<?php echo $img; ?>" width="<?php echo $pbw; ?>" height="<?php echo $pbh; ?>"/>
+
+ <?php
+ if (isset($this->view['data']['product_key'])) {
+ $arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['data']['product_key']);
+ $attachmentID = $this->imagehandler->getAttachmentID($this->view['data']['product_key']);
+ ?>
+ <a data-wpsg-id="<?php echo $kv; ?>" class="wpsg_vp_update_image image <?php echo ((wpsg_getStr($this->view['wpsg_mod_productvariants']['set'][$k]) == $kv)?'akt':''); ?>" href="#">
+ <?php echo wp_get_attachment_image($attachmentID, 'thumbnail'); ?>
</a>
+
<?php } ?>
+
<?php } ?>
<?php } ?>
</span>
@@ -145,16 +147,6 @@ <span class="wpsg_vp_field_image">
<?php
- /*
- $img_src = $this->callMod('wpsg_mod_produktbilder', 'makeTn', array(
- $this->getProduktId($this->view['data']['id']),
- $vari['showpic'],
- $this->get_option("wpsg_vp_showpic_width"),
- $this->get_option("wpsg_vp_showpic_height"),
- 's'
- ));
- */
-
$pbw = $this->get_option("wpsg_vp_showpic_width");
$pbh = $this->get_option("wpsg_vp_showpic_height");
$img_src = $vari['guid'];
@@ -185,7 +177,7 @@ jQuery(this).closest('span').find('input').val(jQuery(this).data('wpsg-id'));
wpsg_mod_productvariants_reload(event);
-
+ alert('TEST');
} );
} );
diff --git a/views/produkttemplates/standard.phtml b/views/produkttemplates/standard.phtml index 43e1a26..691c5a1 100644 --- a/views/produkttemplates/standard.phtml +++ b/views/produkttemplates/standard.phtml @@ -10,11 +10,9 @@ // Damit keine Zubehörprodukte ausgegeben werden
//$this->noReleatedProducts = true;
- $arImages = $this->callMod('wpsg_mod_productvariants', 'getKombiVariImages', array($this->view['data']['product_key']));
- if (!wpsg_isSizedArray($arImages))
- $arImages = $this->callMod('wpsg_mod_produktbilder', 'getProduktBilder_MT', array($this->view['data']['product_key']));
- //$arImages = array();
-
+ $arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['data']['product_key']);
+ $arAttachmentIDsAll = $this->imagehandler->getAttachmentIDs($this->view['data']['product_id']);
+
?>
<div class="wpsg_produkt_wrapper">
@@ -37,20 +35,16 @@ <div itemscope itemtype="http://schema.org/Product" class="wpsg_produkt wpsg_produkt_<?php echo $this->view['data']['id']; ?>">
<?php /* Block für die Produktbilder START */ ?>
- <?php if (wpsg_isSizedArray($arImages)) { ?>
+ <?php if (wpsg_isSizedArray($arAttachmentIDsAll)) { ?>
<div class="wpsg_productimages">
<div class="wpsg_produkt_produktbilder">
- <?php $att = wp_get_attachment_image_src($arImages[0]['post_id'], array(300, 300), false); ?>
- <a rel="gallery-wpsg-<?php echo $this->getTemplateIndex(); ?>" title="<?php echo $this->getProductName($this->view['data']['id']); ?>" href="<?php echo $att[0]; ?>" class="thickbox">
- <?php echo wp_get_attachment_image($arImages[0]['post_id'], array(300, 300), false, array()); ?>
- </a>
-
- <?php if (sizeof($arImages) > 1) { for ($i = 1; $i < sizeof($arImages); $i ++) { ?>
- <?php $att = wp_get_attachment_image_src($arImages[$i]['post_id'], array(300, 300), false); ?>
- <a style="display:none;" rel="gallery-wpsg-<?php echo $this->getTemplateIndex(); ?>" title="<?php echo $this->getProductName($this->view['data']['id']); ?>" href="<?php echo $att[0]; ?>" class="thickbox">
- <?php echo wp_get_attachment_image($arImages[$i]['post_id'], array(300, 300), false, array()); ?>
+ <?php if (sizeof($arAttachmentIDsAll) > 1) { for ($i = 0; $i < sizeof($arAttachmentIDsAll); $i ++) { ?>
+ <?php $att = wp_get_attachment_image($arAttachmentIDsAll[$i], array(300, 300), false); ?>
+ <?php $att = wp_get_attachment_image_src($arAttachmentIDsAll[$i], array(300, 300), false); ?>
+ <a <?php if ($arAttachmentIDsAll[$i] != $arAttachmentIDs[0]) echo 'style="display:none;"'; ?> rel="gallery-wpsg-<?php echo $this->getTemplateIndex(); ?>" title="<?php echo $this->getProductName($this->view['data']['id']); ?>" href="<?php echo $att[0]; ?>" class="thickbox">
+ <?php echo wp_get_attachment_image($arAttachmentIDsAll[$i], array(300, 300), false, array()); ?>
</a>
<?php } } ?>
diff --git a/views/warenkorb/basket.phtml b/views/warenkorb/basket.phtml index 30ff26e..46564cf 100644 --- a/views/warenkorb/basket.phtml +++ b/views/warenkorb/basket.phtml @@ -41,36 +41,25 @@ <div class="basket_product_row">
- <?php $this->view['$bPicture'] = false; ?>
+ <?php $this->view['$bPicture'] = false;
- <?php if ($this->get_option('wpsg_imagehandler_basketimage') == '1' && $this->hasMod('wpsg_mod_produktbilder')) {
-
- if (wpsg_isSizedString($product_data['varianten_image'])) $arImages = array($product_data['varianten_image']);
- else $arImages = $this->callMod('wpsg_mod_produktbilder', 'getProduktBilder_MT', array($this->getProduktID($product_data['id'])));
+ ?>
+ <?php if ($this->get_option('wpsg_imagehandler_basketimage') == '1') {
?>
<div class="productimage">
- <?php if (wpsg_isSizedString($arImages[0]['guid'])) { ?>
<?php
if (isset($product_data['product_key'])) {
- $arr = $this->callMod('wpsg_mod_productvariants', 'getKombiVariImages', array($product_data['product_key']));
- if (wpsg_isSizedArray($arr))
- {
- $ais = wp_get_attachment_image_src($arr[0]['post_id'], 'thumbnail');
- $url = $ais[0];
- }
- else
- {
- $url = $this->callMod('wpsg_mod_produktbilder', 'getProductImage_MT', array($product_data['productkey'], 'thumbnail'));
- }
- } else {
- $url = $this->callMod('wpsg_mod_produktbilder', 'getProductImage_MT', array($product_data['productkey'], 'thumbnail'));
+ $arAttachmentIDs = $this->imagehandler->getAttachmentIDs($product_data['product_key']);
+ $attachmentID = $this->imagehandler->getAttachmentID($product_data['product_key']);
+
+ echo wp_get_attachment_image($attachmentID, 'medium');
+
}
- if (wpsg_isSizedString($url)) $this->view['$bPicture'] = true;
- echo "<img src=".$url." alt='' />";
+ if ($attachmentID > 0) $this->view['$bPicture'] = true;
+ //echo "<img src=".$url." alt='' />";
?>
- <?php } ?>
</div>
<?php } ?>
diff --git a/views/warenkorb/overview.phtml b/views/warenkorb/overview.phtml index ef87d99..932adfb 100644 --- a/views/warenkorb/overview.phtml +++ b/views/warenkorb/overview.phtml @@ -122,35 +122,24 @@ <?php $this->view['$bPicture'] = false; ?>
- <?php if ($this->get_option('wpsg_imagehandler_basketimage') == '1' && $this->hasMod('wpsg_mod_produktbilder')) {
-
- if (wpsg_isSizedString($product_data['varianten_image'])) $arImages = array($product_data['varianten_image']);
- else $arImages = $this->callMod('wpsg_mod_produktbilder', 'getProduktBilder_MT', array($this->getProduktID($product_data['id'])));
+ <?php if ($this->get_option('wpsg_imagehandler_basketimage') == '1') {
?>
<div class="productimage">
- <?php if (wpsg_isSizedString($arImages[0]['guid'])) { ?>
<?php
+
if (isset($product_data['product_key'])) {
- $arr = $this->callMod('wpsg_mod_productvariants', 'getKombiVariImages', array($product_data['product_key']));
- if (wpsg_isSizedArray($arr))
- {
- $ais = wp_get_attachment_image_src($arr[0]['post_id'], 'thumbnail');
- $url = $ais[0];
- }
- else
- {
- $url = $this->callMod('wpsg_mod_produktbilder', 'getProductImage_MT', array($product_data['productkey'], 'thumbnail'));
- }
- } else {
- $url = $this->callMod('wpsg_mod_produktbilder', 'getProductImage_MT', array($product_data['productkey'], 'thumbnail'));
+ $arAttachmentIDs = $this->imagehandler->getAttachmentIDs($product_data['product_key']);
+ $attachmentID = $this->imagehandler->getAttachmentID($product_data['product_key']);
+
+ echo wp_get_attachment_image($attachmentID, 'medium');
+
}
- if (wpsg_isSizedString($url)) $this->view['$bPicture'] = true;
- echo "<img src=".$url." alt='' />";
+ if ($attachmentID > 0) $this->view['$bPicture'] = true;
+
?>
- <?php } ?>
</div>
<?php } ?>
|
