Razva Posted October 19, 2018 Share Posted October 19, 2018 Hello, We, as most providers, offer the best price for Triennially payments, Monthly payments having the highest cost. Unfortunately WHMCS shows the highest price (monthly) when listing Products. Any way to fix/workaround this? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 19, 2018 Share Posted October 19, 2018 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). or you could loop the cycles array in reverse order and show all available cycles.. 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... 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. 0 Quote Link to comment Share on other sites More sharing options...
Razva Posted October 19, 2018 Author Share Posted October 19, 2018 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 instead of this 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. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 19, 2018 Share Posted October 19, 2018 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. 1 Quote Link to comment Share on other sites More sharing options...
Razva Posted November 1, 2018 Author Share Posted November 1, 2018 @brian! thank you very, very, much! This solved my problem. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.