S
S
Sergey Miller2019-06-05 23:29:53
MODX
Sergey Miller, 2019-06-05 23:29:53

How to create plugin with shopkeeper3 method call in modx Revo?

Hi people.
Full question:
I have shopkeeper3, modx REVO. For products, the price depends on the option chosen. (1l - 100 r, 2l - 200 r, 3l - 300 r..). I found the answer like this, but I don’t have enough experience to understand what exactly, how and where to do it:

Создаем плагин itemPrice
текст:
<?php
$output = 0;
if(!empty($_POST['itemPrice']) && is_numeric($_POST['itemPrice'])){
$output = $_POST['itemPrice'];
}else{
$output = $modx->getOption('price',$scriptProperties,0);
}
$modx->event->_output = '';
$modx->event->output($output);
return '';

Выбираем для плагина системное событие "OnSHKgetProductPrice"

How and where to create a plugin and how to call the "OnSHKgetProductPrice" method. As I understand it, this plugin will change the price of the product depending on the option and send it to the cart. Just what I need. On the product page itself, I made the price change dynamically in the field in js when the corresponding checkbox is selected. But the price is not transferred to the basket, there is always 0 rubles.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Tarasov, 2019-06-05
@blackseabreathe

in your admin panel, go to /manager/?a=element/plugin/create&category=0
, give an arbitrary name, in the "system events" tab, look for and mark "OnSHKgetProductPrice".
Paste your code into the text of the plugin and save it.
Your plugin should work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question