Jump to content

Discount orderpaymenttermannually but not on webhosting products


Recommended Posts

Hi,

I want to give discount on server products and do this via the langue file :

$_LANG['orderpaymenttermannually'] = "Jaarlijks excl. BTW - 8% korting";
$_LANG['orderpaymenttermbiennially'] = "Tweejaarlijks excl. BTW - 10% korting";
$_LANG['orderpaymenttermtriennially'] = "Driejaarlijks excl. BTW - 12% korting";

and reduce the price in % via product pricing.

But the problem is webhosting use the same names orderpaymenttermannually, orderpaymenttermbiennially etc and the discount an i don't wont any discount at webhosting products how i can solved this issue?

 

Edited by Oxzhot
Link to comment
Share on other sites

I'm sorry but I don't really understand what you are trying to do. Try asking with as many details as possible what you are trying to accomplish.

If you want to use something else for a word in your templates, you can do this. Just add it them to the language files with what ever word you like and then you can use that LANG var in your smarty templates. You don't need to use the same naming as WHMCS uses.

Link to comment
Share on other sites

15 minutes ago, yggdrasil said:

I'm sorry but I don't really understand what you are trying to do.

I can - he's trying to change the text if it's a server product, but finding that it's changing too if it's a hosting product.

I would be inclined not to do what you're doing the way you're trying to - though I suspect you could do it using a hook to rewrite those language strings if you really had to.

Link to comment
Share on other sites

Hi,

Sorry that i'm not clear guys.

Ok what i want to do is give discount at server products but not on webhosting products. I thought to found an easy fix for this via the langue file but this doesn't work because webhosting products use the same
$_LANG['orderpaymenttermannually'] = "Jaarlijks excl. BTW - 8% korting";
$_LANG['orderpaymenttermbiennially'] = "Tweejaarlijks excl. BTW - 10% korting";
$_LANG['orderpaymenttermtriennially'] = "Driejaarlijks excl. BTW - 12% korting";

Is there an way to do this?

Link to comment
Share on other sites

On 06/07/2020 at 10:18, Oxzhot said:

Ok what i want to do is give discount at server products but not on webhosting products. I thought to found an easy fix for this via the language file but this doesn't work because webhosting products use the same

where are you trying to do this - on the products page or view cart ?

either way, whilst you could easily use a hook to change the language strings, it's not really practical because either page could have both webhosting and server products in them and it would be difficult to differentiate between them.

you could do it by editing either template as it's just an if statement to determine whether it's a hosting or server product and then display the appropriate string.

Link to comment
Share on other sites

On 7/9/2020 at 3:53 PM, brian! said:

where are you trying to do this - on the products page or view cart ?

either way, whilst you could easily use a hook to change the language strings, it's not really practical because either page could have both webhosting and server products in them and it would be difficult to differentiate between them.

you could do it by editing either template as it's just an if statement to determine whether it's a hosting or server product and then display the appropriate string.

Hi Brian,

Do you have an example from that?
Here an list what i want to do:

Products:

Webhosting plan 1
Webhosting plan 2
Webhosting plan 3

Payment period:
orderpaymenttermannually no % discount.
orderpaymenttermbiennially 5% discount.
orderpaymenttermtriennially 10% discount

--------------------------------------------------------------------------

Products:

VPS 1
VPS 2
VPS 3

Payment period:
orderpaymenttermmonthly no % discount.
orderpaymenttermquarterly 2% discount
orderpaymenttermsemiannually 5% discount
orderpaymenttermannually 8% discount
orderpaymenttermbiennially 10% discount
orderpaymenttermtriennially 12% discount

--------------------------------------------------------------------------

 

Products:

Dedicated Server 1
Dedicated Server 2
Dedicated Server 3

Payment period:
orderpaymenttermmonthly no % discount.
orderpaymenttermquarterly 2% discount
orderpaymenttermsemiannually 5% discount
orderpaymenttermannually 8% discount
orderpaymenttermbiennially 10% discount
orderpaymenttermtriennially 12% discount

Link to comment
Share on other sites

15 hours ago, brian! said:

on what page? the products page where the products are initially listed, the configureproduct page where the user can choose the billing cycle or on view cart ??

Hi Brian,

Yes at the configureproduct page :).

Link to comment
Share on other sites

{if $pricing.triennially}
	<option value="triennially"{if $billingcycle eq "triennially"} selected{/if}>
		{$pricing.triennially} {if $productinfo.gid|in_array:['1','2']}12% {$LANG.orderdiscount}{elseif $productinfo.gid eq 3}10% {$LANG.orderdiscount}{/if}
	</option>
{/if}

kFP4sT9.png

assuming webhosting (3), vps (2) and ds (1) are all separate product groups, the above code says that if it's triennial, the current product is in product group 1 or 2, then it says 12% discount, if group '3, then it says 10%.... for any other product group, it does nothing... then it's just a case of working through the other billing cycles.

you could do this for products rather than groups - it just complicates the coding whether in the template or as a hook.

Link to comment
Share on other sites

  • 3 weeks later...
On 7/16/2020 at 7:03 PM, brian! said:

{if $pricing.triennially}
	<option value="triennially"{if $billingcycle eq "triennially"} selected{/if}>
		{$pricing.triennially} {if $productinfo.gid|in_array:['1','2']}12% {$LANG.orderdiscount}{elseif $productinfo.gid eq 3}10% {$LANG.orderdiscount}{/if}
	</option>
{/if}

kFP4sT9.png

assuming webhosting (3), vps (2) and ds (1) are all separate product groups, the above code says that if it's triennial, the current product is in product group 1 or 2, then it says 12% discount, if group '3, then it says 10%.... for any other product group, it does nothing... then it's just a case of working through the other billing cycles.

you could do this for products rather than groups - it just complicates the coding whether in the template or as a hook.

Thank you Brian! it works perfect.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated