🇪🇸Spain @uridrupal

Account created on 1 October 2018, about 6 years ago
#

Recent comments

🇪🇸Spain uridrupal

For new people, you have to save again in

/admin/config/search/search-api/index/main_search_index/fields
/admin/config/search/search-api/index/main_search_index/fields/edit/rendered_item

And the error is gone if everything is configured properly, which was my case.

🇪🇸Spain uridrupal

@cmd87 I think I have found the culprit.
It's necessary to add in your payment in Drupal the Webhook Sign Key (sign2). Also you need to get this key from Datatrans
In
UPP Administration
Security
Security signature
Copy "important parameters will be digitally ..."

And also specify the URL in
UPP Administration
UPP Data
URL Post

According to Drupal
Required when using webhooks. Note that the webhook (URL POST) must be configured in the Datatrans Backend and only a single, static URL is supported per merchant. Webhook URL: /commerce/datatrans/notify.

This should make it work. Basically when the order is paid in Datatrans, a webhook will be sent to commerce/datatrans/notify and the order will be updated in drupal.

I am still not sure if using the option "An additional Merchant-IDentification will be send with payment messages" in Datatrans will work instead of using "Important parameters will be digitally signed (HMAC-SHA256) and sent with payment messages"

🇪🇸Spain uridrupal

Yes, but the merge went to the 3.0.x-dev not the 3.0 nor the 3.1.
Also, even though we have 2 versions, both of them will install 3.1, so even if you copy https://git.drupalcode.org/project/gdpr/-/merge_requests/49#note_356809 you will still get 3.1

composer require 'drupal/gdpr:^3.0' will install 3.1 anyway because of the constraint.

I was able to make it work by getting the PR https://git.drupalcode.org/project/gdpr/-/merge_requests/49#note_356809 and downloading the changes as Patch and using it to patch my installation.

This error > bash: line 1: gdpr_clone_node__field_test: command not found appears only when using --gzip, so I just stopped using it.

🇪🇸Spain uridrupal

I was using a hook_cron with a service inside. When I ran the hook_cron through simple_cron I got this error.
The error was in src/CronJobManager.php

  /**
   * {@inheritdoc}
   */
  public function getEnabledJob(string $job_id): ?CronJobInterface {
    $jobs = $this->cronJobStorage->loadByProperties([
      'id' => $job_id,
      'status' => TRUE,
    ]);

    return $jobs ? reset($jobs) : NULL;
  }

I couldn't figure out what was I doing wrong. Tried both the hook_cron way and the Plugin way, nothing worked. I am pretty sure it must have been something with my code, because the other jobs were working fine, but my hook_cron was just this:

function hook_cron() {
  \Drupal::service('my_service')->myMethod();
}
🇪🇸Spain uridrupal

This is old, but this is how I did it:

    $html = Drupal::service('renderer')->renderRoot($array);
    /** @var PrintBuilder $print_builder*/
    $print_builder = Drupal::service('entity_print.print_builder');
    /** @var RendererInterface $renderer*/
    $renderer = Drupal::service('entity_print.renderer_factory')->create([$entity]);
    $print_engine = Drupal::service('plugin.manager.entity_print.print_engine')->createInstance('dompdf');
    $print_engine->addPage($html);
    $content = $renderer->render([$entity]);
    $render = [
      '#theme' => 'your_template',
      '#title' => $this->t('View @type', ['@type' => $print_engine->getExportType()->label()]),
      '#content' => $content,
      '#attached' => ['your_module/library'],
    ];

    $print_engine->addPage($renderer->generateHtml([$entity], $render, FALSE, TRUE));

    return (new StreamedResponse(function () use ($print_builder, $entity, $print_engine) {
      // The printed document is sent straight to the browser.
      $print_builder->deliverPrintable([$event_notes], $print_engine, FALSE, TRUE);
    }))->send();

As far as I understood, the module requires an entity to work, you can't make it work only with a render array. So I did setup in a random entity a "PDF" view mode (which I knew I wouldn't need to export to PDF later), created the template twig. That template Twig shows nothing, it's just there to make the genereateHtml() method work.

$array is the result of

return [
      '#theme' => 'your_template',
      '#var1' => $var1,
      '#var2' => $var2,
      '#var3' => $var3
    ];

Hope it helps somebody else.

🇪🇸Spain uridrupal

@rsnyd
I couldn't make it work, but you're using the wrong Field Widget. You need to use the proper one, I think it's called "Product stock level". Also, the stock is set at variation if I recall correctly, and then it will show properly.

🇪🇸Spain uridrupal

You need to install faker library, just run a composer require fakerphp/faker It seems it hasn't been added as dependency on the module's composer.json

🇪🇸Spain uridrupal

Until the patch is merged it won't work because if I'm correct composer checks dependencies at the time of install. So even with the patch you won't comply with the requirements. Another possible solution would be to fork the repo and create your own with the patch applied until the issue is solved. Something like that could work.

🇪🇸Spain uridrupal

I have tested and it works. I am not having issues translating block content anymore.

🇪🇸Spain uridrupal

I will try to test tomorrow, couldn't make it work today.

🇪🇸Spain uridrupal

Yes, it seems it's related to this https://www.drupal.org/project/commerce/issues/2981193 which makes sense since the order is "frozen".
Some labels like Subtotal were changing, but then again those are not adjustments.
Thanks!

🇪🇸Spain uridrupal

Yes, I saw that issue that's what I am a bit confused.
I have noticed that using the Language switcher doesn't work, but if I empty the cart and put a new product in another language it shows the proper translation, but if I change the language again, everything changes except for that Promotion label, which is a discount on shipping.
Has to be some cache issue

🇪🇸Spain uridrupal

I am trying to update to last version of Commerce. We are at 8.x-2.36, but that fix is old, code should be already there.
I can't figure out why the translation is not showing properly.

🇪🇸Spain uridrupal

@jsacksick I did exactly that, and it seems to be working.

🇪🇸Spain uridrupal

@Lukas von Blarer Where is this option? I cannot find it inside Promotions!

🇪🇸Spain uridrupal

So for anyone coming to this, the default fallback language can't be changed, Drupal only accepts one.
I was able to hack it this way

Basically what I did was changing the Fallback language to French.
Then I went to Prefix URL, enable domain configuration for each domain, in my desired domain I put all the prefixes and save config.
This means site.com/en, site.com/fr, site.com/de

Then reverted fallback language to German.
Now in my desired domain if I go example.com it goes to example.com/fr and lang switcher works properly.

It's a bit of a hack but only way I could make it work. It won't show site.com as French, it will go to site.com/fr but at least it follows my directive of having certain domain be a default in another language.

🇪🇸Spain uridrupal

Seems patch #35 works fine for me. I have learnt the risk of using a Merge diff as a patch now.
Thanks!

🇪🇸Spain uridrupal

The last changes broke the code, there's an extra } that has been deleted

🇪🇸Spain uridrupal

@mark_fullmer Thanks! I wasn't aware to install the additional module, plus I was on another drupal version, not 10. Made it work perfectly!

🇪🇸Spain uridrupal

@samir_shukla Thanks for your input. From what I've seen it does not help. I need to restrict the suggested list of links when using autocomplete by content type. If I have a field link set up as "internal only", I want to choose which content types should come up when linking. Right now it shows all content from all content types. If I have "Blogs" and "Articles" I want to be able to only link "Blogs", but right now there's no way to restrict it.

🇪🇸Spain uridrupal

Would be great to know, I am also experiencing a similar use case with commerce add to cart. Tried using the base_form_id but it didn't work.

🇪🇸Spain uridrupal

Experiencing the same similar case. There's a fixed rater of 2 prices, I don't need to calculate shipping costs based on Price, so having weight on a product variation is superfluous. Is there a way to turn it off?

🇪🇸Spain uridrupal

At first glance the patch seems to be working. I can see the button unchecked and allows me to check it as "same billing as shipping".

🇪🇸Spain uridrupal

Once I added patch #14 it was also necessary to add:

/**
 * Implements hook_responsive_menu_off_canvas_tree_prebuild().
 */
function mymodule_responsive_menu_off_canvas_tree_prebuild(array &$build) {
  $build['#cache']['contexts'][] = 'subsite_context';
}

After doing this, I had no more issues with cache.

🇪🇸Spain uridrupal

After the update to Drupal10.1.6 and version Cookies 1.2.7 this patch stopped working for me. I can apply it but it does nothing when removing consent.

🇪🇸Spain uridrupal

Thanks for the patch chetan11. I wasn't able to install the patch since it seems to be directed to the Branch 7x and we're using right now the version 2.0.1, could you re roll the patch?
I tried manually installing the changes, but nothing seems to change.

🇪🇸Spain uridrupal

It seems you're right. I took a look at the JS code and it doesn't seem to have an option honestly.
I will update once I get a reply there.
Thanks!

🇪🇸Spain uridrupal

I can confirm we still have this issue. Just tried it on simplytest.me/
The description is not being shown.

🇪🇸Spain uridrupal

Thanks @John Pitcairn. Do you have any ideas on how I would start doing that? I haven't found a single module, except for
Thanks for replying so fast.

Production build 0.71.5 2024