-M- Posted October 5, 2015 Share Posted October 5, 2015 (edited) I just noticed something, but I am not sure if it's my own fault or if it's a bug. I did a search on the forum, but apparently it's only me (lol). I created a server which customers can order. I have setup everything correctly, so far as I can tell. Including a single setup fee of 25.00 EUR. When I test-drive the order and select the option quarterly payment, it will show the quarterly payable amount as following (example): 100 EUR (quarterly amount for the configured server) + 25.00 EUR setup fee. So it will show 125 EUR quarterly to be paid. Now this is incorrect; it should only calculate the setup fee *once* Did I do something wrong somewhere, or is it a bug? I hope explained correctly. Using WHMCS 6.1. If it's something I did, where can I fix this? //edit It's really weird; because a setup fee is normally only charged once, right? So maybe I am doing something wrong, if not, maybe I should create an option called 'single setup fee' or something silimar instead and remove the setup fee's completely from the servers? Edited October 5, 2015 by MvdL1979 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 5, 2015 Share Posted October 5, 2015 it's working correctly - it's taking payment for the setup fee and first billing cycle immediately - €100+€25 setup fee; when the invoice for the 2nd quarter is generated, it won't charge the setup fee again, just the quarterly payment - €100 0 Quote Link to comment Share on other sites More sharing options...
-M- Posted October 5, 2015 Author Share Posted October 5, 2015 (edited) Yeah, but it's confusing for a customer, because it's saying that they have to pay that amount quarterly. IMHO; it should be broken down / divided. Would make it much clearer for a customer. Escpecially, because we use our own billing and invoice system. Anyways, I will look up the correct code for this and edit it otherwise. In that way it's clear for a customer what they are going to pay quarterly and what they pay as a single setup fee. //edit Isn't there a way or other variables I can use, to show them seperately, for example: Server Price (without setup fee) Quarterly Setup Price Only once / single time Or something like that? Edited October 5, 2015 by MvdL1979 Added some text. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 5, 2015 Share Posted October 5, 2015 Yeah, but it's confusing for a customer, because it's saying that they have to pay that amount quarterly.IMHO; it should be broken down / divided. Would make it much clearer for a customer. my recollection is that it is... or at least was with the older templates - haven't done any major playing with the new orderforms yet... Isn't there a way or other variables I can use, to show them separately, for example:Or something like that? {debug} will be your friend there and show you what's available... 0 Quote Link to comment Share on other sites More sharing options...
-M- Posted October 5, 2015 Author Share Posted October 5, 2015 (edited) Okay, followed up on your advice and ran {debug}, however still can't make much sense of it. For example it shows: $products Smarty_Variable Object (3) ->value = Array (1) 0 => Array (13) pid => "35" domain => "NA.example12321313.nl" billingcycle => "quarterly" configoptions => Array (7) 0 => Array (7) name => "server model" type => "2" option => "Basic Server €23,85 EUR" optionname => "Basic Server" setup => "€25,00 EUR" recurring => "€23,85 EUR" qty => 0 1 => Array (7) name => "optionsabc" type => "2" option => "option in detail abc" optionname => "option in detail abc" setup => "" recurring => "€0,00 EUR" qty => 0 As far as I can tell, it actually does have it somewhere stored, according to the output. So how do I display the: recurring => "€23,85 EUR" I tried this by doing: {$products.recurring} and several others, but no result? //update #1 If the above isn't possible, would it be possible to do some kind of math on it? For example: {$product.pricing.totaltodayexcltax} - (minus) {$product.pricing.productonlysetup} Probably a silly question, but that would solve it also. (sorry for my typing, but I have a splitting headache atm). //update #2 Well I finally found it, even with a massive headache... It was the variable: {$product.configoptions.0.recurring} I have no clue if this is the correct variable and if it will work for everything else (without messing things up), but will try it. Maybe it's smarter, if possible, to create an {if} rule...? For example if it's VPS it should display {$product.configoptions.0.recurring} otherwise display the normal {$product.pricing.totaltodayexcltax}? Does that make sense....? //update #3 Pfft... Apparently it's not the correct variable. Because it's only the price of one (single) VPS. I am stupid. Under $product variable it's this: pricing => Array ( baseprice => "€0,00 EUR" setup => "€25,00 EUR" recurring => Array (1) per kwartaal => "€154,64 EUR" totaltoday => "€184,89 EUR" productonlysetup => "€25,00 EUR" totaltodayexcltax => "€152,80 EUR" tax1 => "€32,09 EUR" recurringexcltax => Array (1) per kwartaal => "€127,80 EUR" The correct amount it should show is the one which is mentioning 'per kwartaal', so in this case "€127,80 EUR" If I use: {$product.pricing.recurringexcltax.1} Nothing is being displayed. If I use: {$product.pricing.recurringexcltax.1.per kwartaal} The page isn't loaded anymore (probably because of the empty space in there). What's the proper way to display that variable (or amount in this case)? Edited October 5, 2015 by MvdL1979 Sigh. Wasn't the correct one. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 5, 2015 Share Posted October 5, 2015 I tried this by doing: {$products.recurring} and several others, but no result? $products is an array, not a variable - therefore, you can't just call it as {$products.recurring}, you'll need to loop through the array (usually done via foreach) and get the specific variable you want. i'm sure in viewcart.tpl, there are a lot more pricing variables available there - including the recurring price. i've got to go out for the next few hours, but if you want to send me a PM (private message) with a link to your site/this product, i'll take a look at it - it would be helpful to see what you're seeing. If the above isn't possible, would it be possible to do some kind of math on it?For example: {$product.pricing.totaltodayexcltax} - (minus) {$product.pricing.productonlysetup} if they're numbers, then yes... if they're not numbers, you may need to manipulate them first. Well I finally found it, even with a massive headache... It was the variable: {$product.configoptions.0.recurring} I have no clue if this is the correct variable and if it will work for everything else (without messing things up), but will try it. i'd be inclined to think it would mess things up - not necessarily for this product, but for other products using other config options. Maybe it's smarter, if possible, to create an {if} rule...? For example if it's VPS it should display {$product.configoptions.0.recurring} otherwise display the normal {$product.pricing.totaltodayexcltax}?Does that make sense....? yeah, it occurred to me earlier that {if} you probably be a better solution for this - especially as we've moved from editing some text, to adding new text using other variables. it might be easier to wait until the headache goes and work out exactly what you want to display, where and when - once you know that, it should be a lot clearer... as frankly, it's confusing for me to determine exactly what you're now trying to do without seeing the site. 0 Quote Link to comment Share on other sites More sharing options...
-M- Posted October 5, 2015 Author Share Posted October 5, 2015 Yeah, I should call it a day today with this headache. Very annoying, especially if I can't get things to work (display) correctly. When you answered, I discovered I was getting wrong variable. I updated my post a bit (under update #3). Anyways, I think I will try a few more things, before going to lay down. Because this isn't working with the headache. Thank you for taking the time to reply nevertheless!! 0 Quote Link to comment Share on other sites More sharing options...
-M- Posted October 6, 2015 Author Share Posted October 6, 2015 (edited) Well today is a better day; my headache is almost gone. It eventually became worse yesterday. Oh well. Feeling better now. I will try to rephrase what I am trying to display here. I want to display the price without the setup fee included. I will create a seperate line for that, so it's clearer for our customers, once the site goes live obviously. I checked with {debug} and found the following: The 'assigned template variable' is $products, under this variable there are several things, along the one I am trying to display. Though I succeeded in getting most of them being displayed, I failt at this one. Probably cause I am formatting it incorrectly. So under $products: billingcyclefriendly => "per kwartaal" pricing => Array ( baseprice => "€0,00 EUR" setup => "€25,00 EUR" recurring => Array (1) per kwartaal => "€154,64 EUR" totaltoday => "€184,89 EUR" productonlysetup => "€25,00 EUR" totaltodayexcltax => "€152,80 EUR" tax1 => "€32,09 EUR" [b] recurringexcltax => Array (1) per kwartaal => "€127,80 EUR"[/b] pricingtext => "€127,80 EUR + €25,00 EUR éénmalige se..." The one I am trying to display on the website is: recurringexcltax => Array (1) per kwartaal => "€127,80 EUR" I tried several things, but like I said above, I am probably formatting it incorrectly. Tried various things, but I get blank page (probably doing something wrong, which breaks the code), or I just get the word "Array". So, in short, how do I display that amount? What's the correct way to call it? I hope this makes a lot more sense than my questions of yesterday. Was really not feeling very well. Thank you in advance. (in the meantime I am gonna restore most of the changes I made yesterday lol) Edited October 6, 2015 by MvdL1979 Added a text line. 0 Quote Link to comment Share on other sites More sharing options...
-M- Posted October 6, 2015 Author Share Posted October 6, 2015 (edited) Wow finally made some progress. I was thinking I was close yesterday, even though the page stopped loading (because of the space between 'per kwartaal'). I managed to display the array, by using: {$product.pricing.recurringexcltax.{'per kwartaal'}} Though this works excellent, it provided me obviously with a new problem. If they select a VPS and select annually payment as an option. So I did the following: {$product.pricing.recurringexcltax.{'per kwartaal'}}{$product.pricing.recurringexcltax.{'per jaar'}} So far as I can tell this actually works, but I rather be sure. On a sidenote; I mentioned yesterday if it was smart to use an {if} statement for these situations (for only virtual servers, dedicated servers and reseller packages). Though I don't it will matter much, but the only time we use a setup fee is with servers and reseller packages. What do you think and/or what do you advice? ------------------------------------------------- update --------------------------------------------- Well I found a small issue when using: {$product.pricing.recurringexcltax.{'per kwartaal'}}{$product.pricing.recurringexcltax.{'per jaar'}} It works for everything (servers, hosting packages, domainnames), *except* for something we call forward / redirect. It's a one-time fee and therefor it has only a 'baseprice' (€2.75 EUR for forward and €4.50 EUR for redirect). Is there something I can add to the above code that it will show the baseprice for only a forward / redirect? Maybe by making it dependent on one of the following options: - name => "Domeinnaam forwarden" - groupname => "Domeinnaam Forwarden / Redirecten" - billingcycle => "onetime" Like this example (no clue on how to code that though, just to give you an impression) if "name" is "Domeinnaam forwarden" show $baseprice else {$product.pricing.recurringexcltax.{'per kwartaal'}}{$product.pricing.recurringexcltax.{'per jaar'}} Something like that? I don't know if that is possible, or how to formulate that properly. Edited October 6, 2015 by MvdL1979 Found a new issue. :| 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 6, 2015 Share Posted October 6, 2015 Wow finally made some progress. I was thinking I was close yesterday, even though the page stopped loading (because of the space between 'per kwartaal'). I managed to display the array, by using: {$product.pricing.recurringexcltax.{'per kwartaal'}} Though this works excellent, it provided me obviously with a new problem. If they select a VPS and select annually payment as an option. So I did the following: {$product.pricing.recurringexcltax.{'per kwartaal'}}{$product.pricing.recurringexcltax.{'per jaar'}} So far as I can tell this actually works, but I rather be sure. if it were me, i'd add an {if} statement using the billing cycle value and then display the appropriate variable - your way would probably work, but it's a bad habit to display multiple variables and hope the correct one shows! On a sidenote; I mentioned yesterday if it was smart to use an {if} statement for these situations (for only virtual servers, dedicated servers and reseller packages). Though I don't it will matter much, but the only time we use a setup fee is with servers and reseller packages. What do you think and/or what do you advice? it's probably best to make the {if} statements as precise as you can... if you add setup fees to other products in the furure, you may need to rewrite this code. Well I found a small issue when using: {$product.pricing.recurringexcltax.{'per kwartaal'}}{$product.pricing.recurringexcltax.{'per jaar'}} It works for everything (servers, hosting packages, domainnames), *except* for something we call forward / redirect. It's a one-time fee and therefor it has only a 'baseprice' (€2.75 EUR for forward and €4.50 EUR for redirect). Is there something I can add to the above code that it will show the baseprice for only a forward / redirect? Maybe by making it dependent on one of the following options: - name => "Domeinnaam forwarden" - groupname => "Domeinnaam Forwarden / Redirecten" - billingcycle => "onetime" as I suggested earlier, i'd go with billingcycle - not sure of your variables, but something along the lines of... {if $billingcycle eq "quarterly"}{$product.pricing.recurringexcltax.{'per kwartaal'}}{elseif $billingcycle eq "annually"}{$product.pricing.recurringexcltax.{'per jaar'}}{elseif $billingcycle eq "onetime"}{$product.pricing.baseprice}{/if} the coder in me says there should be a final else that displays *something*, if not onetime, quarterly or annually - but i'll leave that to you! 0 Quote Link to comment Share on other sites More sharing options...
-M- Posted October 7, 2015 Author Share Posted October 7, 2015 Thank you for explaining. I used your example to give it a go: {if $billingcycle eq "quarterly"}{$product.pricing.recurringexcltax.{'per kwartaal'}} {elseif $billingcycle eq "annually"}{$product.pricing.recurringexcltax.{'per jaar'}} {elseif $billingcycle eq "onetime"}{$product.pricing.baseprice} {/if} This results in no prices being shown for annually, quarterly and onetime. The only prices I see are for the domainname registrations. So I decided to test each one first, by using: {$billingcycle eq "quarterly"}{$product.pricing.recurringexcltax.{'per kwartaal'}} {$billingcycle eq "annually"}{$product.pricing.recurringexcltax.{'per jaar'}} {$billingcycle eq "onetime"}{$product.pricing.baseprice} Well all the prices are shown (quarterly, annually and onetime), however it also shows the baseprice for virtual and dedicated servers. After looking at the smarty tags through {debug} I noticed there isn't a variable called "$billingcycle". This also would explain why *all* the prices show up using the code I posted above. And nothing being displayed when using your code. Maybe you were giving it as an example (my bad in that case). So I looked it up again and tried: {if $product.billingcycle eq "quarterly"}{$product.pricing.recurringexcltax.{'per kwartaal'}} {elseif $product.billingcycle eq "annually"}{$product.pricing.recurringexcltax.{'per jaar'}} {elseif $product.billingcycle eq "onetime"}{$product.pricing.baseprice} {/if} Maybe (pretty certain actually) you probably think i have a weird way of finding things out. But I hardly got any experience with PHP and/or Smarty. But I am always trying to learn and understand. But thank you so much for pointing me in the right direction. I am getting (bit by bit) the hang of it (slowly though). 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 7, 2015 Share Posted October 7, 2015 After looking at the smarty tags through {debug} I noticed there isn't a variable called "$billingcycle". This also would explain why *all* the prices show up using the code I posted above. And nothing being displayed when using your code. Maybe you were giving it as an example (my bad in that case). the problem is that not all variables are available on every page - and often the same value is given different variable names based on which template page you're using - hence why we kept on asking which page it is! so you can't necessarily copy some code that will work on one template into another - it might work, it might not! 0 Quote Link to comment Share on other sites More sharing options...
-M- Posted October 7, 2015 Author Share Posted October 7, 2015 Yeah, I think I misread your answers sometimes, but probably because I read it to quickly (and the answer being in English). Anyways, the most important thing is that I got the result in the end. Thanks to you, nevertheless. 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.