How to get current product id from custom block?

How to get current product id from custom block?

I’ve problem to get current product id from custom block displayed on product page. Here my code : class TestBlock extends BlockBase { public function build() { $product = Drupal::routeMatch()->getParameter(‘node’); $productid =... read more
How to get current product id from custom block?

Change the product status after checkout_complete

I have one ‘select’ field in product page it has value ‘Open’, ‘Closed’.I want to changed to ‘Closed’ after completing the first order of this product. There is one issue which someone answered for Drupal 7 and it is... read more
How to get current product id from custom block?

How to use another php version for drush 9?

On live server I use differents drush and php versions for drupal 8.4 and 7. I install drush 9 to ~/drush9 directory with composer require drush/drush:9.* command. On dev server and drupal 8.4 I use site.alias.yml file for drush 9: live: host: hostingexample.com user:... read more
SMTP Module not sending email

SMTP Module not sending email

Using XAMPP on Mac I have installed https://www.drupal.org/project/smtp After setting up admin/config/system/smtp It gives above error. Unable to send test email. Do we have to any setting on gmail or i’m missing anything? read more
How to get current product id from custom block?

How to execute ajax action after image file upload with media widget?

I want to prepopulate some node fields with image metadata (using the EXIF module) right after an image is uploaded/inserted in a node image field with media browser widget and before the node is being saved. By default, the EXIF module updates the node fields with... read more
How to get current product id from custom block?

Hide a view if there are no results

(Spin-off of Remove/Hide the block if the View is empty?. I find the other question a bit confusing, and want to reduce it to the essential question.) When rendering a view programmatically, and there are no results, there is still some HTML returned from... read more
How to get current product id from custom block?

Drush @sites not implemented in drush 9

Since drush 9 (drupal 8.4 requirement), alias @sites does not seem to be implemented anymore (or yet ?). $ drush @sites cr The alias @sites could not be found. Is this a way to get the same behavior that does not consist of typing my 300 alias in a config file... read more
‘The alias is already in use’ when editing a node that had an alias generated programmatically

‘The alias is already in use’ when editing a node that had an alias generated programmatically

I’m currently using an event subscriber to latch onto an event from a module that creates and/or updates nodes. I’m programmatically setting the url alias based on a user inputted field by doing the following $path =... read more
How to get current product id from custom block?

What does it mean "Rebuilding" in a feature? Can it be resolved?

I did some changes in my local environment, then I updated the ‘feature’. When I try to deploy the change to another environment, but before I can start the ‘revert’ operation, some parts of the feature are marked as ‘Rebuilding’.... read more
How to get current product id from custom block?

Display Entity Reference field twice, with different display modes

I have a content type (Type A) that has an Entity Reference field to another content type (Type B). Type B has 3 fields and 2 display modes. Display A shows two of the fields, Display B shows the other field. In the display settings for Type A, the display mode for... read more
How to get current product id from custom block?

Modal Error Messages Displaying on Main page

I have a page. Once i click on Button on that page. It opens jQuery Modal. In that Modal Box. I’m rendering Form. I have put 1 fields test as required true. Issue is when I click on Submit button. It closes Modal Box & showing errors on Main Page. I need... read more
How to get current product id from custom block?

Fatal error while editing and deleting menu items

Facing one issue in deleting the menu items on my Drupal 8 Site. Steps to reproduce: Add a link to main menu. Create Child terms under one link. Delete the parent term. After deleting the parent link child links stays they don’t get deleted automatically. If you... read more
How to get current product id from custom block?

MailChimp + Drupal 8: How to install properly? (page could not be found)

In order to install MailChimp in Drupal 8 I followed the instructions for the MailChimp Drupal module. Instructions for 8.x-1.x The 8.x-1.x release uses version 3.0 of the MailChimp API and bundles the library with the module. This is a temporary solution until the... read more
How to get current product id from custom block?

User registration without email address OR registration with pseudo-email address

I am programmatically creating users for the roles Parent (Adult) & Child (minor). During registration, minors (Children) typically will not have email addresses but Drupal user registration requires email address. During registration of minor, unfortunately, the... read more
How to get current product id from custom block?

How to show a menu link that is hidden because the role has no permission to see the linked page?

I need show a menu link that links to /node/add/article for anonymous users but they don’t have access to that page. I have seen solutions like: Using an absolute URL (that way Drupal does not check user access). Alter the menu access callback but I do not... read more
How to get current product id from custom block?

Get $form_state values from individual entity form fields

I have a weird use case. I created a custom form with some fields and I added some other fields from one entity form like this: public function buildForm(array $form, FormStateInterface $form_state) { $entity_fields = array(‘entity_field_1’,... read more
How to get current product id from custom block?

Redirect to 404 page, if the path alias doesn’t exist

I am developing a multilingual site in Drupal 8. I added content in Turkish and I didn’t create any translation for that node. I managed to redirect user to the path alias. For example, when users visit https://example.com/tr/node/123, they are redirected to... read more
How to get current product id from custom block?

How to filter a View by Year and Month with Summaries for each one

or How to remove the exception parameter of a View’s contextual filter Hi, In Drupal 7 I have a View with two contextual filters (date field): /view-url/YEAR/MONTH When YEAR is the first argument and if there is none I make a Summary of the view, so the result... read more
How to get current product id from custom block?

Migration of CSV into paragraphs fails with unexpected error

I try to import CSV files into a Drupal 8 installation but I can’t manage to make the relationship to paragraphs appear. I followed the steps of this tutorial but can’t figure out how to make it work. I created a simple test case to find the error: I... read more
How to get current product id from custom block?

hook_node_access() returning NODE_ACCESS_DENY is ignored

I am trying to block the current user from performing any action (view, update, delete) on a node. The user should only be able to view, update, delete the node being displayed if he is the owner of the node, or the owner of the node is a subuser of his (I am using... read more