Вопрос решил таким образом. Добавил input type=hidden к отправке формы с name=custom_price
В POST запрос в обработчике корзины добавил custom_price. В cart.php в функцию add добавил
$custom_price = $_POST['custom_price']; $_SESSION['custom'] = $custom_price;
и в library/cart.php в начало idex
if (!isset($_SESSION['custom'])) { $custom_price = 0; } else { $custom_price = $_SESSION['custom']; }
потом находим массив из getProduct и добавляем к нему условие
if ($custom_price == 0) { $this->data[$key] = array( 'key' => $key, 'product_id' => $product_query->row['product_id'], 'name' => $product_query->row['name'], 'model' => $product_query->row['model'], 'shipping' => $product_query->row['shipping'], 'image' => $product_query->row['image'], 'option' => $option_data, 'download' => $download_data, 'quantity' => $quantity, 'minimum' => $product_query->row['minimum'], 'subtract' => $product_query->row['subtract'], 'stock' => $stock, 'price' => ($price + $option_price), 'total' => ($price + $option_price) * $quantity, 'reward' => $reward * $quantity, 'points' => ($product_query->row['points'] ? ($product_query->row['points'] + $option_points) * $quantity : 0), 'tax_class_id' => $product_query->row['tax_class_id'], 'weight' => ($product_query->row['weight'] + $option_weight) * $quantity, 'weight_class_id' => $product_query->row['weight_class_id'], 'length' => $product_query->row['length'], 'width' => $product_query->row['width'], 'height' => $product_query->row['height'], 'length_class_id' => $product_query->row['length_class_id'] ); } else { $this->data[$key] = array( 'key' => $key, 'product_id' => $product_query->row['product_id'], 'name' => $product_query->row['name'], 'model' => $product_query->row['model'], 'shipping' => $product_query->row['shipping'], 'image' => $product_query->row['image'], 'option' => $option_data, 'download' => $download_data, 'quantity' => $quantity, 'minimum' => $product_query->row['minimum'], 'subtract' => $product_query->row['subtract'], 'stock' => $stock, 'price' => $custom_price,//($price + $option_price), 'total' => $custom_price * $quantity,//($price + $option_price) * $quantity, 'reward' => $reward * $quantity, 'points' => ($product_query->row['points'] ? ($product_query->row['points'] + $option_points) * $quantity : 0), 'tax_class_id' => $product_query->row['tax_class_id'], 'weight' => ($product_query->row['weight'] + $option_weight) * $quantity, 'weight_class_id' => $product_query->row['weight_class_id'], 'length' => $product_query->row['length'], 'width' => $product_query->row['width'], 'height' => $product_query->row['height'], 'length_class_id' => $product_query->row['length_class_id'] );
Все работает на ура! Удачи!
Трудился всю ночь, перегрыз все процедуры формирования корзины, но более адекватного решения не нашел.
Да и под конец при передаче json обратно нужно аннулировать сессию!!!