Installatie Drupal Commerce 2.x - Casus begin 2017: verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
Regel 214: Regel 214:
  
 
* https://www.drupal.org/node/2716785#comment-11964386 - Goed antwoord, van een leuke vent
 
* https://www.drupal.org/node/2716785#comment-11964386 - Goed antwoord, van een leuke vent
 +
 +
''' Officiële documentatie '''
 +
 +
* http://docs.drupalcommerce.org/v2/index.html - Startpagina: Modules, libraries & tools
 +
* http://docs.drupalcommerce.org/v2/getting-started/index.html - Getting started
 +
** http://docs.drupalcommerce.org/v2/getting-started/composer.html - Using Composer
 +
** http://docs.drupalcommerce.org/v2/getting-started/install.html - Installing
 +
** http://docs.drupalcommerce.org/v2/getting-started/update.html - Keeping a Drupal Commerce site up to date
 +
** http://docs.drupalcommerce.org/v2/getting-started/contributing/index.html - Contributing
 +
** http://docs.drupalcommerce.org/v2/getting-started/contributing/development-environment.html - Getting ready for development
 +
* http://docs.drupalcommerce.org/v2/building-blocks/index.html - Libraries and dependencies
 +
** http://docs.drupalcommerce.org/v2/building-blocks/address.html - Address
 +
** http://docs.drupalcommerce.org/v2/building-blocks/profile.html - Profile
 +
** http://docs.drupalcommerce.org/v2/building-blocks/state-machine.html - State Machine
 +
** http://docs.drupalcommerce.org/v2/building-blocks/ief.html - Inline Entity Form 8.x-2.x
 +
* http://docs.drupalcommerce.org/v2/currency.html - Currencies
 +
* http://docs.drupalcommerce.org/v2/store.html - Setting up stores
 +
* http://docs.drupalcommerce.org/v2/product/index.html - Products
 +
** http://docs.drupalcommerce.org/v2/product/product-attributes.html - Setup product attributes
 +
** http://docs.drupalcommerce.org/v2/product/products.html - Make a product
 +
** http://docs.drupalcommerce.org/v2/product/product-type.html - Create a product type (lege pagina)
 +
** http://docs.drupalcommerce.org/v2/product/purchasable-entities.html - Purchasable Entities (behoorlijk lege pagina)
 +
* http://docs.drupalcommerce.org/v2/product/catalog-and-product-pages.html - Catalog and product pages
 +
** http://docs.drupalcommerce.org/v2/product/create-a-product-catalog.html - Create a product catalog
 +
** http://docs.drupalcommerce.org/v2/product/customize-the-add-to-cart-form.html - Customize the add to cart form
 +
** http://docs.drupalcommerce.org/v2/product/theme-a-product-page.html - Theme a product page
 +
* http://docs.drupalcommerce.org/v2/using-promotions.html - Product merchandising (lege pagina)
 +
* http://docs.drupalcommerce.org/v2/creating-a-promotion.html - Create a promotion (lege pagina)
 +
* http://docs.drupalcommerce.org/v2/orders/index.html - Orders
 +
* http://docs.drupalcommerce.org/v2/orders/order-types.html - Order Types
 +
* http://docs.drupalcommerce.org/v2/orders/order-items.html - Order Items
 +
* http://docs.drupalcommerce.org/v2/orders/order-processing.html - Order Processing
 +
* http://docs.drupalcommerce.org/v2/checkout/index.html - Configuring your checkout
 +
** http://docs.drupalcommerce.org/v2/checkout/guest.html - Allowing guest checkout, or account login
 +
** http://docs.drupalcommerce.org/v2/checkout/customize.html - Customizing your checkout
 +
** http://docs.drupalcommerce.org/v2/checkout/checkout-pane-plugin.html - Creating a checkout pane plugin
 +
** http://docs.drupalcommerce.org/v2/checkout/creating-a-checkout-flow-plugin.html - Creating a checkout flow plugin
 +
* http://docs.drupalcommerce.org/v2/payments/index.html - Setting up payments
 +
** http://docs.drupalcommerce.org/v2/payments/available-payment-gateways.html - Available payment gateways
 +
** http://docs.drupalcommerce.org/v2/payments/install-a-payment-gateway.html - Install a payment gateway
 +
** http://docs.drupalcommerce.org/v2/payments/managing-order-payments.html - Managing order payments
 +
* http://docs.drupalcommerce.org/v2/recipes/index.html - Code Recipes
 +
** http://docs.drupalcommerce.org/v2/recipes/stores.html - Store recipes
 +
** http://docs.drupalcommerce.org/v2/recipes/variations.html - Product Variations and types
 +
** http://docs.drupalcommerce.org/v2/recipes/attributes.html - Product Attributes and Values
 +
** http://docs.drupalcommerce.org/v2/recipes/products.html - Products and types
 +
** http://docs.drupalcommerce.org/v2/recipes/orders.html - Orders and order items
 +
** http://docs.drupalcommerce.org/v2/recipes/state-machine-transitions.html - State Machine Transitions
  
 
''' Configuratie Drupal Commerce '''
 
''' Configuratie Drupal Commerce '''

Versie van 13 mrt 2017 08:54

Zie ook Composer & Drupal Console.

Er is geen ontkomen aan: Drupal Commerce kun je alleen via Composer installeren [1], [2]. Daarmee wordt het terminal-commando composer bedoeld, niet de Drupal-module. Je kunt Drupal Commerce 2.x dus waarschijnlijk alleen installeren als je terminal-toegang hebt.

Requirements

Zie de casus hieronder voor details. Deze lijst is niet compleet. Ook is er niet aangegeven welke dingen je expliciet zelf moet regelen.

Composer

Drupal-modules

  • Zie hieronder + [3]
  • Zie de casus hieronder voor meer afhankelijkheden.

PHP-libraries - Algemeen

php-bcmath

Deze module heb je al bij de installatie nodig, maar ook later tijdens aanmaak van producten. Deze installatie speelde zich af op een redelijk frisse LAMP-server. Oorspronkelijk probeerde ik php 7.1 te gebruiken, maar toen die moeilijk deed, ben ik overgestapt op php 7.0, althans dat dacht ik;

Oorspronkelijke installatie: sudo apt-get install php-bcmath. Dat bleek echter de php 7.1-versie te installatie. De php 7.0-versie geïnstalleerd middels sudo apt-get install php7.0-bcmath

php-gd

Installatie voor PHP 7.1:

sudo apt-get install gd

Installatie voor PHP 7.0:

sudo apt-get install php7.0-gd

PHP-libraries - Specifiek

Drupal Console

Drupal Commerce wordt aangeraden.

Casus - feb. 2017

Installatie Drupal Commerce

  • Basissite geïnstalleerd mbv. eigen script
  • Composer geïnstalleerd middels sudo apt-get install composer
  • Vanuit de root van die installatie: composer config repositories.drupal composer https://packages.drupal.org/8 - Geen foutmeldingen
  • composer require "drupal/commerce 2.x-dev" gaf foutmelding:
Problem 1
    - easyrdf/easyrdf 0.9.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - easyrdf/easyrdf 0.9.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - easyrdf/easyrdf 0.9.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - Installation request for easyrdf/easyrdf == 0.9.1.0 -> satisfiable by easyrdf/easyrdf[0.9.1].
  • sudo apt-get install php-mbstring
  • composer require "drupal/commerce 2.x-dev". Gelukt zonder foutmelding, met veel output
  • drupal module:install commerce_product commerce_checkout commerce_cart commerce_tax geeft foutmelding: Commando drupal is niet bekend
  • Drupal Console Geïnstalleerd
  • drupal module:install commerce_product commerce_checkout commerce_cart commerce_tax - Opnieuw foutmelding: Je moet Drupal Console ook locaal installeren per instantie:
  • composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
  • composer update drupal/console --with-dependencies: Wat onduidelijke waarschuwingen over whitelisting, maar verder ok
  • drupal module:install commerce_product commerce_checkout commerce_cart commerce_tax - gelukt. Output:
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).

Updaten

Updaten van Drupal Commerce gaat via:

composer update drupal/commerce --with-dependencies

Updaten van de site-als-geheel via Drupal Console ( updaten Drupal Commerce!):

drupal update:debug
drupal update:execute

Installatie additionele modules

Dat gaat op de gebruikelijke manier, lijkt me. Alleen officiele Drupal Commerce modules gaan via Composer. Tot op dit moment nog geen additionele modules geïnstalleerd.

Configuratie Drupal

CKEditor uitzetten

Administration » Configuration » Content authoring » Text format & Editors

Gelukkig: Er worden nu ook geen HTML-tags meer ongevraagd toegevoegd!

Full HTML als standaard instellen (voor admin)

Zelfde link als hierboven: De volgorde aanpassen van de formats.

'Powered by Drupal'-block verwijderen

Gewoon onder Strucure.

Plugin not found-error bij uploaden afbeelding

Foutmelding

Drupal\Component\Plugin\Exception\PluginNotFoundException: 
The "" plugin does not exist. 
in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() 
(line 52 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php)

Installatie file_browser

Ik had de indruk dat de installatie van de dev-versie van file_browser zou kunnen helpen. Drie libraries en vijf moduled verder, bleek dat niet het geval te zijn → Al die zooi weer verwijderd.

Overig

  • Clearing cache hielp niet

Oplossing

Wéér had ik van een module de PHP 7.1-versie ipv. de PHP 7.0-versie.

sudo apt-get install php7.0-gd
sudo service apache2 restart

En het probleem was verholpen.

Configuratie Drupal Commerce

Valuta

  • Eerst valuta, dan stores
  • Alleen euro

Stores

Je moet eerst een store configureren voordat je met producten aan de slag kunt

Product attributes

Product attributes heeft betrekking op variaties zoals bv. kleur of maat. Dat speelt hier niet.

P1 & P2

Net als in DC 1.x, is er een onderscheid tussen achterliggende producten (ik noem die P1) en de representatie daarvan (ik noem die P2). Alleen de termen zijn veranderd, of zoiets:

P1

  • DC 1.x: Commerce Product (?)
  • DC 2.x: Product

P2

  • DC 1.z: Product display. Dit zijn nodes
  • DC 2.x: Product variation. Als je geen gebruik wilt maken van product variations (bv. verschillende maten of kleuren), dan ben je gelijk klaar. Je hoef dus niet een of andere P2-entiteit te defineren, want die is er al, met de creatieve name default.

P1-definitie aanpassen

Zo uit de does, is P1 nogal kaal. Onder andere is het wel geinig om 'm op te luisteren met een productafbeelding:

Productafbeeldingen

  • Naam: p1_image
  • Aantal: Onbeperkt.

Products » Add product

Foutmelding:

RuntimeException: The bcmath extension is required by NumberFormatter. 
in CommerceGuys\Intl\Formatter\NumberFormatter->__construct() 
(line 113 of vendor/commerceguys/intl/src/Formatter/NumberFormatter.php).

Bronnen

Plugin not found-error

Officiële documentatie

Configuratie Drupal Commerce