S
S
sllugovskih2016-02-03 15:45:39
PHP
sllugovskih, 2016-02-03 15:45:39

Text option in OpenCart product, how to add to the cost?

Hello, I have such a problem. There is a site on Opencart 1.5.5.1 in which the products have a text option "calculator". How to make it so that when adding a product with this option to the cart, the filled value is added to the cost of the product. I found what I need to dig into system\library\cart.php
line 137:

} elseif ($option_query->row['type'] == 'text' || $option_query->row['type'] == 'textarea' || $option_query->row['type'] == 'file' || $option_query->row['type'] == 'date' || $option_query->row['type'] == 'datetime' || $option_query->row['type'] == 'time') {
$option_data[] = array(
'product_option_id'       => $product_option_id,
'product_option_value_id' => '',
'option_id'               => $option_query->row['option_id'],
'option_value_id'         => '',
'name'                    => $option_query->row['name'],
'option_value'            => $option_value,
'type'                    => $option_query->row['type'],
'quantity'                => '',
'subtract'                => '',
'price'                   => '',
'price_prefix'            => '',
'points'                  => '',
'points_prefix'           => '', 
'weight'                  => '',
'weight_prefix'           => ''
);

I tried to add any number to the price value in the array here and put "plus" in the prefix, but it is not added to the cost of the goods in the basket.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question