Jump to content

Recommended Posts

15 hours ago, indy0077 said:

The only issue is, that it shows nothing if a product has a "One Time" price or is "Free".

forgive the indentation in the code, but it made it easier for me to read and adjust...

{if $DiscountCenterAddonIsActive}
	<div class="price">
		{$product.pricing.minprice.price}
		{if $product.pricing.type eq "recurring"}
			<span class="price-cycle">/
				{if $product.pricing.minprice.cycle eq "monthly"}
					{$LANG.pricingCycleShort.monthly}
				{elseif $product.pricing.minprice.cycle eq "quarterly"}
					{$LANG.pricingCycleShort.quarterly}
				{elseif $product.pricing.minprice.cycle eq "semiannually"}
					{$LANG.pricingCycleShort.semiannually}
				{elseif $product.pricing.minprice.cycle eq "annually"}
					{$LANG.pricingCycleShort.annually}
				{elseif $product.pricing.minprice.cycle eq "biennially"}
					{$LANG.pricingCycleShort.biennially}
				{elseif $product.pricing.minprice.cycle eq "triennially"}
					{$LANG.pricingCycleShort.triennially}
				{/if}
			</span>
		{/if}
	</div>
{elseif $product.pricing.type eq "free"}
	<div class="price">
		<span>{$LANG.orderfree}</span>
	</div>
{elseif $product.pricing.type eq "onetime"}
	<div class="price">
		<span>{$product.pricing.minprice.price} {$LANG.orderpaymenttermonetime}</span>
	</div>		
{else}
	<div class="package-starting-from ">{$LANG.startingat}</div>
	<div class="price">
		{if $product.pricing.rawpricing.triennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.triennially/36)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.biennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.biennially/24)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.annually neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.annually/12)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{else}{$product.pricing.minprice.cycleText}
		{/if}
	</div>
{/if}

 

Share this post


Link to post
Share on other sites

You just have to modify the template files

If you want the annual bill cycle displayed monthly that's how it's done.

($product.pricing.rawpricing.annually/12)

It can also be done as follows

($product.pricing.rawpricing.biannually/24)

($product.pricing.rawpricing.triannually/36)

I hope I understood your question.

Share this post


Link to post
Share on other sites
9 hours ago, weelow said:

You just have to modify the template files

If you want the annual bill cycle displayed monthly that's how it's done.

($product.pricing.rawpricing.annually/12)

It can also be done as follows

($product.pricing.rawpricing.biannually/24)

($product.pricing.rawpricing.triannually/36)

I hope I understood your question.

Hi, this has been fixed now with Brian's help. I don't use a 'standard template' but a custom one. Anyway thank you.

Share this post


Link to post
Share on other sites
Posted (edited)

Hi Brian.

Unfortunately one more (and the same problem), on my homepage. How can I add your code:

{elseif $product.pricing.type eq "free"}
	<div class="price">
		<span>{$LANG.orderfree}</span>
	</div>
{elseif $product.pricing.type eq "onetime"}
	<div class="price">
		<span>{$product.pricing.minprice.price} {$LANG.orderpaymenttermonetime}</span>
	</div>		
{else}
	<div class="package-starting-from ">{$LANG.startingat}</div>
	<div class="price">
		{if $product.pricing.rawpricing.triennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.triennially/36)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.biennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.biennially/24)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.annually neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.annually/12)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{else}{$product.pricing.minprice.cycleText}
		{/if}
	</div>

in my homepage code?

<div class="package-price">
									<div class="package-starting-from ">{$LANG.startingat}</div>
									<div class="price"> <span class="price-prefix">{$WHMCSCurrency.prefix}</span>{$homepage->productGroup($product.gid)->price}{$WHMCSCurrency.suffix}
										{if $homepage->productGroup($product.gid)->billing eq 'free'}
										{else}<span class="price-cycle">{if $homepage->productGroup($product.gid)->billing eq "monthly"}/{$rslang->trans('order.period.short.monthly')}
										{elseif $homepage->productGroup($product.gid)->billing eq "quarterly"}/{$rslang->trans('order.period.short.quarterly')}
										{elseif $homepage->productGroup($product.gid)->billing eq "semiannually"}/{$rslang->trans('order.period.short.semiannually')}
										{elseif $homepage->productGroup($product.gid)->billing eq "annually"}/{$rslang->trans('order.period.short.annually')}
										{elseif $homepage->productGroup($product.gid)->billing eq "biennially"}/{$rslang->trans('order.period.short.biennially')}
										{elseif $homepage->productGroup($product.gid)->billing eq "triennially"}/{$rslang->trans('order.period.short.triennially')}
										{/if}</span> {/if} </div>
								</div>

Thanks.

Edited by indy0077

Share this post


Link to post
Share on other sites

have you tried throwing a {debug} into the template to see what variables and arrays are available to you ? ideally, you're looking for a onetime or free value in a product.

the problem for me here is that you have custom arrays, I don't know the code generating them and i've got no idea what exists to work with! 😕

Share this post


Link to post
Share on other sites
5 minutes ago, brian! said:

have you tried throwing a {debug} into the template to see what variables and arrays are available to you ? ideally, you're looking for a onetime or free value in a product.

the problem for me here is that you have custom arrays, I don't know the code generating them and i've got no idea what exists to work with! 😕

Here is the homepage tpl.

homepage.tpl

Share this post


Link to post
Share on other sites

it's possible the hook/feature only returns the monthly price - though using {debug} to see what's available in the array would give you the answer to that... this is entirely a Lagom feature... feel free to PM me the html of the debug popup window and the solution might become obvious to me.... or setup a Lagom dev with this and let me have access to that.

the $0.00 -> Free situation should be easily fixable, the other two will be dependent on what's available to the array... I could write a hook to pull any price from the db and make it available to the homepage, or as a last resort, you could always use a data feed to inject these prices where appropriate... but it's easier for you to find out what's available to that array before we overcomplicate any solution.

Share this post


Link to post
Share on other sites
3 hours ago, brian! said:

though using {debug} to see what's available in the array...

I'm sorry, but "here" I'm realy lost... My "php skills" are of a 5 year old boy 😁

Share this post


Link to post
Share on other sites
14 hours ago, brian! said:

it's possible the hook/feature only returns the monthly price - though using {debug} to see what's available in the array would give you the answer to that... this is entirely a Lagom feature... feel free to PM me the html of the debug popup window and the solution might become obvious to me.... or setup a Lagom dev with this and let me have access to that.

the $0.00 -> Free situation should be easily fixable, the other two will be dependent on what's available to the array... I could write a hook to pull any price from the db and make it available to the homepage, or as a last resort, you could always use a data feed to inject these prices where appropriate... but it's easier for you to find out what's available to that array before we overcomplicate any solution.

PM SENT! Thanks

Share this post


Link to post
Share on other sites

When you put {debug} in your template do you see $product in the variable pop up window?

if not then it means you can't use it because it is not there. So you can do this in two ways.

1. Via hook (little hard)

you need to create a hook that gets your desired products from the database and put them in an array then pick it up from the template. And make sure when you debug you find it there.

2. Via template

just create a product group called homepage. and a new product template in your order forms and name the folder homepage. Edit product.tpl as you see fit, go to the product group and find the link for it and use the .haccess file to rewrite your homepage address to that product group page. You can also edits the products.tpl file so that the products loaded have a learn more instead of order now you can duplicate any product from any product group. The learn more should like to that product group page so user can buy it.

If you need in depth help I can guide you step by step till you get there.

good luck

Share this post


Link to post
Share on other sites
2 minutes ago, weelow said:

if not then it means you can't use it because it is not there.

not necessarily true - that are variables you can use in a template that won't be listed in a {debug} window.

5 minutes ago, weelow said:

So you can do this in two ways.

more than 2. 🙂

6 minutes ago, weelow said:

just create a product group called homepage. and a new product template in your order forms and name the folder homepage. Edit product.tpl as you see fit, go to the product group and find the link for it and use the .haccess file to rewrite your homepage address to that product group page. You can also edits the products.tpl file so that the products loaded have a learn more instead of order now you can duplicate any product from any product group. The learn more should like to that product group page so user can buy it.

that's a very long-winded path when the only thing missing from the current solution are three specific product prices.🙄

Share this post


Link to post
Share on other sites
Posted (edited)
18 minutes ago, brian! said:

not necessarily true - that are variables you can use in a template that won't be listed in a {debug} window.

more than 2. 🙂

that's a very long-winded path when the only thing missing from the current solution are three specific product prices.🙄

Hi Brian, did the debug file help I sent to you? Would it be possible to fix it? Thanks

Edited by indy0077

Share this post


Link to post
Share on other sites
4 minutes ago, indy0077 said:

Hi Brian, did the debug file helped I sent to you?

not immediately - what I hoped to see isn't shown in the debug window (as they're objects)...

8 minutes ago, indy0077 said:

Would it be possible to fix it?

oh fixing it isn't the problem - it's definitely fixable, it's just a case of working out whether to try to make it work in the template (and for that i'd ideally need to know what's available to the $homepage object and the Lagom docs gives nothing away on that score from what i've read), or I  write a hook to pull prices from the database... or use feeds (though for your purpose I suspect the feed coding would have to be tweaked).

the "free" issue might just be a case of changing...

									<div class="price"> <span class="price-prefix">{$WHMCSCurrency.prefix}</span>{$homepage->productGroup($product.gid)->price}{$WHMCSCurrency.suffix}
										{if $homepage->productGroup($product.gid)->billing eq 'free'}
										{else}<span class="price-cycle">{if $homepage->productGroup($product.gid)->billing eq "monthly"}/{$rslang->trans('order.period.short.monthly')}
										{elseif $homepage->productGroup($product.gid)->billing eq "quarterly"}/{$rslang->trans('order.period.short.quarterly')}
										{elseif $homepage->productGroup($product.gid)->billing eq "semiannually"}/{$rslang->trans('order.period.short.semiannually')}
										{elseif $homepage->productGroup($product.gid)->billing eq "annually"}/{$rslang->trans('order.period.short.annually')}
										{elseif $homepage->productGroup($product.gid)->billing eq "biennially"}/{$rslang->trans('order.period.short.biennially')}
										{elseif $homepage->productGroup($product.gid)->billing eq "triennially"}/{$rslang->trans('order.period.short.triennially')}
										{/if}</span> {/if} </div>

to...

<div class="price">
  	{if $homepage->productGroup($product.gid)->price eq '0.00'}
		{$LANG.orderfree}
	{else}
		<span class="price-prefix">{$WHMCSCurrency.prefix}</span>
		{if $homepage->productGroup($product.gid) eq '3'}
  			(*do something*}
  		{else}
			{$homepage->productGroup($product.gid)->price}{$WHMCSCurrency.suffix}
		{/if}
		{if $homepage->productGroup($product.gid)->billing eq 'free'}
		{else}<span class="price-cycle">/{$rslang->trans('order.period.short.monthly')}</span>
  		{/if}
	{/if}
</div>

the price shown for dedicated servers should be irrelevant for now as they're the same for all billing cycles - so the homepage using the monthly price will work for now.

the VPS pricing is an issue because it's pulling the monthly price and not the triennial price / 36.... i'm going to assume the homepage object only returns the monthly price, so that leaves a handful of options... one being to manipulate the homepage object to contain the correct prices; using a hook to get the triennial price of a VPS product, divide it by 36 and return it without currency formatting to the template... or use a data feed.... either of the last two options are still going to involve edits to the template.

actually, the simplest solution by far would be to drop using the Lagom specific code and rewrite a hook from scratch to create an appropriate array - but as we now only need one value, let's not do that unless we really need to.

so for VPS, all you should now need to do is replace {*do something*} in the above code with other code - pulling a value from the database is easy and we'll do it if we have to, but for flexibility, let's use a data feed.

		{if $homepage->productGroup($product.gid) eq '3'}
			<script language="javascript" src="feeds/indyproductsinfo.php?pid=101&get=price&billingcycle=triennially&currency=1"></script>
  		{else}

indyproductinfo.php is a quickly modified version of the default productsinfo feed, and it now divides triennial prices by 36 and doesn't return the value in a currency format... i've sent it to you as a PM reply... it would be expandable for other cycles, but i'm taking shortcuts with this solution as i'm assuming that other than the free price, you want to show monthly breakdown prices and that there is a triennial price that is the cheapest... if any of those conditions need to be different, or my guesses in those IF statements are wrong, then it's still fixable - i'm just trying to keep things real simple. 🙂

Share this post


Link to post
Share on other sites

This

<div class="price"> {if $homepage->productGroup($product.gid)->price eq '0.00'}
									{$LANG.orderfree}
									{else} <span class="price-prefix">{$WHMCSCurrency.prefix}</span> {if $homepage->productGroup($product.gid) eq '3'}
									<script language="javascript" src="feeds/indyproductsinfo.php?pid=101&get=price&billingcycle=triennially&currency=1"></script>
									{else}
									{$homepage->productGroup($product.gid)->price}{$WHMCSCurrency.suffix}
									{/if}
									{if $homepage->productGroup($product.gid)->billing eq 'free'}
									{else}<span class="price-cycle">/{$rslang->trans('order.period.short.monthly')}</span> {/if}
									{/if} </div></div>

is now working for replacing the "0,00" to "FREE". That's a good sign.

Screenshot(4).png

Share this post


Link to post
Share on other sites
Just now, indy0077 said:

This


<div class="price"> {if $homepage->productGroup($product.gid)->price eq '0.00'}
									{$LANG.orderfree}
									{else} <span class="price-prefix">{$WHMCSCurrency.prefix}</span> {if $homepage->productGroup($product.gid) eq '3'}
									<script language="javascript" src="feeds/indyproductsinfo.php?pid=101&get=price&billingcycle=triennially&currency=1"></script>
									{else}
									{$homepage->productGroup($product.gid)->price}{$WHMCSCurrency.suffix}
									{/if}
									{if $homepage->productGroup($product.gid)->billing eq 'free'}
									{else}<span class="price-cycle">/{$rslang->trans('order.period.short.monthly')}</span> {/if}
									{/if} </div></div>

is now working for replacing the "0,00" to "FREE". That's a good sign.

Screenshot(4).png

Using the 'indyproductsinfo.php' in feed...

Share this post


Link to post
Share on other sites

  

On 4/8/2020 at 3:25 PM, isixhosting said:

Using the 'indyproductsinfo.php' in feed...

sEiGPFd.jpg

How did you guys fixed this issue as you guys see i can't breakdown the price as yearly or triennially

<div class="price"> <span class="price-prefix">{$WHMCSCurrency.prefix}</span>{$homepage->productGroup($product.gid)->price}{$WHMCSCurrency.suffix}
                                        {if $homepage->productGroup($product.gid)->billing eq 'free'}
                                        {else}<span class="price-cycle">{if $homepage->productGroup($product.gid)->billing eq "monthly"}/{$rslang->trans('order.period.short.monthly')}
                                        {elseif $homepage->productGroup($product.gid)->billing eq "quarterly"}/{$rslang->trans('order.period.short.quarterly')}
                                        {elseif $homepage->productGroup($product.gid)->billing eq "semiannually"}/{$rslang->trans('order.period.short.semiannually')}
                                        {elseif $homepage->productGroup($product.gid)->billing eq "annually"}/{$rslang->trans('order.period.short.annually')}
                                        {elseif $homepage->productGroup($product.gid)->billing eq "biennially"}/{$rslang->trans('order.period.short.biennially')}
                                        {elseif $homepage->productGroup($product.gid)->billing eq "triennially"}/{$rslang->trans('order.period.short.triennially')}
                                        {/if}</span> {/if} </div>
                                </div>

I am changing this codes it doesn't work. 

Share this post


Link to post
Share on other sites
On 5/04/2020 at 5:59 PM, brian! said:

 


{if $DiscountCenterAddonIsActive}
	<div class="price">
		{$product.pricing.minprice.price}
		{if $product.pricing.type eq "recurring"}
			<span class="price-cycle">/
				{if $product.pricing.minprice.cycle eq "monthly"}
					{$LANG.pricingCycleShort.monthly}
				{elseif $product.pricing.minprice.cycle eq "quarterly"}
					{$LANG.pricingCycleShort.quarterly}
				{elseif $product.pricing.minprice.cycle eq "semiannually"}
					{$LANG.pricingCycleShort.semiannually}
				{elseif $product.pricing.minprice.cycle eq "annually"}
					{$LANG.pricingCycleShort.annually}
				{elseif $product.pricing.minprice.cycle eq "biennially"}
					{$LANG.pricingCycleShort.biennially}
				{elseif $product.pricing.minprice.cycle eq "triennially"}
					{$LANG.pricingCycleShort.triennially}
				{/if}
			</span>
		{/if}
	</div>
{elseif $product.pricing.type eq "free"}
	<div class="price">
		<span>{$LANG.orderfree}</span>
	</div>
{elseif $product.pricing.type eq "onetime"}
	<div class="price">
		<span>{$product.pricing.minprice.price} {$LANG.orderpaymenttermonetime}</span>
	</div>		
{else}
	<div class="package-starting-from ">{$LANG.startingat}</div>
	<div class="price">
		{if $product.pricing.rawpricing.triennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.triennially/36)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.biennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.biennially/24)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.annually neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.annually/12)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{else}{$product.pricing.minprice.cycleText}
		{/if}
	</div>
{/if}

 

I need help
1. $currency .prefix not working  in my whmcs v8

2. I am using ModulesGarden Discount Center module. 
If I use original orderforms/standard_cart/product.tpl, the discounted price shown with red mark in product page (picture-1), 

But if I modify the product.tpl with your above mentioned code, then the minimum price (monthly breakdown of triennially) is shown , BUT the Discounted minimum price is NOT shown with red mark in product page (picture-2)  

suppose my price as follows
1 Month Price A$ 12.74 (Regular Price: A$ 14.99)
36 Month Price A$ 9.99 (Regular Price: A$ 12.49)


My modified producr.tpl is 

{include file="orderforms/standard_cart/common.tpl"}

<div id="order-standard_cart">

    <div class="row">

        <div class="pull-md-right col-md-9">

            <div class="header-lined">
                <h1>
                    {if $productGroup.headline}
                        {$productGroup.headline}
                    {else}
                        {$productGroup.name}
                    {/if}
                </h1>
                {if $productGroup.tagline}
                    <p>{$productGroup.tagline}</p>
                {/if}
            </div>
            {if $errormessage}
                <div class="alert alert-danger">
                    {$errormessage}
                </div>
            {elseif !$productGroup}
                <div class="alert alert-info">
                    {lang key='orderForm.selectCategory'}
                </div>
            {/if}
        </div>

        <div class="col-md-3 pull-md-left sidebar hidden-xs hidden-sm">
            {include file="orderforms/standard_cart/sidebar-categories.tpl"}
        </div>

        <div class="col-md-9 pull-md-right">

            {include file="orderforms/standard_cart/sidebar-categories-collapsed.tpl"}

            <div class="products" id="products">
                <div class="row row-eq-height">
                    {foreach $products as $key => $product}
                        <div class="col-md-6">
                            <div class="product clearfix" id="product{$product@iteration}">
                                <header>
                                    <span id="product{$product@iteration}-name">{$product.name}</span>
                                    {if $product.stockControlEnabled}
                                        <span class="qty">
                                            {$product.qty} {$LANG.orderavailable}
                                        </span>
                                    {/if}
                                </header>
                                <div class="product-desc">
                                    {if $product.featuresdesc}
                                        <p id="product{$product@iteration}-description">
                                            {$product.featuresdesc}
                                        </p>
                                    {/if}
                                    <ul>
                                        {foreach $product.features as $feature => $value}
                                            <li id="product{$product@iteration}-feature{$value@iteration}">
                                                <span class="feature-value">{$value}</span>
                                                {$feature}
                                            </li>
                                        {/foreach}
                                    </ul>
                                </div>
                                <footer>
                                    <div class="product-pricing" id="product{$product@iteration}-price">
                                        {if $product.bid}
                                            {$LANG.bundledeal}<br />
                                            {if $product.displayprice}
                                                <span class="price">{$product.displayprice}</span>
                                            {/if}
                                        {else}
                                            {if $product.pricing.hasconfigoptions}
                                                <br />
                                            {/if}
                                          {if $DiscountCenterAddonIsActive}
	<div class="price">
		{$product.pricing.minprice.price}
		{if $product.pricing.type eq "recurring"}
			<span class="price-cycle">/
				{if $product.pricing.minprice.cycle eq "monthly"}
					{$LANG.pricingCycleShort.monthly}
				{elseif $product.pricing.minprice.cycle eq "quarterly"}
					{$LANG.pricingCycleShort.quarterly}
				{elseif $product.pricing.minprice.cycle eq "semiannually"}
					{$LANG.pricingCycleShort.semiannually}
				{elseif $product.pricing.minprice.cycle eq "annually"}
					{$LANG.pricingCycleShort.annually}
				{elseif $product.pricing.minprice.cycle eq "biennially"}
					{$LANG.pricingCycleShort.biennially}
				{elseif $product.pricing.minprice.cycle eq "triennially"}
					{$LANG.pricingCycleShort.triennially}
				{/if}
			</span>
		{/if}
	</div>
{elseif $product.pricing.type eq "free"}
	<div class="price">
		<span>{$LANG.orderfree}</span>
	</div>
{elseif $product.pricing.type eq "onetime"}
	<div class="price">
		<span>{$product.pricing.minprice.price} {$LANG.orderpaymenttermonetime}</span>
	</div>		
{else}
	<div class="package-starting-from ">{$LANG.startingat}</div>
	<div class="price">
		{if $product.pricing.rawpricing.triennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.triennially/36)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.biennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.biennially/24)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.annually neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.annually/12)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.semiannually neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.semiannually/6)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.quarterly neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.quarterly/3)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.monthly neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.monthly/1)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{else}{$product.pricing.minprice.cycleText}
		{/if}
	</div>
{/if}
                                            <br>
                                            {if $product.pricing.minprice.setupFee}
                                                <small>{$product.pricing.minprice.setupFee->toPrefixed()} {$LANG.ordersetupfee}</small>
                                            {/if}
                                        {/if}
                                    </div>
                                    <a href="{$WEB_ROOT}/cart.php?a=add&{if $product.bid}bid={$product.bid}{else}pid={$product.pid}{/if}" class="btn btn-success btn-sm" id="product{$product@iteration}-order-button">
                                        <i class="fas fa-shopping-cart"></i>
                                        {$LANG.ordernowbutton}
                                    </a>
                                </footer>
                            </div>
                        </div>
                        {if $product@iteration % 2 == 0}
                            </div>
                            <div class="row row-eq-height">
                        {/if}
                    {/foreach}
                </div>
            </div>
        </div>
    </div>
</div>

  

picture-1.jpg

picture-2.jpg

Share this post


Link to post
Share on other sites
On 11/2/2020 at 8:01 AM, DareDevil67 said:

I need help
1. $currency .prefix not working  in my whmcs v8

2. I am using ModulesGarden Discount Center module. 
If I use original orderforms/standard_cart/product.tpl, the discounted price shown with red mark in product page (picture-1), 

But if I modify the product.tpl with your above mentioned code, then the minimum price (monthly breakdown of triennially) is shown , BUT the Discounted minimum price is NOT shown with red mark in product page (picture-2)  

suppose my price as follows
1 Month Price A$ 12.74 (Regular Price: A$ 14.99)
36 Month Price A$ 9.99 (Regular Price: A$ 12.49)


My modified producr.tpl is 


{include file="orderforms/standard_cart/common.tpl"}

<div id="order-standard_cart">

    <div class="row">

        <div class="pull-md-right col-md-9">

            <div class="header-lined">
                <h1>
                    {if $productGroup.headline}
                        {$productGroup.headline}
                    {else}
                        {$productGroup.name}
                    {/if}
                </h1>
                {if $productGroup.tagline}
                    <p>{$productGroup.tagline}</p>
                {/if}
            </div>
            {if $errormessage}
                <div class="alert alert-danger">
                    {$errormessage}
                </div>
            {elseif !$productGroup}
                <div class="alert alert-info">
                    {lang key='orderForm.selectCategory'}
                </div>
            {/if}
        </div>

        <div class="col-md-3 pull-md-left sidebar hidden-xs hidden-sm">
            {include file="orderforms/standard_cart/sidebar-categories.tpl"}
        </div>

        <div class="col-md-9 pull-md-right">

            {include file="orderforms/standard_cart/sidebar-categories-collapsed.tpl"}

            <div class="products" id="products">
                <div class="row row-eq-height">
                    {foreach $products as $key => $product}
                        <div class="col-md-6">
                            <div class="product clearfix" id="product{$product@iteration}">
                                <header>
                                    <span id="product{$product@iteration}-name">{$product.name}</span>
                                    {if $product.stockControlEnabled}
                                        <span class="qty">
                                            {$product.qty} {$LANG.orderavailable}
                                        </span>
                                    {/if}
                                </header>
                                <div class="product-desc">
                                    {if $product.featuresdesc}
                                        <p id="product{$product@iteration}-description">
                                            {$product.featuresdesc}
                                        </p>
                                    {/if}
                                    <ul>
                                        {foreach $product.features as $feature => $value}
                                            <li id="product{$product@iteration}-feature{$value@iteration}">
                                                <span class="feature-value">{$value}</span>
                                                {$feature}
                                            </li>
                                        {/foreach}
                                    </ul>
                                </div>
                                <footer>
                                    <div class="product-pricing" id="product{$product@iteration}-price">
                                        {if $product.bid}
                                            {$LANG.bundledeal}<br />
                                            {if $product.displayprice}
                                                <span class="price">{$product.displayprice}</span>
                                            {/if}
                                        {else}
                                            {if $product.pricing.hasconfigoptions}
                                                <br />
                                            {/if}
                                          {if $DiscountCenterAddonIsActive}
	<div class="price">
		{$product.pricing.minprice.price}
		{if $product.pricing.type eq "recurring"}
			<span class="price-cycle">/
				{if $product.pricing.minprice.cycle eq "monthly"}
					{$LANG.pricingCycleShort.monthly}
				{elseif $product.pricing.minprice.cycle eq "quarterly"}
					{$LANG.pricingCycleShort.quarterly}
				{elseif $product.pricing.minprice.cycle eq "semiannually"}
					{$LANG.pricingCycleShort.semiannually}
				{elseif $product.pricing.minprice.cycle eq "annually"}
					{$LANG.pricingCycleShort.annually}
				{elseif $product.pricing.minprice.cycle eq "biennially"}
					{$LANG.pricingCycleShort.biennially}
				{elseif $product.pricing.minprice.cycle eq "triennially"}
					{$LANG.pricingCycleShort.triennially}
				{/if}
			</span>
		{/if}
	</div>
{elseif $product.pricing.type eq "free"}
	<div class="price">
		<span>{$LANG.orderfree}</span>
	</div>
{elseif $product.pricing.type eq "onetime"}
	<div class="price">
		<span>{$product.pricing.minprice.price} {$LANG.orderpaymenttermonetime}</span>
	</div>		
{else}
	<div class="package-starting-from ">{$LANG.startingat}</div>
	<div class="price">
		{if $product.pricing.rawpricing.triennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.triennially/36)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.biennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.biennially/24)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.annually neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.annually/12)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.semiannually neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.semiannually/6)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.quarterly neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.quarterly/3)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{elseif $product.pricing.rawpricing.monthly neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.monthly/1)|string_format:"%.2f"}{$currency.suffix}</span>/mo
		{else}{$product.pricing.minprice.cycleText}
		{/if}
	</div>
{/if}
                                            <br>
                                            {if $product.pricing.minprice.setupFee}
                                                <small>{$product.pricing.minprice.setupFee->toPrefixed()} {$LANG.ordersetupfee}</small>
                                            {/if}
                                        {/if}
                                    </div>
                                    <a href="{$WEB_ROOT}/cart.php?a=add&{if $product.bid}bid={$product.bid}{else}pid={$product.pid}{/if}" class="btn btn-success btn-sm" id="product{$product@iteration}-order-button">
                                        <i class="fas fa-shopping-cart"></i>
                                        {$LANG.ordernowbutton}
                                    </a>
                                </footer>
                            </div>
                        </div>
                        {if $product@iteration % 2 == 0}
                            </div>
                            <div class="row row-eq-height">
                        {/if}
                    {/foreach}
                </div>
            </div>
        </div>
    </div>
</div>

  

picture-1.jpg

picture-2.jpg

I have exaclty the same Problem. $currency .prefix not working  in whmcs v8

U found a Solution?

Share this post


Link to post
Share on other sites
6 hours ago, MissionPossible said:

I have exactly the same Problem. $currency .prefix not working  in whmcs v8

 

Share this post


Link to post
Share on other sites
On 11/17/2020 at 6:00 PM, brian! said:

 

Hello Brian, Thank you, with the Hook of Jesus it works. 

I have 2 Currencies, USD and EUR. 

For EUR, Currency Format should be 1.123,99 and USD 1,123.99

I added a workaround  for EUR, but this is not the best solution.

{if $product.pricing.rawpricing.annually neq -1}{($product.pricing.rawpricing.annually/12)|string_format:"%.2f"|replace:".":","}

You have any other idea?

Share this post


Link to post
Share on other sites
7 hours ago, MissionPossible said:

Hello Brian, Thank you, with the Hook of Jesus it works. 

well I would have used one of my hooks posted in that thread, as Jesus' were written for his own situation, whereas mine should work for everyone.

7 hours ago, MissionPossible said:

I have 2 Currencies, USD and EUR. 

For EUR, Currency Format should be 1.123,99 and USD 1,123.99

I added a workaround  for EUR, but this is not the best solution.

the rawpricing array would always be x.xx as it's not currency formatted... if you were in a hook, you'd have more options to apply a format to a value, but in the template, string replacing might be the simplest option.

at least with one of my hooks, you should be able to add the currency prefix/suffix back into the output.

Share this post


Link to post
Share on other sites
23 hours ago, brian! said:

well I would have used one of my hooks posted in that thread, as Jesus' were written for his own situation, whereas mine should work for everyone.

the rawpricing array would always be x.xx as it's not currency formatted... if you were in a hook, you'd have more options to apply a format to a value, but in the template, string replacing might be the simplest option.

at least with one of my hooks, you should be able to add the currency prefix/suffix back into the output.

I used this Hook:

<?php

# Cart Currency Hook v1.0
# Written by brian!

use WHMCS\Database\Capsule;

function cart_currency_hook($vars) {

	$client = Menu::context('client');
	if ($client) {
		$currencydb = Capsule::table('tblcurrencies')->where('id',$client->currencyId)->first();
	} 
	elseif (isset($_SESSION["currency"])) {
		$currencydb = Capsule::table('tblcurrencies')->where('id',$_SESSION["currency"])->first();
	}
	else {
		$currencydb = Capsule::table('tblcurrencies')->where('default','1')->first();
	}
	$currency = json_decode(json_encode($currencydb),true);
	return array ("currency" => $currency);
}
add_hook("ClientAreaPage", 1, "cart_currency_hook");

and it is working.

the rawpricing array would always be x.xx as it's not currency formatted... if you were in a hook, you'd have more options to apply a format to a value, but in the template, string replacing might be the simplest option

Thank you. i will try to make a Hook for that.

Share this post


Link to post
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