<?php require '_init.php'; $pid = $_REQUEST['pid']; $retailer = $_REQUEST['retailer']; $product_title = @$_REQUEST['p_title']; $product_url = @$_REQUEST['p_url']; $product_price = @$_REQUEST['p_price']; $product_image_url = @$_REQUEST['p_image']; $product = product_create($retailer, $pid, array('title' => $product_title, 'url' => $product_url, 'price' => $product_price, 'currency' => 'GBP', 'image_url' => $product_image_url)); $ret = array('ok' => true, 'product' => $product); send_json($ret);
{ // Save last template used to generate document if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } $result=product_create($db, $object, GETPOST('model','alpha'), $outputlangs); if ($result <= 0) { dol_print_error($db,$result); exit; } } // Barcode type if ($action == 'setfk_barcode_type' && $createbarcode) { $result = $object->setValueFrom('fk_barcode_type', GETPOST('fk_barcode_type')); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; }