Installatie Drupal Commerce 2.x - Casus begin 2017 (3)
Doel: Drupal op de gebruikelijke manier installeren, Drupal Commerce mbv. Composer
Zie ook:
- Composer
- Drupal Console
- Installatie Drupal Commerce 2.x - Casus begin 2017
- Installatie Drupal Commerce 2.x - Casus begin 2017 (2)
- Installatie Drupal Commerce 2.x - Algemeen
Installatie
- Db aangemaakt
- Hostingaccount aangemaakt
- Drupal 8 & standaard-modules gedownload & geïnstalleerd mbv. eigen script + geverifiëerd dat het werkt
- Er staat een composer.json-bestand in de root van de installatie
Drupal Commerce mbv. Composer installeren:
Repository toevoegen
In de root van de installatie: composer config repositories.drupal composer https://packages.drupal.org/8
. Nu toegevoegd aan het json-bestand:
"repositories": { "drupal": { "type": "composer", "url": "https://packages.drupal.org/8" } }
Drupal Commerce downloaden
composer require "drupal/commerce 2.x-dev"
. Nu wordt Drupal Commerce gedownload. Details:
- Bestanden worden geplaatst in /modules, en dus niet in vendor of weet ik veel wat
- De modules zijn nog niet geactiveerd. Lijkt me logisch, want dat is nou net niet iets waar Composer voor is.
Locale instantie Drupal Console aanmaken
- Commando drupal list geeft een foutmelding dat-ie niet locaal is geïnstalleerd, plus twee commando's om dat te fixen, allebei Composer-commando's:
composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader composer update drupal/console --with-dependencies
Dit laatste commando geeft wat onduidelijke feedback:
composer update drupal/console --with-dependencies Dependency "composer/installers" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "doctrine/annotations" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "guzzlehttp/guzzle" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "symfony/css-selector" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "symfony/http-foundation" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "symfony/process" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "symfony/console" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "symfony/dependency-injection" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "symfony/event-dispatcher" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "symfony/process" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "symfony/translation" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "symfony/yaml" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "twig/twig" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "symfony/yaml" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "symfony/console" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "symfony/console" is also a root requirement, but is not explicitly whitelisted. Ignoring. Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 0 installs, 3 updates, 0 removals - Updating psr/log (1.0.0 => 1.0.2): Loading from cache > Drupal\Core\Composer\Composer::vendorTestCodeCleanup - Updating symfony/debug (v2.8.16 => v2.8.18): Loading from cache > Drupal\Core\Composer\Composer::vendorTestCodeCleanup - Updating symfony/dom-crawler (v2.8.16 => v3.0.9): Loading from cache > Drupal\Core\Composer\Composer::vendorTestCodeCleanup Writing lock file Generating autoload files > Drupal\Core\Composer\Composer::preAutoloadDump > Drupal\Core\Composer\Composer::ensureHtaccess
Drupal Commerce installeren mbv. Drupal Console
Commando
drupal module:install commerce_product commerce_checkout commerce_cart commerce_tax
Geeft als output:
drupal module:install commerce_product commerce_checkout commerce_cart commerce_tax One or more modules "commerce_tax" are not available, running download process to get those modules Getting releases for module "commerce_tax" [ERROR] There aren't any releases for module "commerce_tax" [ERROR] Invalid module name: commerce_tax Installing module(s) "commerce_product, commerce_checkout, commerce_cart, commerce, address, entity, inline_entity_form, commerce_price, commerce_store, commerce_order, entity_reference_revisions, profile, state_machine" [OK] The following module(s) were installed successfully: "commerce_product, commerce_checkout, commerce_cart, commerce, address, entity, inline_entity_form, commerce_price, commerce_store, commerce_order, entity_reference_revisions, profile, state_machine" // cache:rebuild Rebuilding cache(s), wait a moment please. [OK] Done clearing cache(s).
Instantie bijwerken
Ik dacht dat je eerst Drupal Commerce moet bijwerken, voordat je Drupal bijwerkt. Dat lijkt niet zo te zijn. Ik vind het trouwens logischer om eerst Drupal bij te werken:
Drupal bijwerken
Commando's:
drupal update:debug drupal update:execute
Complete input en output:
strompf@Dell2017 /var/www/rt3.dvb $ drupal update:debug No pending updates strompf@Dell2017 /var/www/rt3.dvb $ drupal update:execute Switch site into maintenance mode Operating in maintenance mode off // cache:rebuild Rebuilding cache(s), wait a moment please. [OK] Done clearing cache(s).
Drupal Commerce bijwerken
Commando:
composer update drupal/commerce --with-dependencies
Complete input/output:
strompf@Dell2017 /var/www/rt3.dvb $ composer update drupal/commerce --with-dependencies Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update Generating autoload files > Drupal\Core\Composer\Composer::preAutoloadDump > Drupal\Core\Composer\Composer::ensureHtaccess
Basisconfiguratie DC
Dit lijkt te kunnen via Drupal Console, maar nu effe niet.
Valuta specificeren
- Eerst valuta, dan store
- Euro geïmporteerd: Dan kloppen gelijk alle instellingen, zoals ISO 4217 numerieke code.
Store
Spreekt voor zich. Hier moet je de standaardvaluta specificeren. Vandaar dat valuta eerst moest.
Backup
- Hé: Ik kan gelijk al producten invoeren! Zie ook Acro Media - Commerce 2.x Download and Install on Drupal 8, Part 2 of 2 (video) rond 5:36
- Eerst een backup maken:
/home/strompf/drush-backups/archive-dump/20170319124504/rt3.20170319_124505.tar.gz
Producten toevoegen (=p1)
- Je kunt gelijk al producten toevoegen, en het scherm is compleet. Maw.: Je kunt SKU & prijs opgeven. Dat had ik in het verleden niet
- In de video klikt Josh op Create variant. Ik heb de indruk dat het niet uitmaakt of je dat wel of niet doet: Als het een uniek product is, wordt er automatisch een variant mee-gedefineerd
- Twee producten toegevoegd. Eén met create variant, en één zonder
- Nog geen afbeelding voor handen. Logisch, want custom-veld
Dit is p1
Duidelijk dat dit p1 betreft:
- Producten zijn niet beschikbaar onder Content, en ook niet zichtbaar op de home page
- In de database is tabel node nog steeds leeg
- Tabel commerce_product bevat twee regels. Primaire sleutel:
product_id
- Tabel commerce_product_variation bevat ook twee regels. Primaire sleutel:
variation_id
Afbeelding-veld toevoegen (p1)
Commerce » Configuration » Product type:Default » Edit » Manage fields: Veld toevoegen p1_image
- Vervolgens is dit veld ook beschikbaar voor de al bestaande producten. Da's handig!
- Duidelijk dat dit p1 betreft, want nog geen p2-entiteit gedefineerd.
P1 & P2
- Ik geloof dat je altijd minimaal één product variant hebt van een product 19:00
- Products zijn nu een eigen entity type 20:40
- Dit schijnt nu een stuk eenvoudiger te zijn dan in DC1.
Openstaande issues
- Composer kon Drupal Tax niet installeren. Wordt dat een probleem?
- Hoe weet ik hoe ik wat moet downloaden? Welke module is onderdeel van Drupal Commerce en welke niet? Of is dat niet relevant, omdat ik alles van Drupal Commerce al heb gedownload via Composer?
Bronnen
- http://docs.drupalcommerce.org/v2/getting-started/install.html - Deze handleiding gevolgd voor installatie
Video's - General
- Drupal Association - DrupalCon Dublin 2016: Launching online stores with Commerce 2.x on Drupal 8 - Goede inleiding
- Creating online stores with Commerce 2.x on Drupal 8 (video) - Uitgebreid: Libraries, Composer, stores (17:45), Drupal Console (18:00), variation types (23:00), order types (24:00), carts incl. multiple carts (29:00), cart block (34:00), payments (41:00), getting involved (43:00), questions & answers (47:00)
Video's - Configuration
- Acro Media - Commerce 2.x Download and Install on Drupal 8, Part 1 of 2 (video) - Composer, complete Drupalinstallatie via Composer, voordelen Composer, basisinstallatie Drupal, geen configuratie DC
- Acro Media - Commerce 2.x Download and Install on Drupal 8, Part 2 of 2 (video) - DC-configuratie via Drupal Console
- itlabvn.net - Commerce 2.x with Drupal 8 Basic Use Tutorial Part 2 (video) - Gaat verder waar Acro Media stopt. Maakt gebruik van Views om producten te tonen. Er wordt geen P2-entiteit gedefineerd. De view bevat geen add-to-cart-functionaliteit.