pageData['amount']->value = (int)$_REQUEST['amount']; } protected function button_basket($sender) { try { $config = array(); $availableConfig = array( 'id_article', 'id_color', 'id_stickersize', 'id_material', 'version', 'amount', 'text_1', 'font_family_1', 'font_variant_1', 'font_size_1', 'font_color_1', 'pos_x_1', 'pos_y_1', 'text_2', 'font_family_2', 'font_variant_2', 'font_size_2', 'font_color_2', 'pos_x_2', 'pos_y_2', 'text_3', 'font_family_3', 'font_variant_3', 'font_size_3', 'font_color_3', 'pos_x_3', 'pos_y_3', 'text_4', 'font_family_4', 'font_variant_4', 'font_size_4', 'font_color_4', 'pos_x_4', 'pos_y_4', 'text_5', 'font_family_5', 'font_variant_5', 'font_size_5', 'font_color_5', 'pos_x_5', 'pos_y_5' ); foreach($availableConfig as $c) { $config[$c] = http::getRequest($c, false); } $article = new Article(); $article->get($this->pageData['id_article']->value); $product_number = $article->getLabel( $this->pageData['id_color']->value, $this->pageData['id_material']->selected, $this->pageData['id_stickersize']->selected, $this->pageData['version']->selected ); $_P = $article->getPrice( $this->pageData['id_stickersize']->selected ); $price = $_P->getPriceValue( $this->pageData['amount']->value, $this->pageData['id_material']->selected, null ); if($price >0) { #$price = $price/1000; } $requestArray = array( 'productNumber' => $product_number, 'amount' => $this->pageData['amount']->value, 'token' => http::initGlobal("token"), 'price' => $price, 'piecePerSheet' => $_P->package_size ); $cartProductId = http::initGlobal("cartProductId", null); if($cartProductId != null) { $requestArray['cartProductId'] = $cartProductId; } $requestArray = array_merge($requestArray, $config); $url = "https://sandbox.industrieplaketten.de/plakettendesignertool/add"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $requestArray); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLINFO_HEADER_OUT, false); $result = curl_exec($ch); if (curl_errno($ch)) { throw new Exception("CURL Fehler URL:"); } curl_close($ch); // what i do with result ? #$result /* if(HttpSession::getAttribute('change_basket_id')) { $p = HttpSession::getAttribute('change_basket_id'); $result = Basket::change( $p['id_basket'], array( 'id_stickersize' => $this->pageData['id_stickersize']->selected, 'id_color' => $this->pageData['id_color']->value, 'id_material' => $this->pageData['id_material']->selected, 'quantity' => $this->pageData['amount']->value, 'addInfo' => array(), "config" => $config ) ); HttpSession::removeAttribute('change_basket_id'); }*/ http::redirect("https://sandbox.industrieplaketten.de/checkout/cart"); } catch(Exception $e) { debug::log($e, EXCEPTION_LOG); } } } $page = new Page(); $page->writePage(); ?>