-
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #781 from ShevArtV/master
Изменения в доки по msAltCart и SendIt
- Loading branch information
Showing
4 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# События | ||
## Системные события | ||
### События msAltCart | ||
### | ||
#### msOnBeforeGetProductKey - генерируется перед формированием ключа товара в корзине, позволяет изменить параметры ключа. | ||
Доступные параметры: | ||
* **$product** - массив всех полей товара. | ||
* **$options** - массив опций товара. | ||
* **$cart** - экземпляр класса-обработчика корзины. | ||
|
||
::: details Пример плагина | ||
В данном примере мы перемещаем опции к основным полям товара, что позволит указать в системной настройке **cart_product_key_fields** ключи конкретных опций. | ||
Таким образом появляется возможность тонко настраивать ключ товара, не включая в него какие-то служебные опции. | ||
```php:line-numbers | ||
switch($modx->event->name){ | ||
case 'msOnBeforeGetProductKey': | ||
$values = &$modx->event->returnedValues; | ||
unset($product['options']); | ||
$values['product'] = array_merge($product, $options); | ||
break; | ||
} | ||
``` | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters