Jump to content
  • 0

Domain package group architecture


EuroDomenii

Question

Before jumping into domain package group architecture, I didn’t find a way to change the default value from interface https://docs.blesta.com/display/user/Domain+Manager#DomainManager-Advanced Here it says:

  • Setting - TLD Package Group
  • Default value - TLDs Pricing Packages
  • Description - The package group to which all TLD packages will be assigned.

But there’s no such setting at admin/plugin/domains/admin_domains/configuration/?tab=advanced

Anyway, the default value is 1, in the company_settings table.
The setup workflow is somehow by design stealth, maybe for the benefit of non-advanced user setups. 

This default package group is hidden at admin/packages/groups/ ( becomes visible by Toggle filters with Show Hidden Package Groups ) 

By default, creating a TLD assign this domain package group via private function createPackage(array $vars), from plugins\domains\models\domains_tlds.php

// Set package group id
        if (!isset($vars['package_group_id'])) {
            $domains_package_group = $this->Companies->getSetting(
                $vars['company_id'],
                'domains_package_group'
            );

Let’s imagine the scenario in which I would like to have another domain package group, in order to set up a different order form.  

You would have to find the hidden package admin/packages/ ( by Toggle filters with Show Hidden Packages) , and assign a different group membership. 

The downside of working with different domain package groups from the company setting, is that you miss all the cron goodies. 

Let's take a look at the cron task from plugins\domains\domains_plugin.php ( listed in GUI at /admin/settings/company/plugins/settings/IdPlugin/automation/ ), the services are restricted to $settings['domains_package_group'] of the company

private function synchronizeDomains()

$company_id = Configure::get('Blesta.company_id');
        $settings = $this->Form->collapseObjectArray($this->Companies->getSettings($company_id), 'value', 'key');
        if (!isset($settings['domains_package_group'])) {
            return;
        }

        // Find all domain services
        $services = $this->Services->getAll(
            ['date_added' => 'DESC'],
            true,
            ['package_group_id' => $settings['domains_package_group']]
        );

 

private function cronDomainTermChange()

// Find all domain services that do not have a 1 year pricing term
        $services = $this->Services->getAll(
            ['date_added' => 'DESC'],
            true,
            [
                'package_group_id' => $settings['domains_package_group'],
                'excluded_pricing_term' => 1,
                'pricing_period' => 'year'
            ]
        );

 

private function cronDomainRenewalReminders()


// Fetch all qualifying services
            $services = $this->Services->getAll(
                ['date_added' => 'DESC'],
                true,
                [],
                [
                    'services' => [
                        'package_group_id' => $settings['domains_package_group'],
                        ['column' => 'date_renews', 'operator' => '>=', 'value' => $start_date],
                        ['column' => 'date_renews', 'operator' => '<=', 'value' => $end_date]
                    ]
                ]
            );


Even the spotlight_tlds work only for one company domain_package_group.

if (!empty($spotlight_tlds)
            && $domains_package_group
            && $meta['domain_group'] == $domains_package_group->value
        ) {
            $this->view->set('spotlight_tlds', $spotlight_tlds);
        }

This was the very first one that caught my attention. Hacking by eliminating the condition $meta['domain_group'] == $domains_package_group->value would do the job, but , for the rest, it seems too much to hack.

private function addTldPackageGroup from plugins\domains\domains_plugin.php, // Check if there is a package group collision between all system companies, I would assume that, by design, there should be one package domain group per company.

Add a package group for hiding and managing TLDs

// Check if there is a package group collision between all system companies
        $domains_package_group = $this->Companies->getSetting($company_id, 'domains_package_group');
        $companies = $this->Companies->getAll();

        foreach ($companies as $company) {
            $company_domains_package_group = $this->Companies->getSetting($company->id, 'domains_package_group');

            if ($company_domains_package_group->value == $domains_package_group->value && $company->id != $company_id) {
                // A collision was found, unset the domains_package_group setting for the current company
                $this->Companies->unsetSetting($company_id, 'domains_package_group');
                break;
            }
        }

Including import package private function importPackage(

On the other hand, public function getSettings(array $vars = null) from plugins\order\lib\order_types\domain\order_type_domain.php, this takes into the account the other custom group.

// If the "Domain Manager" plugin is installed, then default to it's package group for domain order forms
        $domain_package_group = $this->Companies->getSetting(
            Configure::get('Blesta.company_id'),
            'domains_package_group'
        );
        if (!isset($vars['meta']['domain_group']) && $domain_package_group) {
            $vars['meta']['domain_group'] = $domain_package_group->value;
        }


In order to fit this architecture, I should assign all TLDs to a single domain package group. But, in this case, could I have different order forms for different domain groups? 

By design,  it seems that there is for each company only one TLD package group . I would enjoy the flexibility for a single company to have  multiple order forms with domains.

Thx! 
 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

If I understand, you want to create different Domain Package Groups for different order forms? So that you can offer certain TLDs on an order form, and others on a different order form? Or have different pricing for TLDs on different order forms?

This is not currently supported, but might be something we want to look at. I can see this being useful, but in order for this to work there would need to be a way to "switch" between different domain package groups under TLD Pricing, so that when you edit TLDs it's for a specific group. Right now, only the 1 group is supported.

Am I on the right track? What's your use case for having multiple domain groups?

Link to comment
Share on other sites

  • 0
6 hours ago, Paul said:

So that you can offer certain TLDs on an order form, and others on a different order form? 

Exactly!

My use case is selling subdomains ( we’ve done a fork of generic_domains with internal whois).  This really needs a separate order form.

However, I guess that even separating order forms of new gTLDs versus classic TLDs, would be another use case. 

 

Link to comment
Share on other sites

  • 0
23 hours ago, EuroDomenii said:

Exactly!

My use case is selling subdomains ( we’ve done a fork of generic_domains with internal whois).  This really needs a separate order form.

However, I guess that even separating order forms of new gTLDs versus classic TLDs, would be another use case. 

 

I've created this task https://dev.blesta.com/browse/CORE-4586

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