View Single Post
  #4  
Old 11-03-2011, 04:58 PM
 
Aristos Aristos is offline
 

Newbie
  
Join Date: Sep 2011
Posts: 4
 

Default Re: Urgent! How to change "add-to-cart" to "contact us" if price is 0

Ok, after hours of searching and testing of the tpl.files I found the solutions.
Note: This may only work for Version 4.4.3.

I changed the lbls (admin area/languages/english/labels) for "enter your own price" to "Request Quote" amd the "enter your own price note" with a linked contact message.

Then I hide the add-to-cart button at the product_details.tpl , in red are the added changes:
product_details.tpl Line 210 and 212:

Code:
{if $product.appearance.buy_now_buttons_enabled} {if $product.forsale ne "B"} <ul class="simple-list"> <li> <div class="buttons-row buttons-auto-separator"> {if $product.taxed_price ne 0} {include file="customer/buttons/add_to_cart.tpl" type="input" additional_button_class="main-button detail"} {/if}

Then I hide also the following things at product_details.tpl:
Changes to hide "OUR PRICE" and "box" if price is 0
product_details.tpl Line 66 and 81:

Code:
<tr> {if $product.taxed_price ne 0} <td class="property-name product-price" {if $product.appearance.has_market_price and $product.appearance.market_price_discount gt 0}colspan="2"{else}colspan="3"{/if}> <div class="prices-block"> {$lng.lbl_our_price}: {if $product.taxed_price ne 0 or $variant_price_no_empty} <span class="product-price-value">{currency value=$product.taxed_price tag_id="product_price"}</span> <span class="product-market-price">{alter_currency value=$product.taxed_price tag_id="product_alt_price"}</span> {if $product.taxes} <br /><span class="product-taxed-price">{include file="customer/main/taxed_price.tpl" taxes=$product.taxes}</span> {/if} {else} <input type="text" size="7" name="price" /> {/if} </div> </td> {/if}

Afterwords I hide the "Quantity Text and box" at product_details.tpl

product_details.tpl Line 111 and 190:

Code:
{if $product.taxed_price ne 0} <tr class="quantity-row"> {if $product.appearance.empty_stock and ($variants eq '' or ($variants ne '' and $product.avail le 0))} <td class="property-name product-input sm" colspan="3">{$lng.lbl_quantity} <script type="text/javascript"> //<![CDATA[ var min_avail = 1; var avail = 0; var product_avail = 0; //]]> </script> <strong>{$lng.txt_out_of_stock}</strong> </td> {elseif not $product.appearance.force_1_amount and $product.forsale ne "B"} <td class="property-name product-input sm" colspan="3"> {if $config.Appearance.show_in_stock eq "Y" and not $product.appearance.quantity_input_box_enabled and $config.General.unlimited_products ne 'Y'} {$lng.lbl_quantity_x|substitute:quantity:$product.avail} {else} {$lng.lbl_quantity} {/if} &nbsp;&nbsp; <span class="property-value"> <script type="text/javascript"> //<![CDATA[ var min_avail = {$product.appearance.min_quantity|default:1}; var avail = {$product.appearance.max_quantity|default:1}; var product_avail = {$product.avail|default:"0"}; //]]> </script> <input type="text" id="product_avail_input" name="amount" maxlength="11" size="6" onchange="javascript: return check_quantity_input_box(this);" value="{$smarty.get.quantity|default:$product.appearance.min_quantity}"{if not $product.appearance.quantity_input_box_enabled} disabled="disabled" style="display: none;"{/if}/> {if $product.appearance.quantity_input_box_enabled and $config.Appearance.show_in_stock eq "Y" and $config.General.unlimited_products ne 'Y'} <span id="product_avail_text" class="quantity-text">{$lng.lbl_product_quantity_from_to|substitute:"min":$product.appearance.min_quantity:"max":$product.avail}</span> {/if} <select id="product_avail" name="amount"{if $active_modules.Product_Options ne '' and ($product_options ne '' or $product_wholesale ne '')} onchange="javascript: check_wholesale(this.value);"{/if}{if $product.appearance.quantity_input_box_enabled} disabled="disabled" style="display: none;"{/if}> <option value="{$product.appearance.min_quantity}"{if $smarty.get.quantity eq $product.appearance.min_quantity} selected="selected"{/if}>{$product.appearance.min_quantity}</option> {if not $product.appearance.quantity_input_box_enabled} {section name=quantity loop=$product.appearance.loop_quantity start=$product.appearance.min_quantity} {if %quantity.index% ne $product.appearance.min_quantity} <option value="{%quantity.index%}"{if $smarty.get.quantity eq %quantity.index%} selected="selected"{/if}>{%quantity.index%}</option> {/if} {/section} {/if} </select> </span> </td> {else} <td class="property-name product-input sm" colspan="3">{$lng.lbl_quantity} <script type="text/javascript"> //<![CDATA[ var min_avail = 1; var avail = 1; var product_avail = 1; //]]> </script> <span class="product-one-quantity">1</span> <input type="hidden" name="amount" value="1" /> {if $product.distribution ne ""} {$lng.txt_product_downloadable} {/if} </td> {/if} </tr> {/if}

Finally, I also hide the "buy now" botton for e.g. the product list under a category or for search results.

products_list.tpl

Code:
{if $active_modules.Product_Configurator and $is_pconf and $current_product} {include file="modules/Product_Configurator/pconf_add_form.tpl"} {elseif $product.appearance.buy_now_enabled and $product.product_type ne "C"} {if $login ne ""} {include_cache file="customer/main/buy_now.tpl" product=$product cat=$cat featured=$featured is_matrix_view=$is_matrix_view login="1" smarty_get_cat=$smarty.get.cat smarty_get_page=$smarty.get.page smarty_get_quantity=$smarty.get.quantity} {else} {if $product.taxed_price ne 0} {include_cache file="customer/main/buy_now.tpl" product=$product cat=$cat featured=$featured is_matrix_view=$is_matrix_view login="" smarty_get_cat=$smarty.get.cat smarty_get_page=$smarty.get.page smarty_get_quantity=$smarty.get.quantity} {/if} {/if}

Please note: If you already made some other changes at that tpl.files, the given line-numbers won't be identical. Just search for the comments.

I hope this will help, once I spent many hours to figure it out.

Kind Regards
__________________
X-Cart 4.4.3
Reply With Quote