Jump to content

Always show lowest price


Razva

Recommended Posts

16 minutes ago, Razva said:

Unfortunately WHMCS shows the highest price (monthly) when listing Products.

to be more accurate, it shows the smallest (in terms of time) available billing cycle for a product - could be monthly, annually etc but bears no relation to the actual cost for each cycle.

18 minutes ago, Razva said:

Any way to fix/workaround this?

not from the settings - you're looking at editing the template and/or using a hook to do this... and output method would depend on the orderform template choice.

at it's most basic, if you *know* that your Triennial prices are going to be the cheapest, you could edit the template (i'm going to assume Standard_cart) and change...

<span class="price">{$product.pricing.minprice.price}</span>

to...

<span class="price">{$product.pricing.triennially}</span>

and that would show the Triennial price on the opening products page (you'll have to remove the {if} block that follows it too).

7PwjRua.png

or you could loop the cycles array in reverse order and show all available cycles..

qlscx8R.png

I have to say that the above isn't practical though - it would work fine in English, but you'd run into all sorts of alignment issues in other languages.

i've previously posted code to do this as a dropdown in other templates...

 

yRYQcMU.png

if you *really* want to show the cheapest price, then you'd have to loop through the pricing array for each product, work out the equivalent monthly cost for each cycle, find the lowest of them and then output that price.. and probably pass it to the button too so that it is passed to the next step of the order process... you'd then have to repeat the process on the dropdown at the configureproduct stage too... you could either do it all in the templates using Smarty, or you could use a hook to take care of the calculations part - but I suspect there would need to be some template modification whether you use a hook or not.

Link to comment
Share on other sites

Thank you very much for your in-depth reply!

My problem with {$product.pricing.triennially} is that it will show the entire price per 3 years, not the "triennially monthly price".

The end-game would be to show this

2018-10-19_18-10-27.png.b6ebdfe8bca7c51f6f62a0ca5b4d4bc9.png

instead of this

2018-10-19_18-07-39.png.3c18b483b3cbca786974bb8f01effa4a.png

Yes, I am sure that the triennially price will be the smallest one for this product category. The problem is that other (more expensive) products will not have triennially pricing. For those I should post quarterly or whatever is the biggest period. I don't have any products that are more expensive quarterly/annually/triennially compared with monthly.

Long story short I need to show the monthly price for the biggest existing term, even if that is quarterly or triennially.

Link to comment
Share on other sites

9 minutes ago, Razva said:

My problem with {$product.pricing.triennially} is that it will show the entire price per 3 years, not the "triennially monthly price".

the following would show the monthly price for the first priced cycle in finds (in reverse order - starting with Triennially)...

<span class="price">{if $product.pricing.triennially}{$currency.prefix}{(($product.pricing.rawpricing.triennially)/36)|string_format:"%.2f"}{$currency.suffix}{elseif $product.pricing.biennially}{$currency.prefix}{(($product.pricing.rawpricing.triennially)/24)|string_format:"%.2f"}{$currency.suffix}{elseif $product.pricing.annually}{$currency.prefix}{(($product.pricing.rawpricing.annually)/12)|string_format:"%.2f"}{$currency.suffix}{elseif $product.pricing.semiannually}{$currency.prefix}{(($product.pricing.rawpricing.semiannually)/6)|string_format:"%.2f"}{$currency.suffix}{elseif $product.pricing.quarterly}{$currency.prefix}{(($product.pricing.rawpricing.quarterly)/3)|string_format:"%.2f"}{$currency.suffix}{elseif $product.pricing.monthly}{$currency.prefix}{$product.pricing.rawpricing.monthly}{$currency.suffix}{/if}</span>
<br />{$LANG.orderpaymenttermmonthly}
23 minutes ago, Razva said:

The end-game would be to show this

if you mean a dropdown, you'd certainly have to alter the template divs to allow for this - if you just mean the amount, then the above code should do that.

36 minutes ago, Razva said:

Yes, I am sure that the triennially price will be the smallest one for this product category. The problem is that other (more expensive) products will not have triennially pricing. For those I should post quarterly or whatever is the biggest period. I don't have any products that are more expensive quarterly/annually/triennially compared with monthly. 

Long story short I need to show the monthly price for the biggest existing term, even if that is quarterly or triennially. 

hopefully the above code will do that for you. thanks.png

Link to comment
Share on other sites

  • 2 weeks later...

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