Installatie Drupal Commerce 2.x - Casus begin 2017: verschil tussen versies
Regel 193: | Regel 193: | ||
|[[file:20170313-1557.png|thumb|'''Product variation type:''' <code>Admin » Commerce » Configuration » Product variation type</code>: Geen ''product variation'' gedefineerd: Ik ben benieuwd of dat geen probleem is]] | |[[file:20170313-1557.png|thumb|'''Product variation type:''' <code>Admin » Commerce » Configuration » Product variation type</code>: Geen ''product variation'' gedefineerd: Ik ben benieuwd of dat geen probleem is]] | ||
|} | |} | ||
+ | |||
+ | === Product types === | ||
+ | |||
+ | Naast ''product variation types'' heb je ook nog ''product types''. Daar lijk je product variaties te associeren met kale producttypes, en niet bij ''product variation type'' ofzoiets. Voor nu geloof ik het wel. | ||
=== Product Variants === | === Product Variants === |
Versie van 13 mrt 2017 17:56
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.
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 outputdrupal 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 okdrupal 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
Eerst Drupal Commerce updaten
Updaten van Drupal Commerce gaat via:
composer update drupal/commerce --with-dependencies
Daarna de rest updaten
Updaten van de site-als-geheel via Drupal Console (ná 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.
Valuta & store
Valuta
- Eerst valuta, dan stores
- Alleen euro
Store
Je moet eerst een store configureren voordat je met producten aan de slag kunt
Producten, variaties & representaties
Er een gelaagd systeem van producten en de weergave daarvan. Het is echter niet hetzelfde systeem als in DC1. Enkele termen die zoal een rol spelen:
- Product type - Waarschijnlijk wat ik P1 noem. Bv. t-shirts
- Products of product variations - Bv. een fysiek t-shirt met een bepaalde kleur en maat
- Product attributes - Bv. kleur (rood, zwart), en maat (S, M, L)
- Purchasable entities - ?
- Product fields - Los van product attributes, kun je producten opleuken met allerlei velden
Product attributes
Bij product attributes moet je denken aan bv. verschillende maten of kleuren. Definitie gaat via Admin » Commerce » Product attributes
. Product attributes staan in dit stadium helemaal los van producten of wat dan ook. Ze moeten nog gekoppeld worden.
Product variation type
Door product attributes te associeren met producten, krijg je product variation types. Ook als je geen gebruik maakt van product attributes, schijn je tenminste één product variation type nodig (we gaan het zien). Je vindt ze onder [4]
Admin » Commerce » Configuration » Product variation types
Product types
Naast product variation types heb je ook nog product types. Daar lijk je product variaties te associeren met kale producttypes, en niet bij product variation type ofzoiets. Voor nu geloof ik het wel.
Product Variants
De handleiding legt oa. hier uit, dat je altijd minimaal één productvariant moet defineren.
Producten
De volgende stap: Producten toevoegen. In tegenstelling tot DC1, is er gelijk al een product-entiteit beschikbaar, ook als je nix configureert. Je vindt producten via:
Commerce » Products
Foutmelding: Field variations is unknown
Oh oh:
The website encountered an unexpected error. Please try again later. InvalidArgumentException: Field variations is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 471 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).
Dit lijkt een bug te zijn op het snijvlak van Drupal Commerce en iets met talen. De producten worden wél opgeslagen, maar ik kan ze daarna niet 'gewoon' bekijken. Dus negeren is geen optie. Een mogelijke tijdelijke oplossing: Meertaligheid uitzetten → Producten invoeren → Dan pas iets met meertaligheid doen.
Desalniettemin: Voordat ik deze webshop ontdaan had van allerlei toeters en bellen, deed deze pagina 't wel. In het bijzonder: De handleiding zegt regelmatig (oa. hier dat je minimaal één productvariant nodig hebt.
Manage display (P2)
De presentatie van producten noem ik P2, vanwege de verwarrende naamgeving. Deze kun je op twee plekken aanpassen:
Admin » Commerce » Config » Product type
Admin » Commerce » Config » Product variation type
P1
In DC1 gebruikte ik de term P1 voor de achterliggende producten. Ik weet niet precies of dat correspondeert met DC2.
P1-definitie aanpassen
Zo uit de doos, 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).
Overig
- In DC2 kun je meerdere stores configureren. Daardoor schijn je marktplaatsen te kunnen bouwen [5]
Bronnen
- http://docs.drupalcommerce.org/v2/getting-started/install.html » Dit zijn de officiële installatie-instructies
- https://www.drupal.org/node/2351795 - Drupal Commerce 2.x Advanced Installation Instructions
- https://www.drupal.org/node/2405811 - Composer Manager for Drupal 8 » Bijzaak
- https://www.youtube.com/watch?v=XOy0sR9NPxM - Commerce 2.x Download and Install on Drupal 8, Part 1 of 2 (june 2016)
- https://www.youtube.com/watch?v=CrJrjgOuvSk - Commerce 2.x Download and Install on Drupal 8, Part 2 of 2 (june 2016)
- https://pantheon.io/drupal-8/introduction-drush-and-drupal-console
- http://ckeditor.com/slides/ckeditor-in-drupal-8
Plugin not found-error
- https://www.drupal.org/node/2716785#comment-11964386 - Goed antwoord, van een leuke vent
Field variations-error
- https://www.drupal.org/node/2835576 - InvalidArgumentException: Field uuid is unknown
- https://www.drupal.org/node/2837547 - Product creation failed
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
- http://internetdevels.com/blog/the-commerce-2x-module-for-Drupal-8 - Hele procedure: Aardig!
- http://docs.drupalcommerce.org/v2/currency.html
- https://www.drupal.org/node/2816739 - Unable to create New products, (Unexpected Error)
- http://docs.drupalcommerce.org/v2/product/index.html - Products, attributes, purchasable entities
- http://docs.drupalcommerce.org/v2/product/product-attributes.html