Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

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

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-02-2011, 08:45 AM
 
Aristos Aristos is offline
 

Newbie
  
Join Date: Sep 2011
Posts: 4
 

Exclamation Urgent! How to change "add-to-cart" to "contact us" if price is 0

Hello All,

it would be nice if somebody could help me.

For some products at our site it is forbidden to display the pricing.
Is it in this case possible to change the "add-to-cart" button to "contact us" and to redict the customer to the contact form?

Our x-cart is 4.4.3.

Thanks a lot.

Sincerely,
Aristos
__________________
X-Cart 4.4.3
Reply With Quote
  #2  
Old 11-02-2011, 09:28 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

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

I haven't played with this in quite awhile but in earlier versions of x-cart if you gave a product a price of $0.00 it would display "Call for Price". I can't remember if it still displayed the "add to cart" button or not (I don't think it should).

Anyway, you should be able to use the "price = $0.00" part of the code to display the "ask a question about this product" link in the product details using a if/else routine.

http://forum.x-cart.com/showthread.php?t=61432 discusses hiding the "add to cart" button.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #3  
Old 11-02-2011, 08:38 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

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

More information in this thread: http://forum.x-cart.com/showthread.php?t=45694

In default cart, if you set a price to 0 - the customer will be asked to enter their own price - so that needs to be modified if you go that route.


---
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #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

The following user thanks Aristos for this useful post:
JWait (11-12-2011)
  #5  
Old 11-12-2011, 07:47 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

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

Not that I have any need for this but its possible someone else might. After putting in all your work its nice of you to share it.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:24 PM.

   

 
X-Cart forums © 2001-2020