D
D
Dmitry2016-09-26 17:07:54
MODX
Dmitry, 2016-09-26 17:07:54

How to bind a change in the price of a product to a parameter?

Good afternoon
My steps
.1 Create a chunk for the directory

<div class="product shk-item col-md-6 col-sm-6">
    <div class="product-b mt-product text-center">
        <div class="row mt-product-item">
            <div class="col-md-12 col-sm-12">
                <a class="product-descr mt-product-pict" href="">
                    <img class="shk-image" src="" alt="" />
                </a>
            </div>
        </div>
        <div class="row mt-product-item">
            <div class="col-md-24 col-sm-24">
                <h3 class="h3">Вопрос</h3>
            </div>
        </div>
        <div class="row mt-product-item">
            <div class="col-md-12 col-sm-12">
                <span class="shk-price mt-product-price">
                     
          <i class="fa fa-rub" aria-hidden="true"></i>
                </span>
            </div>
            <div class="col-md-12 col-sm-12">
                <!---->
                
            </div>
        </div>
        <div class="row">
            <div class="col-md-12 col-sm-12">
                <form action="" method="post">
                    <fieldset>
                        <input type="hidden" name="shk-id" value="355860" />
                        <input type="hidden" name="shk-count" value="1" />
                        <div class="product-price">
                            <button type="submit" class="shk-but btn btn-success btn-success-light">Корзина</button>
                        </div>
                    </fieldset>
                </form>
            </div>
        </div>
    </div>
</div>

2. I create an additional field size
Output parameters - shk_select, use the input type "param_edit"
On the product card page (template) I change the parameter id

Result, which at the moment is
1. Product catalog
A text list is displayed here
c3b21e0c790a46bf8de3a88ca833c3ec.png
+
2. Product card
A list is displayed here sizes, but it is not tied to the price, i.e. when the size is changed, the price does not change
eff47f224c6e4ca0b3a6eda57c71a737.pngThe result that we would like to get
This is the binding of the price to the parameter (s) (in this case, to the size)
Dependence of the price on the size
1 size = 1000
2 size = 2000
3 size = 2100 etc.
Tell me what I'm doing wrong?
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-09-27
@soledar10

Understood
it is necessary that the parameter on which the price depends and the price itself should be located in the form itself

<form action="" method="post">                              
                                
                                <input type="hidden" name="shk-id" value="2" />                                
                                <input type="hidden" name="shk-count" value="1" />
                                
                                <div class="shk-price"> руб.</div>
                                <div class="product-price">
                                  <button type="submit" class="shk-but">В корзину <i></i></button>
                                </div>                              
                         </form>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question