Зеленый хостинг ТЭИА



Syndicate content My RSS Feed
My RSS Feed
Updated: 3 weeks 3 days ago

How to calculate two taxes for the same product?

Tue, 04/13/2021 - 22:19

Spanish taxes depends on the product but also on the customer. A product could have one of this taxes: normal (21%), reduced (10%) and super-reduced (4%). This managed by a field on the variation type and it works good. But there is another variable that has to be considered. The customer could has a type of bussines that implies to add another additional tax to the same product. They are named "surcharge" and they are normal (5.2%), reduced (1.4%), super-reduced (0.5%). It is calculated in the next form:
Product price without taxes: 100 € Normal taxes (21%): 100 * (21 / 100) = 21 € Surcharge (5.2%): 100 * (5.2 / 100) = 5.2 € Order total: 100 + 21 + 5.2 = 126.2€

Implementing a class ProductTaxResolver implements TaxRateResolverInterface let me add one tax but I need to add more than one depends on a customer field (custom user field). How could I do it? Could I add another tax and a tax condition?

Categories: World News

How can I start a test series in my website?

Tue, 04/13/2021 - 22:19

Please help me and tell me about how to start the test series or any best plugin that is suitable for it. My requirement is that the test is started after login. And it has a color code with total question number with next, previous, and mark for review button.

Categories: World News

How do I add an help text icon next to a custom form element label?

Tue, 04/13/2021 - 22:19

I'm trying to add an information icon next to a custom form label. When users hover the cursor over that icon, it should display the label description.

I know '#attributes' => array('title' => t("text description")) would show the help text when hovering the cursor over the text area. In my case, it should be added to the icon next to the field label.

Categories: World News

Delete an account without showing the confirmation form

Tue, 04/13/2021 - 22:19

I've been working on creating a feature which allows certain non-admin but higher-than-user roles within a Drupal 8.8 system to delete users from the system. In essence, only admin and 'moderator' accounts have access to the Drupal, and they need to all be able to 'cancel' a user account from a bulk action.

My problem is that despite setting all permissions correctly and according to the guides, the moderators are always given a choice to choose which cancellation method they wish to use on the account, and then need to confirm the deletion. This happens despite these accounts not having the permission to do so.

I simply want the system to, upon clicking on the action 'cancel this account,' to cancel and delete all the accounts without confirmation or anything else. Just click and go. I've tried implementing this using hooks, including hook_user_cancel_methods_alter as shown below by not giving administer rights and dropping that requirement, but nothing seems to work.

function clientname_user_cancel_methods_alter(&$methods) { unset($methods['user_cancel_delete']['access']); }

Simply put: how can I skip the confirmation screen for a user cancellation/deletion in Drupal 8.8?

Categories: World News

JSON format missing

Tue, 04/13/2021 - 22:19

I'm using D7 with Services module. I have discovered recently that the JSON format on live server is not "rendered" differently:

I don't know what has changed there, but the JSON output on live is valid - I'm not familiar with the dashes there.

PS. All JSON pages are downloaded automatically with no extensions on browser instead of showing the content.

Any suggestions are welcome.

Categories: World News

How to disable creation of node revisions on programmatic node update?

Tue, 04/13/2021 - 22:19

I added a field of type computed field to existing nodes. It's required to re-save the nodes to set/update computed field values. As I do not want to update the changed timestamp I decided to not use the views bulk update to resave content. The easiest way would be a drush script, that way I can re-save content whenever it is necessary.

My first problem was that I was not able to leave the changed time unchanged on update ($node->save()). But I found that it could be re-set on a second node save.

My problem is that on each node save a new revision gets created. The node type is revision-able and beside the core module content moderation is enabled. I would appreciate any help on how to prevent the creation of revisions.

This is my current drush script in custom_helper.drush.inc:

<?php /** * @file * Provides drush command to update all articles. */ use Drupal\node\Entity\Node; /** * Implements hook_drush_command(). */ function custom_helper_drush_command() { $items = array(); $items['custom-resave-content'] = array( 'description' => dt('Resaves all article entities.'), 'options' => [ 'types' => dt('Coma separated list of content type to be resaved.'), 'nids' => dt('Coma separated list if node ids.'), 'field' => dt('Machine name of computed field to be updated.') ], 'aliases' => array('custom-rc'), ); return $items; } /** * Moves paragraphs into one paragraph reference field. */ function drush_custom_helper_custom_resave_content() { $nids = _convert_csv_to_array(drush_get_option('nids', [])); $types = _convert_csv_to_array(drush_get_option('types', [])); if (!$nids || $types) { // Get an array of node IDs. $query = \Drupal::entityQuery('node'); if ($types) { $query->condition('type', $types, 'IN'); } if ($nids) { $query->condition('nid', $nids, 'IN'); } $nids = $query->execute(); } // Load all the nodes. if ($nids) { $field_name = drush_get_option('field', ''); $nodes = Node::loadMultiple($nids); foreach ($nodes as $node) { $entity_type = $node->getEntityType(); $original_changed = $node->getChangedTime(); if ($entity_type->isRevisionable()) { $node->setNewRevision(FALSE); } // Force update of computed field. if ($field_name) { /** @var \Drupal\Core\Field\FieldItemListInterface $items */ $items = $node->get($field_name); if (empty($items[0])) { $items->appendItem(); } $items->preSave(); } // Save the updated computed field value. $node->setChangedTime($original_changed); if ($entity_type->isRevisionable()) { $node->setNewRevision(FALSE); } $node->save(); // Reset changed time to original value. $node->setChangedTime($original_changed); if ($entity_type->isRevisionable()) { $node->setNewRevision(FALSE); } $node->save(); $changed_after = $node->getChangedTime(); drush_print('node:' . $node->id() . ':' . $original_changed . ':' . $changed_after); } } drush_log(dt('Resave finished.'), 'ok'); }
Categories: World News

Remove Arbitrary Playback Speed Limit on HTML5 Video

Tue, 04/13/2021 - 21:39

Hello I am on a quest to reduce the playback speed of HTML5 video below 0.07x speed, however this appears to be restricted. Does anyone know why this is the case? Why 0.07x speed exactly? And is there a way around this?

submitted by /u/weefween
[visit reddit] [comments]
Categories: World News

Visme Review - PCMag

Tue, 04/13/2021 - 21:26
Visme Review  PCMag
Categories: World News

Footer (position:relative) overlaps content

Tue, 04/13/2021 - 21:09

Hey guys, so this is my problem (with JSfiddle Inc) link Thanks to anyone that could help, have a good one, Mark

submitted by /u/MarkMonaghan
[visit reddit] [comments]
Categories: World News

Beauty Products by Beauty Makers

Tue, 04/13/2021 - 20:51
Categories: World News

Просто хороший хостинг