Jump to content
  • 0

Package Pricing Display...


Larry Beall

Question

I am trying to setup multiple payment terms for my packages, but would like them to be displayed as the monthly amount. So like this:

 

1 Month - $8.00/Month

6 Months - $48.00/6 Months

12 Months - $84.00/12 months

 

But I would like them to show up on the order form as:

1 Month @ $8.00

6 Month @ $8.00

12 Months @ $7.00

 

Is this possible?  Any help would be appreciated.

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

It's possible, but it's not natively supported. It would require you to make core changes, which will be overridden during upgrades. You would need to maintain the changes in your installation.

 

Amounts are displayed in several places across the admin/client interfaces, but for brevity I'll give an example of one place on the Wizard order form. The other order forms (i.e. Standard/AJAX) would need to be updated similarly.

 

This example will change the price display on the Wizard order form's drop-down menu for Term and Price. This will show prices using the per-month price rather than the price for all months combined.

 

 

Open /plugins/order/views/templates/wizard/config.pdt

Find (line 37):

$prices[$price->id] = $this->_("Config.index.package_price", true, $period, $this->CurrencyFormat->format($price->price, $price->currency)); 

Replace with:

$amount = $price->price;
if ($price->period == "month" && $price->term > 0)
	$amount = ($price->price/$price->term);
							
$prices[$price->id] = $this->_("Config.index.package_price", true, $period, $this->CurrencyFormat->format($amount, $price->currency));
Link to comment
Share on other sites

  • 0

Sweet thank you for this.  I wanted to make sure I wasn't missing anything before digging in and figuring out how to hack it to display the way I wanted.  I took what you suggested and expanded it a bit.  First I made a copy of the wizard folder in the order plugin, so that I would hopefully have a little upgrade protection while maintaining existing functionality in case I need it.  Then I modified the pricing display in several of the new wizards files.  I have that looking mostly correct, I just need to find a graceful way to get the invoice to look correct. :)  Thank you for your help.

Link to comment
Share on other sites

  • 0

Thank you, this worked great.

 

However, I would also like to change the "starting at" so it shows the lowest possible monthly rate.

 

For example, if the lowest possible cost per month is $3 when you subscribe for a 12 month term, it should say:

 

"Starting at $3/month*"

Link to comment
Share on other sites

  • 0

Feature request: It would also be awesome if Blesta showed the math that's going on in the Order Summary. Example:

 

12 x $3.99

Subtotal: $47.88

 

To recap, there should be a line above subtotal that shows the unit price as $3.99 (or whatever the monthly price is) and multiplies it by the length of the term.

 

The reason is that we offer our clients a discount for paying every 6 or 12 months and we want to clearly convey this information. The way it is right now lacks clarity.

Link to comment
Share on other sites

  • 0

Thank you again for this this amazing answer. The code changes worked perfectly.

 

I want to make one additional change though: The "Starting at" price should always show the lowest possible price. In Larry Beall's example, it should say "Starting at $7" and NOT "Starting at $8".

 

What code changes are necessary to make this happen? 

Link to comment
Share on other sites

  • 0

The "Starting At" price is from the /plugins/order/views/templates/wizard/main_packages.pdt template. It currently shows the lowest numeric price, however, it would require several changes to show the lowest price per month. It becomes more complex if you have non-monthly terms in the mix as well.

 

As an example, I will only show changes for the Wizard Boxes template, and ignore non-monthly terms for simplicity.

Find:

foreach ($package->pricing as $price) {
	if ($lowest_price === null || $lowest_price->price > $price->price)
		$lowest_price = $price;
}

Replace with:

$lowest_monthly_price = null;	
$lowest_monthly_currency = null;
foreach ($package->pricing as $price) {
	if ($lowest_price === null) {
		$lowest_price = $price;
	}
								
	if ($price->period == "month" && $lowest_price->period == "month" &&
		$price->term > 0 && $lowest_price->term > 0 &&
		($price->price/$price->term) < ($lowest_price->price/$lowest_price->term)) {
		$lowest_monthly_price = ($price->price/$price->term);
                $lowest_monthly_currency = $price->currency;
	}
}

Find:

<div class="package panel-blesta <?php echo ($this->Html->ifSet($package_id) == $package->id ? "selected" : "");?>" data-group-id="<?php $this->Html->_($package_group->id);?>" data-pricing-id="<?php $this->Html->_($lowest_price->id);?>">

Replace with:

<div class="package panel-blesta <?php echo ($this->Html->ifSet($package_id) == $package->id ? "selected" : "");?>" data-group-id="<?php $this->Html->_($package_group->id);?>" data-pricing-id="<?php echo $this->Html->safe($this->Html->ifSet($lowest_monthly_id, $lowest_price->id));?>">

Find:

<h4><?php echo $this->CurrencyFormat->format($this->Html->ifSet($lowest_price->price), $this->Html->ifSet($lowest_price->currency));?></h4>

Replace with:

<h4><?php echo $this->CurrencyFormat->format($this->Html->ifSet($lowest_monthly_price, $lowest_price->price), $this->Html->ifSet($lowest_monthly_currency, $lowest_price->currency));?><?php echo ($lowest_monthly_price !== null) ? "/month" : "";?></h4>
Link to comment
Share on other sites

  • 0
On 12/29/2014 at 10:59 PM, Tyson said:

It's possible, but it's not natively supported. It would require you to make core changes, which will be overridden during upgrades. You would need to maintain the changes in your installation.

 

Amounts are displayed in several places across the admin/client interfaces, but for brevity I'll give an example of one place on the Wizard order form. The other order forms (i.e. Standard/AJAX) would need to be updated similarly.

 

This example will change the price display on the Wizard order form's drop-down menu for Term and Price. This will show prices using the per-month price rather than the price for all months combined.

 

 

Open /plugins/order/views/templates/wizard/config.pdt

Find (line 37):


$prices[$price->id] = $this->_("Config.index.package_price", true, $period, $this->CurrencyFormat->format($price->price, $price->currency)); 

Replace with:


$amount = $price->price;
if ($price->period == "month" && $price->term > 0)
	$amount = ($price->price/$price->term);
							
$prices[$price->id] = $this->_("Config.index.package_price", true, $period, $this->CurrencyFormat->format($amount, $price->currency));

Hello,  I would like to achieve the exact same objective as explained in the quoted post, i am running blesta 4.9.1. 6 years after this post was written, the code is changed now to:

/plugins/order/views/templates/wizard/config.pdt - Line 39

// Set the pricing text to include or not include renewal pricing
$prices[$price->id] = ($this->Html->ifSet($price->period) == 'onetime' || ($this->Html->ifSet($price->price) == $this->Html->ifSet($price->price_renews))
    ? $this->_('Config.index.package_price', true, $period, $this->CurrencyFormat->format($this->Html->ifSet($price->price), $this->Html->ifSet($price->currency)))
    : $this->_('Config.index.package_price_recurring', true, $period, $this->CurrencyFormat->format($this->Html->ifSet($price->price), $this->Html->ifSet($price->currency)), $this->CurrencyFormat->format($this->Html->ifSet($price->price_renews), $this->Html->ifSet($price->currency)))
);

I tried to rewrite the code for the current version based on your example above, as below:

$amount = $price->price;
if ($price->period == "month" && $price->term > 0)
    $amount = ($price->price/$price->term);
    
// Set the pricing text to include or not include renewal pricing
$prices[$price->id] = ($this->Html->ifSet($price->period) == 'onetime' || ($this->Html->ifSet($price->price) == $this->Html->ifSet($price->price_renews))
    ? $this->_('Config.index.package_price', true, $period, $this->CurrencyFormat->format($this->Html->ifSet($amount), $this->Html->ifSet($price->currency)))
    : $this->_('Config.index.package_price_recurring', true, $period, $this->CurrencyFormat->format($this->Html->ifSet($amount), $this->Html->ifSet($price->currency)), $this->CurrencyFormat->format($this->Html->ifSet($price->price_renews), $this->Html->ifSet($price->currency)))
);

However its not working, can you please help with the same.

Thanks and Best Regards

Santosh

 

Link to comment
Share on other sites

  • 0

Hello Again, identified the issue, the package term was set as 1 year, 2 year, 3 year. Needed to change it to 12 months, 24 months and 36 months, then the above code is working.

Another thing we would like to achieve is - Display the prices in the lowest to the highest order in the product "Term and Price" dropdown?

Can you please help us with the same.

Thanks and Best Regards,

Santosh

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
Answer this question...

×   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.

Loading...
×
×
  • Create New...