Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ошибка при попытке удаления опции #671

Open
den-dev-icmy opened this issue Feb 14, 2022 · 0 comments · May be fixed by #912
Open

Ошибка при попытке удаления опции #671

den-dev-icmy opened this issue Feb 14, 2022 · 0 comments · May be fixed by #912

Comments

@den-dev-icmy
Copy link

den-dev-icmy commented Feb 14, 2022


Пытается считаться строка.
php:8.0
modx:latest
minishop2:latest
Предлагаю:

  $q = $this->xpdo->newQuery('msProduct', array('parent' => $this->get('category_id')));
  $q->select('id');
  if ($q->prepare() && $q->stmt->execute()) {
    $products = $q->stmt->fetchAll(PDO::FETCH_COLUMN);
    $productIds = implode(',', $products);
    $key = $this->getOne('Option')->get('key');
    $key = $this->xpdo->quote($key);
    if (count($products) > 0) {
      $sql = "DELETE FROM {$this->xpdo->getTableName('msProductOption')} WHERE `product_id` IN ({$productIds}) AND `key`={$key};";
      $stmt = $this->xpdo->prepare($sql);
      $stmt->execute();
      $stmt->closeCursor();
    }
  }
@yura3d yura3d linked a pull request Apr 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant