septembre 2018

Magento 2 : Ajouter des link alternate sur les pages cms

Sur magento 2 ( comme sur magento 1 ) , les contenus et notamment les pages cms sont accessibles via plusieurs url avec ou sans slash à la fin.

Vous pouvez le constater sur la page de la politique de confidentialité qui est à la fois disponible sous les urls :
http://magento2-demo.nexcess.net/privacy-policy-cookie-restriction-mode et http://magento2-demo.nexcess.net/privacy-policy-cookie-restriction-mode/

Au niveau Seo c’est assez moyen c’est pourquoi il est utile de préciser à Google quelle est la version à indexer.
Ceci peut être réalisé via l’ajout d’une balise link rel= »canonical ».

Nous allons voir ensemble comment réaliser cela pour magento 2 via un module qui s’appellera Hhennes/Cms
Ce module ajoutera automatiquement une balise canonical sur les pages cms, il est possible de configurer en back office quelle sera l’url à utiliser ( avec ou sans le slash )

Ce module sera dépendant du module Magento_Cms.

Je vais juste détailler le fonctionnement global, vous trouverez le lien vers github en fin d’article pour le télécharger. (sans la partie création initiale )

La logique est relativement simple , nous allons rajouter un block spécifique sur les pages cms dans le container « head.additional …

Magento 2 : Ajouter des link alternate sur les pages cms Lire la suite »

Magento : Liste des ressources utilisables dans system.xml

Un petit article rapide d’aide mémoire pour la gestion des fichiers system.xml dans magento 1 .
Ces fichiers peuvent utiliser souvent les éléments suivants :

 Source Model

Il doivent être utilisés pour des champs de types « select » ou « multiselect »

Ex :

<demo_field_source translate="label">
    <label>Demo Field source model</label>
    <frontend_type>select</frontend_type>
    <!-- Définition de la source -->
    <source_model>adminhtml/system_config_source_yesno</source_model>
    <!-- Fin Définition de la source -->
    <sort_order>1</sort_order>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <show_in_store>1</show_in_store>
</demo_field_source>

Les plus utiles à retenir sont les suivants :

  • adminhtml/system_config_source_yesno ( Oui / Non )
  • adminhtml/system_config_source_country (Liste des pays )
  • adminhtml/system_config_source_cms_page ( Liste des pages cms )
  • adminhtml/system_config_source_email_template ( Listes des emails transactionnels )

Liste complète :

adminhtml/system_config_source_yesno
adminhtml/system_config_source_admin_page
adminhtml/system_config_source_catalog_gridPerPage
adminhtml/system_config_source_catalog_listMode
adminhtml/system_config_source_catalog_listPerPage
adminhtml/system_config_source_catalog_listSort
adminhtml/system_config_source_catalog_search_type
adminhtml/system_config_source_catalog_timeFormat
adminhtml/system_config_source_checktype
adminhtml/system_config_source_cms_page
adminhtml/system_config_source_cms_wysiwyg_enabled
adminhtml/system_config_source_country
adminhtml/system_config_source_cron_frequency
adminhtml/system_config_source_currency
adminhtml/system_config_source_currency_service
adminhtml/system_config_source_customer_address_type
adminhtml/system_config_source_customer_forgotpassword
adminhtml/system_config_source_customer_group
adminhtml/system_config_source_design_robots
adminhtml/system_config_source_email_identity
adminhtml/system_config_source_email_method
adminhtml/system_config_source_email_smtpauth
adminhtml/system_config_source_email_template
adminhtml/system_config_source_enabledisable
adminhtml/system_config_source_frequency
adminhtml/system_config_source_locale
adminhtml/system_config_source_locale_currency_all
adminhtml/system_config_source_locale_timezone
adminhtml/system_config_source_locale_weekdaycodes
adminhtml/system_config_source_locale_weekdaycodes
adminhtml/system_config_source_locale_weekdays
adminhtml/system_config_source_nooptreq
adminhtml/system_config_source_notification_frequency
adminhtml/system_config_source_order_status_new
adminhtml/system_config_source_order_status_newprocessing
adminhtml/system_config_source_order_status_processing
adminhtml/system_config_source_payment_allspecificcountries
adminhtml/system_config_source_payment_cctype
adminhtml/system_config_source_price_scope
adminhtml/system_config_source_price_step
adminhtml/system_config_source_product_thumbnail
adminhtml/system_config_source_reports_scope
adminhtml/system_config_source_security_domainpolicy
adminhtml/system_config_source_shipping_allspecificcountries
adminhtml/system_config_source_shipping_flatrate
adminhtml/system_config_source_shipping_tablerate
adminhtml/system_config_source_shipping_taxclass
adminhtml/system_config_source_storage_media_database
adminhtml/system_config_source_storage_media_storage
adminhtml/system_config_source_store
adminhtml/system_config_source_tax_apply_on
adminhtml/system_config_source_tax_basedon
adminhtml/system_config_source_watermark_position
adminhtml/system_config_source_web_redirect
adminhtml/system_config_source_yesno
adminhtml/system_config_source_yesnocustom
backup/config_source_type
captcha/config_font
captcha/config_form_backend
captcha/config_form_frontend
captcha/config_mode
catalog/product_attribute_source_msrp_type
cataloginventory/source_backorders
checkout/config_source_cart_summary
configurableswatches/system_config_source_catalog_product_configattribute
configurableswatches/system_config_source_catalog_product_configattribute_select
customer/config_share
downloadable/system_config_source_contentdisposition
downloadable/system_config_source_orderitemstatus
googleanalytics/system_config_source_type
googlebase/source_accounttype
googlebase/source_country
log/adminhtml_system_config_source_loglevel
pagecache/system_config_source_controls
paygate/authorizenet_source_cctype
paygate/authorizenet_source_cctype
paygate/authorizenet_source_paymentAction
payment/source_invoice
paypal/config::getApiAuthenticationMethods
paypal/config::getExpressCheckoutBASignupOptions
paypal/config::getExpressCheckoutButtonFlavors
paypal/config::getExpressCheckoutSolutionTypes
paypal/config::getPayflowproCcTypesAsOptionArray
paypal/config::getWppCcTypesAsOptionArray
paypal/config::getWppPeCcTypesAsOptionArray
paypal/system_config_source_bmlPosition::getBmlPositionsCCP
paypal/system_config_source_bmlPosition::getBmlPositionsCheckout
paypal/system_config_source_bmlPosition::getBmlPositionsCPP
paypal/system_config_source_bmlPosition::getBmlPositionsHP
paypal/system_config_source_bmlSize::getBmlSizeCCPC
paypal/system_config_source_bmlSize::getBmlSizeCCPS
paypal/system_config_source_bmlSize::getBmlSizeCheckoutC
paypal/system_config_source_bmlSize::getBmlSizeCheckoutN
paypal/system_config_source_bmlSize::getBmlSizeCPPC
paypal/system_config_source_bmlSize::getBmlSizeCPPN
paypal/system_config_source_bmlSize::getBmlSizeHPH
paypal/system_config_source_bmlSize::getBmlSizeHPS
paypal/system_config_source_buyerCountry
paypal/system_config_source_fetchingSchedule
paypal/system_config_source_logo
paypal/system_config_source_merchantCountry
paypal/system_config_source_paymentActions
paypal/system_config_source_paymentActions_express
paypal/system_config_source_requireBillingAddress
paypal/system_config_source_urlMethod
paypal/system_config_source_yesnoShortcut
salesrule/system_config_source_coupon_format
shipping/source_handlingAction
shipping/source_handlingType
tax/system_config_source_algorithm
tax/system_config_source_apply
tax/system_config_source_priceType
tax/system_config_source_tax_country
tax/system_config_source_tax_display_type
tax/system_config_source_tax_region
usa/shipping_carrier_abstract_source_mode
usa/shipping_carrier_abstract_source_requesttype
usa/shipping_carrier_dhl_international_source_contenttype
usa/shipping_carrier_dhl_international_source_method_doc
usa/shipping_carrier_dhl_international_source_method_freedoc
usa/shipping_carrier_dhl_international_source_method_freenondoc
usa/shipping_carrier_dhl_international_source_method_nondoc
usa/shipping_carrier_dhl_international_source_method_size
usa/shipping_carrier_dhl_international_source_method_unitofmeasure
usa/shipping_carrier_dhl_source_dutypaymenttype
usa/shipping_carrier_dhl_source_freemethod
usa/shipping_carrier_dhl_source_method
usa/shipping_carrier_dhl_source_protection_rounding
usa/shipping_carrier_dhl_source_protection_value
usa/shipping_carrier_dhl_source_shipmenttype
usa/shipping_carrier_fedex_source_dropoff
usa/shipping_carrier_fedex_source_freemethod
usa/shipping_carrier_fedex_source_method
usa/shipping_carrier_fedex_source_packaging
usa/shipping_carrier_fedex_source_unitofmeasure
usa/shipping_carrier_ups_source_container
usa/shipping_carrier_ups_source_destType
usa/shipping_carrier_ups_source_freemethod
usa/shipping_carrier_ups_source_method
usa/shipping_carrier_ups_source_originShipment
usa/shipping_carrier_ups_source_pickup
usa/shipping_carrier_ups_source_type
usa/shipping_carrier_ups_source_unitofmeasure
usa/shipping_carrier_usps_source_container
usa/shipping_carrier_usps_source_freemethod
usa/shipping_carrier_usps_source_machinable
usa/shipping_carrier_usps_source_method
usa/shipping_carrier_usps_source_size
weee/config_source_display
weee/config_source_fpt_tax
wishlist/config_source_summary

 

 Frontend Model :

Le frontend model est un block de template magento  et  qui permets de gérer un affichage particulier pour l’élément de configuration.…

Magento : Liste des ressources utilisables dans system.xml Lire la suite »