Support DragonByte Ecommerce: Country List not showing

spawnfdgod

Registered
In store tab I keep getting this error. I have filled all details in Invoice Options. The only thing left is country but there are no options in the list to select other than NONE
error.png
 
Last edited:

spawnfdgod

Registered
Here's the link for photos of all options for eCommerce :- website options

Still, eCommerce is not working. Showing same errors:- The administrator has not completed the setup of the eCommerce system. The forum's business details must be filled out in the administrator options, under "Invoice Options".

I have filled all options, the only option left is of the country list, in which I have only 1 option i.e None
Can someone help me fix this?
 

swift

Registered
Oops, sorry :)
Is there already a solution? Got the same problem ...

Here's the link for photos of all options for eCommerce :- website options

Still, eCommerce is not working. Showing same errors:- The administrator has not completed the setup of the eCommerce system. The forum's business details must be filled out in the administrator options, under "Invoice Options".

I have filled all options, the only option left is of the country list, in which I have only 1 option i.e None
Can someone help me fix this?
To fix this you will need to remove the following lines from "src\addons\DBTech\eCommerce\Repository\Country.php"

remove from - "public function updateCountryList(): bool"

To

/** @var \DBTech\eCommerce\Entity\Country $country */
foreach ($missingCountries as $country)
{
$country->delete();
}

return true;
} (Here)

Replace it with the following:

Code:
public function updateCountryList(): bool
    {
        $reader = $this->app()
            ->http()
            ->reader()
        ;

        $countryList = null;
     
        try
        {
            $response = $reader->getUntrusted('http://api.countrylayer.com/v2/all?access_key=YOUR_API_KEY');
            if ($response)
            {
                $jsonText = $response->getBody()->getContents();
             
                $response->getBody()->close();
             
                if ($response->getStatusCode() == 200)
                {
                    try
                    {
                        $countryList = \GuzzleHttp\json_decode($jsonText, true);
                    }
                    catch (\InvalidArgumentException $e)
                    {
                        \XF::logException($e, false, 'Security error:');
                        return false;
                    }
                }
                else
                {
                    \XF::logError(\XF::phraseDeferred('received_unexpected_response_code_x_message_y', [
                        'code' => $response->getStatusCode(),
                        'message' => $response->getReasonPhrase()
                    ]));
                    return false;
                }
            }
        }
        catch (\GuzzleHttp\Exception\RequestException $e)
        {
            \XF::logException($e, false, 'eCommerce error:');
            return false;
        }

        if (!is_array($countryList))
        {
            return false;
        }
     
        /** @var \DBTech\eCommerce\Entity\Country[]|\XF\Mvc\Entity\ArrayCollection $existingCountries */
        $existingCountries = $this->findCountriesForList()->fetch();

        $currentCountries = [];
        foreach ($countryList as $country)
        {
            if (!isset($existingCountries[$country['alpha2Code']]))
            {
                /** @var \DBTech\eCommerce\Entity\Country $newCountry */
                $newCountry = $this->em->create('DBTech\eCommerce:Country');
                $newCountry->bulkSet([
                        'country_code' => $country['alpha2Code'],
                        'name' => $country['name'],
                        'native_name' => $country['name'],
                        'iso_code' => $country['alpha3Code'],
                    ]);
                $newCountry->save();
             
                $currentCountries[$country['alpha2Code']] = $newCountry;
            }
            else
            {
                /** @var \DBTech\eCommerce\Entity\Country $newCountry */
                $newCountry = $existingCountries[$country['alpha2Code']];
             
                if ($newCountry->name != $country['name'])
                {
                    $newCountry->fastUpdate('name', $country['name']);
                }
             
                $currentCountries[$country['alpha2Code']] = $newCountry;
            }
        }
     
        $missingCountries = array_diff_key($existingCountries->toArray(), $currentCountries);
     
        /** @var \DBTech\eCommerce\Entity\Country $country */
        foreach ($missingCountries as $country)
        {
            $country->delete();
        }
     
        return true;
    }

Now we need api key from the following website and place api key where you see "YOUR_API_KEY"
UNPJchb.jpg


Save it all and
Then you will need to run the two cron entries:
  1. DragonByte eCommerce: Update country list DragonByte eCommerce
  2. DragonByte eCommerce: Update VAT rates DragonByte eCommerce
Alterative you can download the add-on here you need to uninstall or replace over the files you have - You still need to enter API key from website above and insert it to destination above. You still need to run both cron entries above...

Only files edited was the following:
  • "src\addons\DBTech\eCommerce\Repository\Country.php"
  • "src\addons\DBTech\eCommerce\hashes.json (Prevent errors when installing)
I contacted the admin about this and to update this but received nothing but regardless this will fix it and allow you to run the add-on like normal.
 

DarKMaSK

Loyal Member
Here's the link for photos of all options for eCommerce :- website options

Still, eCommerce is not working. Showing same errors:- The administrator has not completed the setup of the eCommerce system. The forum's business details must be filled out in the administrator options, under "Invoice Options".

I have filled all options, the only option left is of the country list, in which I have only 1 option i.e None
Can someone help me fix this?
Hope you have found the solution.
still doesnt work
@gregor Look at the images uploaded by @spawnfdgod . I saw there is an option 'Default address book country' = 'None'. Set that option and see what happens. I will update after I test it.
 
Back
Top Bottom