Jump to content

Edit picture size for 1 supplier


Lucif

Recommended Posts

Unfortunately, one of my suppliers have changed their contract.

They can not sell me their products anymore if i show the pictures on my webshop with a size of 600px.

They want me to edit the picture size to a max of 265px.

 

I think this is way to small, my customers can't see the details of the product on that size.

The problem is that there is no other supplier for this product, so i have to deal with it.

 

But, when i change the max size to 265px, then all my products images (over 2000!) have that small image size.

And a detailed image size is really important.

 

So now i am looking for a way that i only change the images of supplier '4' in my shop to 265px.

Then is everyone happy.. (well, not quite, but the best that we can reach).

 

A watermark is also not the solution for them  (i have that already) :(

Link to comment
Share on other sites

Please, anyone?

 

This is my product.tpl code:

			<!-- product img-->        
			<div id="image-block" class="clearfix">
				{if $product->new}
					<span class="new-box">
						<span class="new-label">{l s='New'}</span>
					</span>
				{/if}
				{if $product->on_sale}
					<span class="sale-box no-print">
						<span class="sale-label">{l s='Sale!'}</span>
					</span>
				{elseif $product->specificPrice && $product->specificPrice.reduction && $productPriceWithoutReduction > $productPrice}
					<span class="discount">{l s='Reduced price!'}</span>
				{/if}
				{if $have_image}
					<span id="view_full_size">
						{if $jqZoomEnabled && $have_image && !$content_only}
							<a class="jqzoom" title="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" rel="gal1" href="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox_default')|escape:'html':'UTF-8'}" itemprop="url">
								<img itemprop="image" src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')|escape:'html':'UTF-8'}" title="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" alt="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}"/>
							</a>
						{else}
							<img id="bigpic" itemprop="image" src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')|escape:'html':'UTF-8'}" title="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" alt="{if !empty($cover.legend)}{$cover.legend|escape:'html':'UTF-8'}{else}{$product->name|escape:'html':'UTF-8'}{/if}" width="{$largeSize.width}" height="{$largeSize.height}"/>
							{if !$content_only}
								<span class="span_link no-print">{l s='View larger'}</span>
							{/if}
						{/if}
					</span>
				{else}
					<span id="view_full_size">
						<img itemprop="image" src="{$img_prod_dir}{$lang_iso}-default-large_default.jpg" id="bigpic" alt="" title="{$product->name|escape:'html':'UTF-8'}" width="{$largeSize.width}" height="{$largeSize.height}"/>
						{if !$content_only}
							<span class="span_link">
								{l s='View larger'}
							</span>
						{/if}
					</span>
				{/if}
			</div> <!-- end image-block -->
Edited by Lucif (see edit history)
Link to comment
Share on other sites

But, when i change the max size to 265px, then all my products images (over 2000!) have that small image size.

And a detailed image size is really important.

 

So now i am looking for a way that i only change the images of supplier '4' in my shop to 265px.

 

If some of your pictures are only 265px small, by default in Prestashop they are shown at this size with a white frame around them in bigger views.

Link to comment
Share on other sites

Thank you rictools.

That is offcourse also possible.

 

But to do that i need to download every image seperatly from the BO.

Then make them smaller (this is possible in a batch, so not that big issue) but then again, seperatly update every product.

 

They are not all together at one map at the server.

 

That is a lot of work for all hundreds of products :)

Link to comment
Share on other sites

I fixed it myself!

href="{if $product_supplier->id != '4'}{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox_default')|escape:'html':'UTF-8'}{else}{$link->getImageLink($product->link_rewrite, $imageIds, 'medium_default')|escape:'html':'UTF-8'}{/if}"

I am so happy!! ^^

Link to comment
Share on other sites

In productcontroller i add the supplier (copy from the manufacturer line 261)

'product_supplier' => new Supplier((int)$this->product->id_supplier, $this->context->language->id),

And an if statement on line 119 in product.tpl:

href="{if $product_supplier->id != '4'}{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox_default')|escape:'html':'UTF-8'}{else}{$link->getImageLink($product->link_rewrite, $imageIds, 'productsupplierid_default')|escape:'html':'UTF-8'}{/if}"

And in the BO i created a new image size, 'productsupplierid' with the max size of 265px.

 

Maybe not a perfect code, but it works! :)

Edited by Lucif (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...