Jump to content

Prestashop 1.7 Change product grid "add to cart" button to "view product"


Recommended Posts

Hi everyone, I hope someone helps me, I don't know much about coding, but in the past I've been able to solve some of the issues with my site. This one though I don't seem able to fix:

In the product mini view (grid mode) you see the product image, name and price; but when you put the mouse on top of the product, the name and price hide, and a "add to cart" button is shown. If there is no stock, instead  it says "out of stock".  The thing is that most of my products have combinations, and even though I've deactivated the "add to cart" button in the back end (Disabled the option "Show the button "add to cart" when the product has attributes" it is still showing. The worst part is that it adds to the cart one of the variations, but the client didn't have the chance to choose for example the size or color that they needed. 

I tried erasing the button code, but the product name and price is still hiding, and because of that also the posible link source to the product page in that section. Clicking the image is the only option to "go to the product page". 

This is the code of the productgrid.tpl

<div class="innovatoryProduct-container item">
	  <div class="innovatoryProduct-image">
		{block name='product_thumbnail'}
		  <a href="{$product.url}" class="thumbnail product-thumbnail">
				<span class="cover_image">
					<img src = "{$product.cover.bySize.home_default.url}" data-full-size-image-url = "{$product.cover.large.url}" alt="" width="auto" height="auto" />
				</span>
				{if isset($product.images[1])}
				<span class="hover_image">
					<img src = "{$product.images[1].bySize.home_default.url}" data-full-size-image-url = "{$product.images[1].bySize.home_default.url}" alt="" width="auto" height="auto" /> 
				</span>
				{/if} 
			</a>
		{/block}
		{if isset($product.new) && $product.new == 1}
			<span class="innovatoryNew-label">{l s='New' d='Shop.Theme.Actions'}</span>
		{/if}
		{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
			{if $product.specific_prices && $product.specific_prices.reduction_type == 'percentage'}
			<span class="reduction_percent_display innovatorySale-label">										
				-{$product.specific_prices.reduction|escape:'quotes':'UTF-8' * 100}%									
			</span>
			{/if}
		{/if}
		<div class="innovatoryActions">
			<div class="innovatoryActions-i">

				<div class="innovatoryCart innovatoryItem">
					{if ($product.allow_oosp || $product.quantity > 0)}
						<form action="{$urls.pages.cart}" method="post">
						<input type="hidden" name="token" value="{$static_token}">
						<input type="hidden" value="{$product.id_product}" name="id_product">
						<a data-button-action="add-to-cart" class="cart-btn" title="{l s='Add To Cart' d='Shop.Theme.Actions'}">
							<i class="ti-shopping-cart"></i>
						</a>
						</form>
					{else}
						<form action="{$urls.pages.cart}" method="post">
						<input type="hidden" name="token" value="{$static_token}">
						<input type="hidden" value="{$product.id_product}" name="id_product">
						<a data-button-action="add-to-cart" class="cart-btn disabled" disabled title="{l s='Out of Stock' d='Shop.Theme.Actions'}">
							<i class="ti-shopping-cart"></i>
						</a>
						</form>
					{/if}
				</div>	
				
				<div class="innovatoryQuick innovatoryItem">
				  <a href="#" class="quick-view" data-link-action="quickview" title="{l s='Quickview' d='Shop.Theme.Actions'}">
					<i class="ti-eye"></i>
				  </a>
				</div>
				
				<div class="innovatoryItem innovatoryWish">
					{hook h='displayProductListFunctionalButtons' product=$product}
				</div>	
			</div>
		</div>
		{*{block name='product_variants'}
			{if $product.main_variants}
				{include file='catalog/_partials/variant-links.tpl' variants=$product.main_variants}
			{/if}
		{/block}*}
	</div>
    <div class="innovatory-product-description">
    	{hook h='displayProductListReviews' product=$product}
      {block name='product_name'}
        <h2 class="h2 productName" itemprop="name"><a href="{$product.url}">{$product.name|truncate:50:'...'}</a></h2>
      {/block}	 
      {block name='product_price_and_shipping'}
        {if $product.show_price}
          <div class="innovatory-product-price-and-shipping">
            <span itemprop="price" class="price">{$product.price}</span>
			{if $product.has_discount}
              {hook h='displayProductPriceBlock' product=$product type="old_price"}
              <span class="old-price regular-price">{$product.regular_price}</span>
            {/if}
            {hook h='displayProductPriceBlock' product=$product type="before_price"}          
            {hook h='displayProductPriceBlock' product=$product type='unit_price'}
            {hook h='displayProductPriceBlock' product=$product type='weight'}
          </div>
        {/if}
      {/block}	 
      	<div class="innovatoryCart innovatoryItem hidden-md-down">
			<form action="{$product.url}" method="post"><input type="hidden" name="token" value="{$static_token}"><input type="hidden" value="{$product.id_product}" name="id_product">
			<a data-button-action="add-to-cart" class="cart-btn" title="{l s='Add To Cart' d='Shop.Theme.Actions'}">{l s='Add To Cart' d='Modules.ITProductfilter'}</a>
			</form>
		</div>   	
    </div>
  </div>

I think that maybe the solution is simple, but since I don't understand the coding language I'm not able to make the fix.

I really hope someone could help me, since I don't think it is acceptable to release my website with this kind of issue.

 

Kind Regards

Daniela Castro

Link to comment
Share on other sites

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