activa Posted March 19, 2016 Report Posted March 19, 2016 Hello from tab views (admin/client) , i have a tab_XXX that will show option and settings , what i want to do , is when the addon XXXX has been purshaed i want to show this setting , if not i want to show a info message . how i can check that the addon XXX is purshased ? any sample code can help . Blesta Addons 1 Quote
Tyson Posted March 21, 2016 Report Posted March 21, 2016 I'm not sure I understand. Can you clarify what you're intending to do? Quote
Blesta Addons Posted March 21, 2016 Report Posted March 21, 2016 i have the same request . so let me explain . i have a module , i have setup a package for it . i have setup 2 Package Options (for this package) they are paid . is clear here ? in my module a have two tabs that need to show some setting if the package option is already purshased , if not i will see a denied or else . is clear here ? now how i can in my module determinita that the package option X are purshased and paid ? Quote
Tyson Posted March 21, 2016 Report Posted March 21, 2016 The OP asked about addons, which are a bit different than package options. For package options, you have those available in the $service passed to the tab as $service->options. Because each option can be ordered at the time a service is added, when it renews, or any time in between, you couldn't necessarily know whether the particular option has been paid. Quote
activa Posted March 22, 2016 Author Report Posted March 22, 2016 The OP asked about addons, which are a bit different than package options. For package options, you have those available in the $service passed to the tab as $service->options. Because each option can be ordered at the time a service is added, when it renews, or any time in between, you couldn't necessarily know whether the particular option has been paid. My question was exactly what naja describe , maybe a bad explain about addons/package options . so our registrar is now selling privacy that was free before , we will make a package option , but we want to give access to it only for people who have selected and payed this option . let say the package option name is "privacy" , how i can know that this service has this options activated (true as default is false) . Quote
Tyson Posted March 22, 2016 Report Posted March 22, 2016 so our registrar is now selling privacy that was free before , we will make a package option , but we want to give access to it only for people who have selected and payed this option . Short answer is you cannot make this determination based on whether a package option has been "selected and paid". You cannot tell from the option itself whether it has been paid. let say the package option name is "privacy" , how i can know that this service has this options activated (true as default is false) . Whether a package option has been "activated" can be determined by the fact the package option is set on the service as I described a couple posts above. The issue is that you cannot reliably determine whether a package option has been paid. If a client orders a service and the package option was added when the service was added, and the service is active, you can assume the package option has been paid. If an admin created the service, they can make it active even if it's unpaid. Your module will be unaware of this difference. If the service was added, and later a package option was added, then: - if the setting "Queue Service Changes Until Paid" is checked, the package option will not be added to the service until it has been paid, so you can assume that if it is on the service, it has been paid. - if the setting "Queue Service Changes Until Paid" is unchecked, the package option will be added immediately, even if not paid. You couldn't determine if it has been paid. Quote
activa Posted March 22, 2016 Author Report Posted March 22, 2016 so in our case there are no options/way to check if is ordered/paid or not ? we can can check at least if the option is activated or not (added or not) ? the fact here is we wouldn't show some tabs if the option is not activated . but how blesta check if a package options is added and it will calculated in the renewal ? a small question regarding package options , client can order this option when the services is already activated from client area ? Quote
Blesta Addons Posted March 24, 2016 Report Posted March 24, 2016 at my side i have not successed to show the confugurable option in the order form ... i ahev all do as the wiki https://docs.blesta.com/display/user/Creating+Configurable+Options but the config option is not shown when ordering package !!! is the module need to have some extra functions ? resolved by setting the option and the package with the same term price . Quote
Blesta Addons Posted March 24, 2016 Report Posted March 24, 2016 Whether a package option has been "activated" can be determined by the fact the package option is set on the service as I described a couple posts above. The issue is that you cannot reliably determine whether a package option has been paid. If a client orders a service and the package option was added when the service was added, and the service is active, you can assume the package option has been paid. If an admin created the service, they can make it active even if it's unpaid. Your module will be unaware of this difference. If the service was added, and later a package option was added, then: - if the setting "Queue Service Changes Until Paid" is checked, the package option will not be added to the service until it has been paid, so you can assume that if it is on the service, it has been paid. - if the setting "Queue Service Changes Until Paid" is unchecked, the package option will be added immediately, even if not paid. You couldn't determine if it has been paid. if i understand well the case . the option package will be added to the vars of the services when is activated by the module . but i need to know what happen if the option are paid after the service is activated . which function the module will run to handle the request ? in renewal , the option name will be passed to the $vars fields in command ? a simple case with logicbox, the logicbox has now a paid service of privacy-protection , it can be passed with option in register and renew action as "purchase-privacy" , if set to true it will activated the option "purchase-privacy=true" , by default is set to false . so in creation or renew if the option package is paid the module will pass it as true , at here i think is good . now if a client after a domain registration has been made, they have added the package option , and he paid the invoice , how the module will handle the action ? or the options will be added to the services fields until the module make the renew to pass it ? logicbox has a command to purchase the privacy after the domain has been activated , is "purchase-privacy()" function . how the module will handle this command ? Quote
serge Posted March 24, 2016 Report Posted March 24, 2016 on an other than Blesta software (shopping cart) , I had to manage a like similar case, so I did it with hacking a core template: I make just before the given step : - the cookie "option_xx-enable" was deleted (as cookie can never be updated but only deleted first) And next: If given option was ticked or validated: - the cookie "option_xx-enable" was created, with a value, say "1" And at for later steps, the cookie value is checked, to proceed given operation or conditional code Quote
Tyson Posted March 24, 2016 Report Posted March 24, 2016 so in our case there are no options/way to check if is ordered/paid or not ? You can determine if it is ordered, but not if it has been paid. If it has been ordered, it will appear on the service. Package options are not directly related to an invoice. we can can check at least if the option is activated or not (added or not) ? Yes, the option will appear on the service or input fields passed to the module when a service is added, updated, or renewed. but how blesta check if a package options is added and it will calculated in the renewal ? If the package option exists on the service, it will be used during renewal. a small question regarding package options , client can order this option when the services is already activated from client area ? Yes, a client could order a package option for a service that already exists. An invoice would be created just for the package option they ordered. if i understand well the case . the option package will be added to the vars of the services when is activated by the module . but i need to know what happen if the option are paid after the service is activated . which function the module will run to handle the request ? in renewal , the option name will be passed to the $vars fields in command ? If an option is added to an already-active service, then your module will be notified about it via it's editService method. On renewal, your module will receive a call to it's renew method, and options will be available as apart of the second argument, $service. now if a client after a domain registration has been made, they have added the package option , and he paid the invoice , how the module will handle the action ? or the options will be added to the services fields until the module make the renew to pass it ? When the package option is added to the service, the service will be updated. This will cause the editService method to be called on your module, as I mentioned above. The package options are included in the third parameter, $vars, apart of $vars['configoptions']. The module has to return without error in order for the service to be updated in Blesta with the fields passed back from the module. logicbox has a command to purchase the privacy after the domain has been activated , is "purchase-privacy()" function . how the module will handle this command ? Here's a work flow: Customer orders a new service. The addService method is called on the module. The module creates the domain remotely, and returns without error to Blesta. Blesta adds the service. Later, the customer orders a package option for the service. The editService method is called on the module. The module evaluates the configurable options in $vars['configoptions'] in comparison with the service fields already set on the service in $service. The module determines that the privacy option set on the service is "false" (default) and has been changed to "true" with new option change. The module makes a remote request to "purchase-privacy()" to change the privacy setting for the domain. On success, the module updates the service fields that it returns to Blesta to indicate the privacy option is now "true". Quote
activa Posted March 24, 2016 Author Report Posted March 24, 2016 @tyson , thanks for this info .... now is all clear , and time to code and test . Quote
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.