X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Remove Buy Now button. (https://forum.x-cart.com/showthread.php?t=62507)

denisgre 02-01-2012 08:24 AM

Remove Buy Now button.
 
Can't seem to find anything in searches that is relevent.

Version 4.4.3.

For various reasons we need to price a product as ё0 and ask customers to phone for a price. When priced as ё0 though it asks the customer to name their own price and shows the buy now button. Does anyone know how to prevent this and what file to edit. We basically want a "if price = 0 then don't show button". Changing the labels was done easily.

See http://www.mercersfurniture.co.uk/home.php?cat=526 as example.

Thanks.

Denis.

gb2world 02-01-2012 11:15 AM

Re: Remove Buy Now button.
 
http://forum.x-cart.com/showthread.php?p=254207

---

denisgre 02-01-2012 01:20 PM

Re: Remove Buy Now button.
 
Thanks, I saw that one but it's refering to the old v4.1.x and v4.4.3 code looks nothing like that. We only want to show the buy now button anywhere, product list or product areas, if the product value is >ё0.00. Changing the messages by editing the labels was simple, but how do we turn off the buy now button?

Denis.

cflsystems 02-01-2012 01:47 PM

Re: Remove Buy Now button.
 
You can use an if statement to hide the button, like

{if $product.price gt 0}
show buy button code
{else}
call for price
{/if}

denisgre 02-13-2012 06:59 AM

Re: Remove Buy Now button.
 
Thanks for that, worked a treat:-) .

The hardest part is knowing just where to put the code.

I have removed the "Buy Now" button on product lists where the price is ё0.00 and replaced it with CALL FOR PRICES instead.

I have also removed "Add to cart" button in the product details pages for zero priced items and used the same message.

In the /skin/custom_scheme/customer/main/product_details.tpl file:
(The added bits are in red text. The other is part of the standard file and should not be removed):

{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.price gt 0}

{include file="customer/buttons/add_to_cart.tpl" type="input" additional_button_class="main-button"}

{else}
<font color="red" size="2"><b>CALL FOR PRICES</b></font><br><br>
{/if}


In the /skin/common_files/customer/buttons/buy_now.tpl file:

{if $product.price gt 0}
{include file="customer/buttons/button.tpl" button_title=$lng.lbl_buy_now additional_button_class=$additional_button_class|c at:' add-to-cart-button'}
{else}
<font color="red" size="2"><b>CALL FOR PRICES</b></font><br><br>
{/if} {* END TEST *}


I have included the above for anyone using V4.4.3 who may have the same enquiry. Ours is a customised site so the file shown above in the custom_scheme folder will probably be in the scheme folder for the site.

Hope this helps.

Denis.


sauve001 04-20-2012 11:17 AM

Re: Remove Buy Now button.
 
We have tried to impliment a similar type of system but with the difference that it's based on user being logged in and being of a set membership level..
but I've tried accessing membershipId different ways with no success..
{$user_account["membershipid"]}
$userinfo.membershipid

always returns 0 !

using version 4.4

cherie 04-24-2012 12:40 PM

Re: Remove Buy Now button.
 
Correct, it is not present. Add this towards the bottom of include/check_useraccount.php:
Code:

$smarty->assign('user_membershipid',$user_account['membershipid']);
The smarty variable will be {$user_membershipid}.

vickis 07-29-2012 05:19 AM

Re: Remove Buy Now button.
 
I would like to do this based on a specific category (our freebies category - cat=287) in addition to the 'gt 0' price.

Any help on the code for this would be extremely helpful and much appreciated!

K-VAR 11-01-2012 05:06 PM

Re: Remove Buy Now button.
 
Quote:

Originally Posted by cherie
Correct, it is not present. Add this towards the bottom of include/check_useraccount.php:
Code:

$smarty->assign('user_membershipid',$user_account['membershipid']);
The smarty variable will be {$user_membershipid}.


Has anything changed in Version 4.5.3?

We are modifying as suggested above, but there is still no data in the smarty tag.

Is there any particular place in the PHP file that the assignment line needs to be added?

Thank you

Dawn Howard 01-14-2014 11:39 AM

Re: Remove Buy Now button.
 
Thanks for this Denis! Would the code:

{if $product.price gt 0}

change at all for american dollars? I'm not sure if your "gt" represents your currency.

Thanks in advance!


Quote:

Originally Posted by denisgre
Thanks for that, worked a treat:-) .

The hardest part is knowing just where to put the code.

I have removed the "Buy Now" button on product lists where the price is ё0.00 and replaced it with CALL FOR PRICES instead.

I have also removed "Add to cart" button in the product details pages for zero priced items and used the same message.

In the /skin/custom_scheme/customer/main/product_details.tpl file:
(The added bits are in red text. The other is part of the standard file and should not be removed):

{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.price gt 0}

{include file="customer/buttons/add_to_cart.tpl" type="input" additional_button_class="main-button"}

{else}
<font color="red" size="2"><b>CALL FOR PRICES</b></font><br><br>
{/if}


In the /skin/common_files/customer/buttons/buy_now.tpl file:

{if $product.price gt 0}
{include file="customer/buttons/button.tpl" button_title=$lng.lbl_buy_now additional_button_class=$additional_button_class|c at:' add-to-cart-button'}
{else}
<font color="red" size="2"><b>CALL FOR PRICES</b></font><br><br>
{/if} {* END TEST *}


I have included the above for anyone using V4.4.3 who may have the same enquiry. Ours is a customised site so the file shown above in the custom_scheme folder will probably be in the scheme folder for the site.

Hope this helps.

Denis.



qualiteam 01-14-2014 10:25 PM

Re: Remove Buy Now button.
 
Quote:

Originally Posted by Dawn Howard
Thanks for this Denis! Would the code:

{if $product.price gt 0}

change at all for american dollars? I'm not sure if your "gt" represents your currency.


It won't change: "gt" means "greater". I.e. the line means "if the product price is greater than zero".

WilpackPackaging 02-06-2014 01:07 PM

Re: Remove Buy Now button.
 
Any chance someone has done this on 4.6.X?

Petepots 03-05-2014 01:25 PM

Re: Remove Buy Now button.
 
Eric

Try commenting out on
Skin\common_files\customer\buttons\buy_now.tbl, that stopped it showing on product lists

Peter


All times are GMT -8. The time now is 12:20 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.