Skip to content
Snippets Groups Projects

Issue #3417228: Coding standards and functions replace

2 unresolved threads

Closes #3417228

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
110 110 *
111 111 * @param string &$path
112 112 * Path.
113 *
114 * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
115 * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
113 116 */
114 function _commerce_checkout_paths_alter_path(&$path): void {
117 function _commerce_checkout_paths_alter_path(string &$path): void {
115 118 global $user;
116 119 // Get an Order ID by User ID.
117 $order_id = commerce_cart_order_id($user->uid);
120 $order_id = $this->cartProvider->getCart($user->uid);
  • It will be better to use here $this->cartProvider->getCarts($user); But this method will return all carts, while the user could have more than one cart at the same time.

    We'll also need to think about what to do later, when we'll have multiple orders.

  • Please register or sign in to reply
  • Kostia Bohach
    Kostia Bohach @_shY started a thread on the diff
  • 150 153 *
    151 154 * @return string
    152 155 * Custom checkout path.
    156 * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
    157 * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
    153 158 */
    154 159 function _commerce_checkout_paths_custom_checkout_path(string $page = 'checkout', int $order_id = NULL): string {
    155 160 if (empty($order_id)) {
    156 161 global $user;
    157 162 // Get an Order ID by User ID.
    158 $order_id = commerce_cart_order_id($user->uid);
    163 $order_id = Drupal::entityTypeManager()->getStorage('commerce_order')->load($user->uid);
    Please register or sign in to reply
    Loading