Jump to content

Looking for Product configuration page custom messge help from brian !


adroitssd

Recommended Posts

that's not really a suitable hook - at the product configuration stage, you haven't even checked out yet, so you aren't anywhere near the invoice generation part of the ordering process.

 

I want to show custom message and discounted price on whmcs product configuration page. Usually whmcs show coupon applied price on cart view or summary page. But i want to show also configuration page. Please suggest me how to do that.

with v6, I think it would be very difficult to do - mainly because most of the information you would need is missing... you could tweak the output a little, but calculating discounts with multiple items in the cart would be a nightmare. :roll:

 

https://forum.whmcs.com/showthread.php?118558-Promotion-Amount-Display-At-Order-Summary&p=478102#post478102

 

however, i've just been playing with this in the v7.1 beta and it looks like it's now possible to do it with existing variables! :idea:

 

I don't know if this just applies to the v7.1 beta or to v7 in general - at the moment I can't check as I upgraded the old v7 dev to the first beta... and i'll update that to RC1 tomorrow.

 

k4v8cFe.png

 

ignore how it looks in the above image for now, I was just testing to see if the values given by the cart for the discount is correct for multiple products - and they are. :idea:

 

I would imagine you could easily do the big "The coupon has been applied to your order" boostrap alert with just 1 line of code in v6, but not the order summary box - in the v7.1 beta, you should be able to do both.

 

i've currently got a few other projects to work on, so leave this with me for a couple of days as I will need to test it thoroughly.

Link to comment
Share on other sites

that's not really a suitable hook - at the product configuration stage, you haven't even checked out yet, so you aren't anywhere near the invoice generation part of the ordering process.

 

 

with v6, I think it would be very difficult to do - mainly because most of the information you would need is missing... you could tweak the output a little, but calculating discounts with multiple items in the cart would be a nightmare. :roll:

 

https://forum.whmcs.com/showthread.php?118558-Promotion-Amount-Display-At-Order-Summary&p=478102#post478102

 

however, i've just been playing with this in the v7.1 beta and it looks like it's now possible to do it with existing variables! :idea:

 

I don't know if this just applies to the v7.1 beta or to v7 in general - at the moment I can't check as I upgraded the old v7 dev to the first beta... and i'll update that to RC1 tomorrow.

 

k4v8cFe.png

 

ignore how it looks in the above image for now, I was just testing to see if the values given by the cart for the discount is correct for multiple products - and they are. :idea:

 

I would imagine you could easily do the big "The coupon has been applied to your order" boostrap alert with just 1 line of code in v6, but not the order summary box - in the v7.1 beta, you should be able to do both.

 

i've currently got a few other projects to work on, so leave this with me for a couple of days as I will need to test it thoroughly.

 

I really appreciate your effort and waiting for the update.

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...
@brian! Do you have any update?

with regards to the ordersummary.tpl issue, the code used in the above image is...

 

<div class="total-due-today">
   <span class="amt">{$producttotals.pricing.totaltoday}</span>
   <span>{$LANG.ordertotalduetoday}</span>
   {if $smarty.session.cart.promo}
       <span>Promotional Code: {$smarty.session.cart.promo}</span>
       <span>Discount: {$currency.prefix}{$carttotals.rawdiscount}{$currency.suffix}</span>
       <span>New Total: {$currency.prefix}{$carttotals.rawtotal}{$currency.suffix}</span>
   {/if}
</div>

 

and if you want to show a banner in configureproduct.tpl, then you could use...

 

            {if $smarty.session.cart.promo}
               <div class="alert alert-success" role="alert">
                   The coupon "{$smarty.session.cart.promo|strtoupper}" has been applied to your order!
               </div>
           {/if}

 

bMnV5qM.png

Link to comment
Share on other sites

with regards to the ordersummary.tpl issue, the code used in the above image is...

 

<div class="total-due-today">
   <span class="amt">{$producttotals.pricing.totaltoday}</span>
   <span>{$LANG.ordertotalduetoday}</span>
   {if $smarty.session.cart.promo}
       <span>Promotional Code: {$smarty.session.cart.promo}</span>
       <span>Discount: {$currency.prefix}{$carttotals.rawdiscount}{$currency.suffix}</span>
       <span>New Total: {$currency.prefix}{$carttotals.rawtotal}{$currency.suffix}</span>
   {/if}
</div>

 

and if you want to show a banner in configureproduct.tpl, then you could use...

 

            {if $smarty.session.cart.promo}
               <div class="alert alert-success" role="alert">
                   The coupon "{$smarty.session.cart.promo|strtoupper}" has been applied to your order!
               </div>
           {/if}

 

bMnV5qM.png

 

Do I need 7.1 to use both code?

Edited by adroitssd
Link to comment
Share on other sites

Do I need 7.1 to use both code?

you'll almost certainly need v7.1+ for the ordersummary changes, but the banner change should work in v6 (i've just tried it successfully in v6.3.1). :idea:

 

although bear in mind that if you are adding a promo code to a link, the banner will just tell you that the code has been applied to the cart, it cannot tell you whether you have applicable products.

Link to comment
Share on other sites

viewcart.tpl

in a similar way to the email templates, not all of the templates use the same variables... and just to make life even more exciting, sometimes they have the same values, but WHMCS have given the same variables different names in various templates.

 

so if I post code for one template, it doesn't mean that you can just copy & paste it into another template... if only! :)

 

you could make it work by using...

 

                                    <span>Discount: {$currency.prefix}{$rawdiscount}{$currency.suffix}</span>
                                   <span>New Total: {$currency.prefix}{$rawtotal}{$currency.suffix}</span>

but in viewcart, there are other existing variables, already used in the display, that will give you the same correct values without the need for additional currency coding - {$discount} and {$total} :idea:

Link to comment
Share on other sites

Is there a page or list of all the variables ? {$discount} etc that can be used ?

not really, the best you'll currently get is - http://developers.whmcs.com/themes/variables/

 

but the advice at the bottom of that page is the important one to note...

 

For a complete listing of all variables available to you in a given template file, add {debug} to your template file and then access the page which calls the template via a browser to receive a popup listing all available template data.
Link to comment
Share on other sites

you'll almost certainly need v7.1+ for the ordersummary changes, but the banner change should work in v6 (i've just tried it successfully in v6.3.1). :idea:

 

although bear in mind that if you are adding a promo code to a link, the banner will just tell you that the code has been applied to the cart, it cannot tell you whether you have applicable products.

 

I'm using Version: 6.3.1 so only banner works for me.Thanks a lot. I'll let you know the feedback when I'll have the udpated whmcs. May I know at which page it will show discounted price? as I've asked to show coupon applied discounted price during product configuration. But I see her e you're talking about ordersummary.tpl. Another query, If I update whmcs will it replace my custom config on configureproduct.tpl (banner code). If yes what is the solution for that? whmcs frequently release update and I've to update configureproduct.tpl everytime :(

Link to comment
Share on other sites

May I know at which page it will show discounted price? as I've asked to show coupon applied discounted price during product configuration. But I see here you're talking about ordersummary.tpl.

in your image from the first post, the grey box on the right, "Order Summary", uses the ordersummary.tpl template - so any changes you want to make to the content of that box, are made in that template. :idea:

 

Another query, If I update whmcs will it replace my custom config on configureproduct.tpl (banner code).

yes.

 

If yes what is the solution for that? whmcs frequently release update and I've to update configureproduct.tpl everytime :(

they sometimes don't release updates that frequently - there was a period last year when we didn't get any real updates for 6 months!

 

technically, what you're supposed to do is make a copy of the template (in this case, standard_cart) and then make your changes to that copied template...

 

https://developers.whmcs.com/themes/getting-started/

 

the above documentation describes the procedure for modifying the "Six" template, but it's equally applicable to orderform templates too, such as standard_cart.

that way, when you update WHMCS, your custom template (main and/or orderform) won't be changed... you'll then need to compare your custom to the latest version and see what changes have been made.

 

the only other way, in terms of the banner, might be to use an action hook - but i'm not convinced you could do it without making template adjustments anyway - but i'll look into that at the weekend.

 

one of the things that I might do is try to combine the output of the order summary from this thread (showing promotion discounts), with the output from the recent product bundles thread, which shows savings in product bundles - there is an overlap as bundles can use promotion codes too... and then considerably polish up the output.

Link to comment
Share on other sites

  • 11 months later...

Hai Brian!!

 

I would like to thank you for your great post, I've referred and implemented the same,  But my query is discount should not apply on configurable options and setup fees.  

Ex:  

Product name: abc  - $50.00 USD

Configurable Options: Extra CPU -  $10.00 USD

Setup Fee: $10.00 USD

Total Amount: $70.00 USD 

If discount 20% has been added to product "abc" -  discount is applying on total amount of that product , I wish to do that  discount should apply only on product/services not includes on configurable options and setup fees..., Could you please help me on this part.. 

 

Thank you,

Link to comment
Share on other sites

On 1/12/2018 at 11:59, NagarajB said:

If discount 20% has been added to product "abc" -  discount is applying on total amount of that product , I wish to do that  discount should apply only on product/services not includes on configurable options and setup fees..., Could you please help me on this part.. 

the simplest solution would be to use a fixed amount discount rather than a percentage... currently, there isn't a setting or existing addon that can apply promotions only to the base product and not configurable options.

so calculate 20% of $50, and make the promotion code a fixed amount of $10 - if you are using multiple billing cycles, then you may need multiple promotion codes too.

if you really need to use percentage discounts, then you may have to take the config options and setup fee into account when calculating the percentage, e.g make the discount 14.28% instead of 20% (that would make the discounted total $60)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • 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