Account created on 15 April 2010, about 14 years ago
#

Recent comments

🇷🇴Romania alexberendei

There are any news about the D8 / D10 version of Roomify for Accommodations distro ?

🇷🇴Romania alexberendei

Any news related to this use case ?
Booking the whole bus or individual seats inside the bus ?

🇷🇴Romania alexberendei

Indeed, the concept of group bundles can be quite confusing. I have a use case where I need to rent a location either by individual rooms or by the entire venue. Can this be achieved using "Type Group Bundles"?

When renting the entire venue, all individual rooms should be available. Conversely, when the entire venue is booked, no individual room bookings should be allowed.

🇷🇴Romania alexberendei

Now the price is taken from the weekly timetable (I guess this is PriceFromBaseTable). However, if a 'double room', for example, needs to have a different price for one guest and a higher price for two guests, this can only be achieved with occupants variation.

The issue arises when there are multiple stores with different pricing rules, and the price variation can only be configured per site, not for every store separately.

That's why I see disabling the price variations as a viable option.

🇷🇴Romania alexberendei

Thank you @Harpreet_singh_saluja , I have another place where this error also happens:

on /admin/commerce/config/store

Operations: #0 /app/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(80): Drupal\Core\Entity\Query\Sql\Query->prepare()
#1 /app/web/modules/contrib/commerce_marketplace/src/Plugin/Field/FieldFormatter/MarketplaceTypeLabelFormatter.php(94): Drupal\Core\Entity\Query\Sql\Query->execute()

I've replaced this (94) line:
$used = count($this->storage->getQuery()->condition('uid', $uid)->condition('type', $store_type)->execute());

To this:

$query = $this->storage->getQuery();
$query->condition('uid', $uid);
$query->condition('type', $store_type);
// Explicitly set whether the query should be access checked
$query->accessCheck(FALSE); // or TRUE if access checking is needed
$used = count($query->execute());
🇷🇴Romania alexberendei

On /store/add, the same error appear pointing to loadMultiple
#2 /app/web/modules/contrib/commerce_marketplace/src/MarketplaceStorage.php(70): Drupal\commerce_marketplace\MarketplaceStorage->loadMultiple()

I've changed the loadMultiple function, in order to work, to :

public function loadMultiple(array $ids = NULL, AccountInterface $user = NULL) {
    $stores = [];

    // If $ids are provided, load the entities directly.
    if ($ids) {
        $stores = parent::loadMultiple($ids);
    } else {
        // If $ids are not provided, build the entity query.
        $query = \Drupal::entityTypeManager()->getStorage('commerce_store')->getQuery();

        // Add condition based on the user, if provided.
        if ($user) {
            $query->condition('uid', $user->id());
        }

        // Execute the query and load the entities.
        $ids = $query->accessCheck(TRUE)->execute();
        $stores = parent::loadMultiple($ids);
    }

    return $stores;
}

🇷🇴Romania alexberendei

Changed the loadDefault function inside MarketplaceStorage.php to:

  public function loadDefault(AccountInterface $user = NULL) {
    $default = NULL;
    if ($uid = $this->getCurrentUserId($user)) {
        $config = $this->configFactory->get('commerce_marketplace.settings');
        $uuid = $config->get("owners.{$uid}.default_store");
        $query = \Drupal::entityTypeManager()->getStorage('commerce_store')->getQuery();
        $ids = $query->condition('uid', $uid)->accessCheck(TRUE)->execute();
    }
    elseif ($defaultStore = parent::loadDefault()) {
        $uuid = $defaultStore->uuid();
        $query = \Drupal::entityTypeManager()->getStorage('commerce_store')->getQuery();
        $ids = $query->accessCheck(TRUE)->execute();
    }

    if (!empty($ids)) {
        $stores = $this->loadMultiple($ids);
        if ($uuid) {
            foreach ($stores as $store) {
                if ($store->uuid() == $uuid) {
                    $default = $store;
                    break;
                }
            }
        }
        else {
            $default = end($stores);
        }
    }
    else {
        $stores = $this->loadMultiple();
    }

    if (!$default && isset($store)) {
        // This is the case when previously assigned default store was
        // deleted, so we need to return at least the last found store.
        $default = $store;
        $default->enforceIsNew();
        if (count($stores) > 1) {
            $this->messenger()->addWarning($this->t('No one default store is assigned yet. Note that it is recommended to have one explicitly assigned otherwise the last found store will be dimmed as the default. This may lead to unexpected behaviour.'), FALSE);
        }
    }
    elseif (!$default && $stores) {
        // As a last resort let's return the first store in the list.
        $default = reset($stores);
    }

    return $default;
}
🇷🇴Romania alexberendei

I've commented out the permissions that trows that error

  • commerce_marketplace/config/install/user.role.commerce_marketplace_owner.yml
  • commerce_marketplace/config/install/user.role.commerce_marketplace_admin.yml

user.role.commerce_marketplace_owner.yml

langcode: en
status: true
dependencies: {  }
id: commerce_marketplace_owner
label: 'Marketplace owner'
is_admin: null
permissions:
  # - 'access cart'
  - 'access checkout'
  - 'access comments'
  - 'access content'
  - 'access site-wide contact form'
  - 'search content'
  - 'view own customer profile'
  - 'view commerce_store'
  - 'view commerce_product'
  - 'view own unpublished commerce_product'
  - 'view own commerce_order'
  - 'manage own commerce_payment_method'

user.role.commerce_marketplace_admin.yml

langcode: en
status: true
dependencies: {  }
id: commerce_marketplace_admin
label: 'Marketplace admin'
is_admin: null
permissions:
  - 'access administration pages'
  - 'access commerce administration pages'
  - 'access commerce_order overview'
  - 'access commerce_product overview'
  - 'access commerce_product_attribute overview'
  # - 'access commerce_promotion overview'
  - 'access commerce_store overview'
  - 'access content overview'
  - 'access contextual links'
  - 'access in-place editing'
  - 'access profile overview'
  - 'access site in maintenance mode'
  # - 'access site reports'
  - 'access toolbar'
  # - 'access tour'
  - 'access user contact forms'
  - 'access user profiles'
  - 'administer block_content display'
  - 'administer block_content fields'
  - 'administer block_content form display'
  - 'administer blocks'
  - 'administer comment display'
  - 'administer comment fields'
  - 'administer comment form display'
  - 'administer comment types'
  - 'administer comments'
  - 'administer commerce_checkout_flow'
  - 'administer commerce_currency'
  - 'administer commerce_order'
  - 'administer commerce_order display'
  - 'administer commerce_order fields'
  - 'administer commerce_order form display'
  - 'administer commerce_order_item display'
  - 'administer commerce_order_item fields'
  - 'administer commerce_order_item form display'
  - 'administer commerce_order_type'
  - 'administer commerce_payment'
  - 'administer commerce_payment_gateway'
  - 'administer commerce_payment_method'
  - 'administer commerce_product'
  - 'administer commerce_product display'
  - 'administer commerce_product fields'
  - 'administer commerce_product form display'
  - 'administer commerce_product_attribute'
  - 'administer commerce_product_attribute_value display'
  - 'administer commerce_product_attribute_value fields'
  - 'administer commerce_product_attribute_value form display'
  - 'administer commerce_product_type'
  - 'administer commerce_product_variation display'
  - 'administer commerce_product_variation fields'
  - 'administer commerce_product_variation form display'
  # - 'administer commerce_promotion'
  # - 'administer commerce_store'
  - 'administer commerce_store display'
  - 'administer commerce_store fields'
  - 'administer commerce_store form display'
  - 'administer commerce_store_type'
  - 'administer commerce_tax_type'
  - 'administer contact forms'
  - 'administer contact_message display'
  - 'administer contact_message fields'
  - 'administer contact_message form display'
  - 'administer content types'
  - 'administer display modes'
  - 'administer image styles'
  - 'administer menu'
  - 'administer node display'
  - 'administer node fields'
  - 'administer node form display'
  - 'administer nodes'
  - 'administer profile'
  - 'administer profile display'
  - 'administer profile fields'
  - 'administer profile form display'
  - 'administer profile types'
  - 'administer search'
  - 'administer shortcuts'
  # - 'administer swiftmailer'
  - 'administer taxonomy'
  - 'administer taxonomy_term display'
  - 'administer taxonomy_term fields'
  - 'administer taxonomy_term form display'
  - 'administer url aliases'
  - 'administer user display'
  - 'administer user form display'
  - 'administer views'
  # - 'administer_mailsystem'
  - 'bypass node access'
  - 'change own username'
  - 'create article content'
  - 'create commerce_product_attribute'
  # - 'create commerce_promotion'
  - 'create customer profile'
  - 'create default commerce_order'
  - 'create page content'
  - 'customize shortcut links'
  - 'delete any article content'
  - 'delete any customer profile'
  - 'delete any page content'
  - 'delete article revisions'
  - 'delete commerce_product_attribute'
  # - 'delete commerce_promotion'
  - 'delete default commerce_order'
  - 'delete own article content'
  - 'delete own customer profile'
  - 'delete own page content'
  - 'delete page revisions'
  - 'delete terms in tags'
  - 'edit any article content'
  - 'edit any page content'
  - 'edit own article content'
  - 'edit own comments'
  - 'edit own page content'
  - 'edit terms in tags'
  - 'revert article revisions'
  - 'revert page revisions'
  - 'view page revisions'
  - 'switch shortcut sets'
  - 'update any customer profile'
  - 'update commerce_product_attribute'
  # - 'update commerce_promotion'
  - 'update default commerce_order'
  - 'update own customer profile'
  - 'use advanced search'
  - 'use text format basic_html'
  - 'use text format full_html'
  - 'use text format restricted_html'
  - 'view all revisions'
  # - 'view any commerce_store'
  - 'view any customer profile'
  - 'view any profile'
  - 'view article revisions'
  - 'view commerce_order'
  - 'view commerce_product_attribute'
  # - 'view commerce_promotion'
  - 'view page revisions'
  - 'view the administration theme'

In my case the error was because
- commerce_promotion was not enabled
- swiftmailer ( I don't used it anymore in D10 )

🇷🇴Romania alexberendei

I've looked at the module and does not look very actively developed. Can you share your progress so far ?

🇷🇴Romania alexberendei

on the file /bee_hotel/src/Controller/SearchResult.php at line 210:

$data['destination']['img'] = Link::createFromRoute($beeHotelUnit['cover_image']['markup'], 'entity.node.canonical', [
       'node' => $beeHotelUnit['node']->Id(),
        'v' => $data['v_param'],
]);

In case there is one node with no image uploaded (cover_image), the site crashes when you request a search on /RoomSearch

I propose this code:

// Check if cover image exists before accessing it
if (isset($beeHotelUnit['cover_image']) && is_array($beeHotelUnit['cover_image']) && isset($beeHotelUnit['cover_image']['markup'])) {
    $data['destination']['img'] = Link::createFromRoute($beeHotelUnit['cover_image']['markup'], 'entity.node.canonical', [
       'node' => $beeHotelUnit['node']->Id(),
       'v' => $data['v_param'],
    ]);
} else {
    // Handle case where cover image is not available
    $data['destination']['img'] = t('No Image');
}
🇷🇴Romania alexberendei

There are any news regarding the access control for store owners in the newer versions of commerce ?

🇷🇴Romania alexberendei

Are you sure there is "minimum-stability": "dev", inside your composer.json ?

Production build 0.69.0 2024