Jump to content

Disable Cart and change the way the "add to cart" button works


olly79

Recommended Posts

Hi all,

Just wondering if someone can assist me with the following query.

I want to disable the cart from view and equally I want to change all the "add to cart" buttons to "enquire now" and for this button to take a customer to the contact form page. Is it also possible to prepopulate the contact form with the product the customer is enquiring about in the message field?

help with what files and where would be much appreciated.

Link to comment
Share on other sites

You will need to change line 283 of product.tpl in your theme's directory (in PrestaShop v1.3.1) from:


quantity == 0} style="display:none;"{/if} id="add_to_cart" class="buttons_bottom_block"><input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /></p>



to:


quantity == 0} style="display:none;"{/if} id="add_to_cart" class="buttons_bottom_block"><a href="{$base_dir_ssl}contact-form.php?product_name={$product->name}" class="exclusive">{l s='Contact us'}



Then change line 37 of contact-form.tpl from:

<textarea id="message" name="message" rows="7" cols="35">{if isset($smarty.post.message)}{$smarty.post.message|escape:'htmlall':'UTF-8'|stripslashes}{/if}</textarea>



to:

<textarea id="message" name="message" rows="7" cols="35">{if isset($smarty.post.message)}{$smarty.post.message|escape:'htmlall':'UTF-8'|stripslashes}{elseif $smarty.get.product_name}{$smarty.get.product_name}

{/if}</textarea>



This will add the product name to the message field followed by two new line characters.

  • Like 1
Link to comment
Share on other sites

Hi,

I have amended the lines you have referenced; however, the change is only applied to the products; however, I wonder if you could assist me in doing the same for products displayed on the home page as these still have 'add to cart' displayed?

This is the code for featured-products.tpl:

<!-- MODULE Home Featured Products -->

{l s='Featured products' mod='homefeatured'}
   {if isset($products) AND $products}


           {foreach from=$products item=product name=homeFeaturedProducts}


getImageLink($product.link_rewrite, $product.id_image, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" />


{$product.name|truncate:27:'...'|escape:'htmlall':'UTF-8'}

{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
                       {if ($product.quantity > 0 OR $product.allow_oosp) AND $product.customizable != 2}
{l s='Add to cart' mod='homefeatured'}
                       {else}
{l s='Add to cart' mod='homefeatured'}
                       {/if}


           {/foreach}


   {else}

{l s='No featured products' mod='homefeatured'}
   {/if}

<!-- /MODULE Home Featured Products -->



Also I want to hide the 'shopping cart' on the home page and every other page please.

Any help much appreciated.

Link to comment
Share on other sites

Change:

{if ($product.quantity > 0 OR $product.allow_oosp) AND $product.customizable != 2}
{l s='Add to cart' mod='homefeatured'}
{else}
{l s='Add to cart' mod='homefeatured'}
{/if}



to:

<a href="{$base_dir_ssl}contact-form.php?product_name={$product.name}" class="exclusive">{l s='Contact us'}

Link to comment
Share on other sites

Hi,

Great, that has cleared that up and the only other elements that I need to remove is 'quantity' if anyone can point me in the direction of where to remove this from please?

Just as a side note I have already disabled "Enable stock management", however, quanityt still shows up against each product form someone to enter before purchase.

Also I entered 0 under “Display last quantities when qty is lower than” on the Preferences > Products tab; however, it still shows up.

Thanks

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 years later...
  • 3 weeks later...
  • 1 month later...

what about adding "Contact Us" button along with "Add to Cart" ?

 

I tried this in product.tpl in theme dir:

 

original:

{else}

<p id="add_to_cart" class="buttons_bottom_block">
 <span></span>
 <input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive"/>
</p>

  {/if}

 

modified:

{else}

<p id="add_to_cart" class="buttons_bottom_block">
 <span></span>
 <input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive"/>
</p>

<p id="add_to_cart" class="buttons_bottom_block">
 <span></span>
 <a href="{$base_dir_ssl}contact-form.php?product_name={$product->name}" class="exclusive">{l s='Contact Us'}
</p>  

  {/if}

 

(just another <p>), but this added "Contact Us" button on every div below...

 

PS 1.5.x

Edited by mayekk (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...