Post by GrDr » Sun Oct 18, 2015 10:53 pm

Hello
How can I get link to the original image in product (under the thumb image) that located in data folder not in cache?
tnx

Newbie

Posts

Joined
Sun Jul 12, 2015 7:44 pm

Post by GrDr » Sun Oct 18, 2015 11:40 pm

Dosn't work:(

Code: Select all

    <file path="catalog/controller/product/product.php">
        <operation error="log">
            <search position="replace"><![CDATA[if ($product_info['image']) {
				$data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
			} else {
				$data['popup'] = '';
			}]]></search>
            <add><![CDATA[if ($product_info['image']) {
                $oldsize = getimagesize(DIR_IMAGE.$product_info['image']);
                $scale = min($max_width/$oldsize[0], $max_height/$oldsize[1]);
                $new_width  = ceil($scale*$oldsize[0]);
                $new_height = ceil($scale*$oldsize[1]);
                 $this['popup'] = $this->model_tool_image->resize($product_info['image'], $new_width , $new_height);
             $this['original_image'] = HTTP_IMAGE . $product_info['image'];
         } else {
            $this['popup'] = '';
            $this['original_image'] ='';
         }]]></add>
        </operation>
    </file>

    <file path="catalog/view/theme/*/template/product/product_gallery.tpl">
        <operation error="log">
            <search position="replace"><![CDATA[<a class="thumbnail" href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>"> <img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>]]></search>
            <add><![<a href="<?php echo $original_image ?>" title="<?php echo $heading_title; ?>" class="cloud-zoom-gallery" rel="useZoom: 'zoom', smallImage: '<?php echo $image['popup']; ?>' "><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>]]></add>
        </operation>
    </file>

Newbie

Posts

Joined
Sun Jul 12, 2015 7:44 pm

Post by uksitebuilder » Mon Oct 19, 2015 1:18 am

With vqmod, you can only <search> for one line of code (not multiple lines as your example)

https://github.com/vqmod/vqmod/wiki/Scripting

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by GrDr » Mon Oct 19, 2015 9:50 pm

If i replace the code in files, i get 500 error

catalog/controller/product/product.php

Code: Select all

if ($product_info['image']) {
            $data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
         } else {
            $data['popup'] = '';
         }
replace with:

Code: Select all

if ($product_info['image']) {
                $oldsize = getimagesize(DIR_IMAGE.$product_info['image']);
                $scale = min($max_width/$oldsize[0], $max_height/$oldsize[1]);
                $new_width  = ceil($scale*$oldsize[0]);
                $new_height = ceil($scale*$oldsize[1]);
                 $this['popup'] = $this->model_tool_image->resize($product_info['image'], $new_width , $new_height);
             $this['original_image'] = HTTP_IMAGE . $product_info['image'];
         } else {
            $this['popup'] = '';
            $this['original_image'] ='';
         }
catalog/view/theme/*/template/product/product_gallery.tpl

Code: Select all

<a class="thumbnail" href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>"> <img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>
replace with:

Code: Select all

<a href="<?php echo $original_image ?>" title="<?php echo $heading_title; ?>" class="cloud-zoom-gallery" rel="useZoom: 'zoom', smallImage: '<?php echo $image['popup']; ?>' "><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>
any idea?

Newbie

Posts

Joined
Sun Jul 12, 2015 7:44 pm

Post by uksitebuilder » Mon Oct 19, 2015 10:03 pm

Where are the values for these variables coming from ?

$max_width
$max_height

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by GrDr » Mon Oct 19, 2015 10:13 pm

oh, sorry

catalog/controller/product/product.php

Code: Select all

if ($product_info['image']) {
            $data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
         } else {
            $data['popup'] = '';
         }
replace with:

Code: Select all

if ($product_info['image']) {
                $max_width = (int)315;
                $max_height = (int)900;
                $oldsize = getimagesize(DIR_IMAGE.$product_info['image']);
                $scale = min($max_width/$oldsize[0], $max_height/$oldsize[1]);
                $new_width  = ceil($scale*$oldsize[0]);
                $new_height = ceil($scale*$oldsize[1]);
                 $this['popup'] = $this->model_tool_image->resize($product_info['image'], $new_width , $new_height);
             $this['original_image'] = HTTP_IMAGE . $product_info['image'];
         } else {
            $this['popup'] = '';
            $this['original_image'] ='';
         }
catalog/view/theme/*/template/product/product_gallery.tpl

Code: Select all

<a class="thumbnail" href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>"> <img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>
replace with:

Code: Select all

<a href="<?php echo $original_image ?>" title="<?php echo $heading_title; ?>" class="cloud-zoom-gallery" rel="useZoom: 'zoom', smallImage: '<?php echo $image['popup']; ?>' "><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>

Newbie

Posts

Joined
Sun Jul 12, 2015 7:44 pm

Post by uksitebuilder » Mon Oct 19, 2015 10:17 pm

Change

$this['original_image'] (in 2 places) with $data['original_image']

Change

$this['popup'] with $data['popup']

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by GrDr » Wed Oct 21, 2015 2:10 pm

and how i can get the link to the image under the sample?

Newbie

Posts

Joined
Sun Jul 12, 2015 7:44 pm
Who is online

Users browsing this forum: No registered users and 5 guests