Sorry about that. I edited the code above.
The change is actually just adding a > in the .pi-gallery > a so it only affects the image directly inside the gallery and not the additional thumbs.
Sorry about that. I edited the code above.
You could add a hook to includes/hooks/shop/index/imageZoom.php
Code: Select all
class hook_shop_index_imageZoom {
function listen_injectBodyEnd() {
$magnify = 3;
$sitepath = DIR_WS_CATALOG;
$script = <<<script
<script src="{$sitepath}ext/zoom/jquery.zoom.js"></script>
<script>
$(document).ready(function(){
$('.card > a')
.wrap('<span style="display:inline-block"></span>')
.css('display', 'block')
.parent()
.zoom({magnify: {$magnify}});
});
</script>
script;
return $script;
}
}
Code: Select all
$('.cm-in-category-listing .card > a')You could add this to the category javascript just before the closing /script tag
Code: Select all
$(".card.is-category").click(function(){
window.location.href = $(this).find("a.card-link").attr("href");
});
You'd have to edit the code right above the $magnify = 3; and do something to test which category you are in and then change the magnify level based on that logic. Another option is to have the javascript load the first category image and based on its size, it could set the zoom level to something.
You could move the hooks into the same file under siteWide and then test the basename($_SERVER['SCRIPT_NAME']) to see if you are in "index.php" or "product_info.php" and then have it act accordingly. Or keep the 2 hooks to avoid more complex code