Jump to content

Serve resources from a consistent URL for all product images PS 1.6


Recommended Posts

Fresh install PS Testing site with GX Metrix  found following warning: Serve resources from a consistent URL.


 


From GX Metrix commend:The following resources have identical contents, but are served from different URLs. Serve these resources from a consistent URL to save 3 request(s) and 7.9KiB.


 


I have check the BO and seems all ok , canonical url set to Redirect to the canonical URL 301 and Friendly URL  On 


 


 


website : http://goo.gl/iMwgBg


Ps 1.6.0.14


 


I tried to look  inside all possible setting but I still at  same point and googling around I couldn`t find any solution  , I would really appreciate some help in this matter as seems to be a really big problem for me as all product I insert come out with the same problem 


 


Thx in advance


Stefano


Link to comment
Share on other sites

It is the way your theme is written, the extra images it loads for the products have a query string on the end of them. You can edit the template and remove them more than likely.

Hi Dh42 thank you for your reply , I am not really much into theme modification , can you please advice about the file to modify ?

 

Thx 

Stefano

 

Link to comment
Share on other sites

I am not familiar with your theme, but my best guess would be the product-list.tpl file in your theme.

{*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2014 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
{if isset($products) && $products}
	{*define numbers of product per line in other page for desktop*}
	{if $page_name !='index' && $page_name !='product'}
		{assign var='nbItemsPerLine' value=3}
		{assign var='nbItemsPerLineTablet' value=2}
		{assign var='nbItemsPerLineMobile' value=3}
	{else}
		{assign var='nbItemsPerLine' value=4}
		{assign var='nbItemsPerLineTablet' value=3}
		{assign var='nbItemsPerLineMobile' value=2}
	{/if}
	{*define numbers of product per line in other page for tablet*}
	{assign var='nbLi' value=$products|@count}
	{math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
	{math equation="nbLi/nbItemsPerLineTablet" nbLi=$nbLi nbItemsPerLineTablet=$nbItemsPerLineTablet assign=nbLinesTablet}
	<!-- Products list -->
	<ul{if isset($id) && $id} id="{$id}"{/if} class="product_list grid row{if isset($class) && $class} {$class}{/if}{if isset($active) && $active == 1} active{/if}">
	{foreach from=$products item=product name=products}
		{math equation="(total%perLine)" total=$smarty.foreach.products.total perLine=$nbItemsPerLine assign=totModulo}
		{math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineTablet assign=totModuloTablet}
		{math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineMobile assign=totModuloMobile}
		{if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if}
		{if $totModuloTablet == 0}{assign var='totModuloTablet' value=$nbItemsPerLineTablet}{/if}
		{if $totModuloMobile == 0}{assign var='totModuloMobile' value=$nbItemsPerLineMobile}{/if}
		<li class="
			{if $smarty.foreach.products.iteration % 3 == '0' }pos-3{/if} 
			{if $smarty.foreach.products.iteration % 4 == '0' }pos-4{/if} 
			ajax_block_product{if $page_name == 'index' || $page_name == 'product'} col-xs-12 col-sm-4 col-md-3{else} col-lg-3 col-md-4  col-sm-4 col-xs-12 {/if}{if $smarty.foreach.products.iteration%$nbItemsPerLine == 0} last-in-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLine == 1} first-in-line{/if}{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModulo)} last-line{/if}{if $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 0} last-item-of-tablet-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 1} first-item-of-tablet-line{/if}{if $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 0} last-item-of-mobile-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 1} first-item-of-mobile-line{/if}{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModuloMobile)} last-mobile-line{/if}">
			<div class="product-container" itemscope itemtype="http://schema.org/Product">
				<div class="item">
				<div class="left-block">
					<div class="product-image-container">
						<a class="product_img_link"	href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url">
							<img class="replace-2x img-responsive" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html':'UTF-8'}" alt="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" title="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} itemprop="image" />
						
						{if $product.specific_prices}
							<span class="sale-box">
								<span class="sale-label">{l s='Sale!'}</span>
							</span>
						{else}
							{if isset($product.new) && $product.new == 1}
								<span class="new-box">
									<span class="new-label">{l s='New'}</span>
								</span>
							{/if}
						{/if}
						</a>
					</div>
				</div>
				<div class="right-block">
					<h5 itemprop="name">
						{if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}
						<a class="product-name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url" >
							{$product.name|truncate:45:'...'|escape:'html':'UTF-8'}
						</a>
					</h5>
					{hook h='displayProductListReviews' product=$product}
					<p class="product-desc" itemprop="description">
						{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}
					</p>
					{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
					<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="content_price">
						{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
							<span itemprop="price" class="price product-price">
								{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
							</span>
							<meta itemprop="priceCurrency" content="{$priceDisplay}" />
							{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
								<span class="old-price product-price">
									{displayWtPrice p=$product.price_without_reduction}
								</span>
								{if $product.specific_prices.reduction_type == 'percentage'}
									<span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>
								{/if}
							{/if}
						{/if}
					</div>
					{/if}
					
					{if isset($product.color_list)}
						<div class="color-list-container">{$product.color_list} </div>
					{/if}
					<div class="product-flags">
						{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
							{if isset($product.online_only) && $product.online_only}
								<span class="online_only">{l s='Online only'}</span>
							{/if}
						{/if}
						{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
							{elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
								<span class="discount">{l s='Reduced price!'}</span>
							{/if}
					</div>
					{if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
						{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
							<span itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="availability">
								{if ($product.allow_oosp || $product.quantity > 0)}
									<span class="{if $product.quantity <= 0}out-of-stock{else}available-now{/if}">
										<link itemprop="availability" href="http://schema.org/InStock" />{if $product.quantity <= 0}{if $product.allow_oosp}{$product.available_later}{else}{l s='Out of stock'}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if}
									</span>
								{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
									<span class="available-dif">
										<link itemprop="availability" href="http://schema.org/LimitedAvailability" />{l s='Product available with different options'}
									</span>
								{else}
									<span class="out-of-stock">
										<link itemprop="availability" href="http://schema.org/OutOfStock" />{l s='Out of stock'}
									</span>
								{/if}
							</span>
						{/if}
					{/if}
				</div>
	 				<div class="functional-buttons clearfix">
						{if isset($quick_view) && $quick_view}
							<a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}">
								<span>{l s='Quick view'}</span>
							</a>
						{/if}
						{hook h='displayProductListFunctionalButtons' product=$product}
						{if isset($comparator_max_item) && $comparator_max_item}
							<div class="compare">
								<a class="add_to_compare" href="{$product.link|escape:'html':'UTF-8'}" data-id-product="{$product.id_product}">{l s='Add to Compare'}</a>
							</div>
						{/if}
					</div>
				<div class="button-container">
						{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
							{if ($product.allow_oosp || $product.quantity > 0)}
								{if isset($static_token)}
									<a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}">
										<span>{l s='Add to cart'}</span>
									</a>
								{else}
									<a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, 'add=1&id_product={$product.id_product|intval}', false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}">
										<span>{l s='Add to cart'}</span>
									</a>
								{/if}						
							{else}
								<span class="button ajax_add_to_cart_button btn btn-default disabled">
									<span>{l s='Add to cart'}</span>
								</span>
							{/if}
						{/if}
						<a itemprop="url" class="button lnk_view btn btn-default" href="{$product.link|escape:'html':'UTF-8'}" title="{l s='View'}">
							<span>{l s='More'}</span>
						</a>
				</div>
					<div class="pos_bxslider">
                        {hook h ='imgmore' product=$product}
						{if $smarty.foreach.products.first }
							{hook h='displayimg'}
						{/if}
                  </div>
				</div>
			</div><!-- .product-container> -->

		</li>
	{/foreach}
	</ul>
{addJsDefL name=min_item}{l s='Please select at least one product' js=1}{/addJsDefL}
{addJsDefL name=max_item}{l s='You cannot add more than %d product(s) to the product comparison' sprintf=$comparator_max_item js=1}{/addJsDefL}
{addJsDef comparator_max_item=$comparator_max_item}
{addJsDef comparedProductsIds=$compared_products}
{/if}

Hi Dh42  I check the product-list.tpl (above)and seems to me good to me , can you please tell me if see  something wrong 

 

THX

Stefano

Link to comment
Share on other sites

It does not seem to be in there, You might contact the theme maker, they should know. I am just trying to guess since I don't know the structure or modules of the theme.

Yes I tried a couple of time already but it seems to be unresponsive , I guess unfortunately is something I have to find myself :-(

 

 product comes from the module category tab but cannot locate the query , I may be in wrong direction 


<div class="tab-category-container pos_animated">
	<div class="container">
		<div class="container-inner">
			<div class="tab-category ">
					<div class ='cate_title'>
						<h2 class="fx-fadeInDown" >{l s='Category products' mod='postabcategory'}</h2>
					</div>
				<!-- <p class="des-tab">{l s='Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua' mod='postabcategory'}</p> -->
				<ul class="tab_cates"> 
				{$count=0}
				{foreach from=$productCates item=productCate name=posTabCategory}
						<li rel="tab_{$productCate.id}" {if $count==0} class="active"  {/if} > {$productCate.name}</li>
						{$count= $count+1}
				{/foreach}	
				</ul>
				<div class="tab_container fx-fadeInUp">
				{foreach from=$productCates item=productCate name=posTabCategory}
					 <div id="tab_{$productCate.id}" class="tab_category">
                         <ul class="pos_child">
                             {foreach $productCate.child_cate as $child  }
                                     <li class="child_name">
                                         <a href="{$link->getCategoryLink({$child.id_category},{$child.link_rewrite})|escape:'html':'UTF-8'}">  {$child.name} </a>
                                     </li>
                             {/foreach}
                         </ul>
                               <ul class="productTabCategory row-fluid product_list row">
									
									{foreach from=$productCate.product item=product name=posTabCategory}
										<li class="
											{if $smarty.foreach.posTabCategory.iteration % 3 == '0' }pos-on-3{/if} 
											{if $smarty.foreach.posTabCategory.iteration % 4 == '0' }pos-on-4{/if} 
											{if $smarty.foreach.posTabCategory.iteration % $product_on_row == '0'}pos-on-row{/if} 
											col-lg-{12/$product_on_row} col-md-3  col-sm-3 col-xs-4 col-xs-mobile  
											tab-category-item  ajax_block_product 
											{if $smarty.foreach.posTabCategory.first}first_item{elseif $smarty.foreach.posTabCategory.last}last_item{else}of-tablet-line{/if} ">
                                            <div class="item-inner">
												<div class="item">
													<a class ="bigpic_{$product.id_product}_tabcategory product_image" href="{$product.link|escape:'html'}" title="{$product.name|escape:html:'UTF-8'}">
														<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html':'UTF-8'}" alt="{$product.name|escape:html:'UTF-8'}" />
														{if isset($product.new) && $product.specific_prices} 
															{if $product.specific_prices}<span class="sale">{l s='Sale'}</span>{/if}
														{else}
														{if isset($product.new) && $product.new == 1}<span class="new">{l s='New'}</span>{/if}
														{if $product.specific_prices}<span class="sale">{l s='Sale'}</span>{/if}
														{/if}								
													</a>
													<h5 class="product-name"><a href="{$product.link|escape:'html'}" title="{$product.name|truncate:50:'...'|escape:'htmlall':'UTF-8'}">{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}</a></h5>
													{hook h='displayProductListReviews' product=$product}
													{if $product.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
														<div class="price-box">
															<span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>
															<meta itemprop="priceCurrency" content="{$priceDisplay}" />
															{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
																<span class="old-price product-price">
																	{displayWtPrice p=$product.price_without_reduction}
																</span>
															{/if}
														</div>
													{/if}
														
													<div class="actions">
														<div class="acctions-inner">
															<ul class="add-to-links">
															{if isset($quick_view) && $quick_view}
																<li><a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}">
																	<span>{l s='Quick view'}</span>
																</a></li>
															{/if}
																<!-- <li><a class="lnk_more" href="{$product.link|escape:'html'}" title="{l s='View Detail' mod='postabcategory'}">{l s='View Detail' mod='postabcategory'}</a></li> -->
																<li><a onclick="WishlistCart('wishlist_block_list', 'add', '{$product.id_product|intval}', $('#idCombination').val(), 1,'tabcategory'); return false;" class="add-wishlist wishlist_button" title="{l s='Add to Wishlist' mod='postabcategory'}" href="#">{l s='Add to Wishlist' mod='postabcategory'}</a></li>
															</ul>
															{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
																{if ($product.allow_oosp || $product.quantity > 0)}
																	{if isset($static_token)}
																		<a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}">
																			{l s='Add to cart'}
																		</a>
																	{else}
																		<a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, 'add=1&id_product={$product.id_product|intval}', false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}">
																			{l s='Add to cart'}
																		</a>
																	{/if}						
																{else}
																	<span class="button ajax_add_to_cart_button btn btn-default disabled">
																		{l s='Add to cart'}
																	</span>
																{/if}
															{/if}
													</div>
													</div>
													
													<div class="pos_bxslider">
														{hook h ='imgmore' product=$product}
													</div>
												</div>
											</div>
                                            
										</li>

									{/foreach}

                                </ul>
							</div>

				{/foreach}
				 </div> <!-- .tab_container -->
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
	$(".tab_category").hide();
	$(".tab_category:first").show(); 
	$("ul.tab_cates li").click(function() {
		$("ul.tab_cates li").removeClass("active");
		$(this).addClass("active");
		$(".tab_category").hide();
		$(".tab_category").removeClass("animate1 {$tab_effect}");
		var activeTab = $(this).attr("rel"); 
		$("#"+activeTab) .addClass("animate1 {$tab_effect}");
		$("#"+activeTab).fadeIn(2000);
	});
});
</script>

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

It does not seem to be in there, You might contact the theme maker, they should know. I am just trying to guess since I don't know the structure or modules of the theme.

Ok I found it , I removed the "

+ '?timestamp=' + new Date().getTime()

in the and seems now I solve the problem :-)

 

THX for your help 

 

STefano

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

  • 2 months later...

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...