Momentan programmiere ich ein Modul für Prestashop 1.6.10, das sich im Administrationsbereich befindet und eine externe API verwendet. Mein Problem ist, dass ich nicht verstehe, wie man ein Produkt in der Datenbank im Backoffice hinzufügt.Produkt ein Produkt in Prestashop 1.6.10 von einer API extern hinzufügen?
Dies ist der Code, den ich writed haben:
public function Product() {
if (empty($_GET['product'])) {
return false;
}
switch($_GET['product']) {
case 'add' :
$product = new ProductCore();
$product->id_shop_default = 1;
$product->id_manufacturer = 1;
$product->id_supplier = 1;
$product->reference = "adding_product";
$product->supplier_reference = "";
$product->location = "";
$product->width = "0.00000";
$product->height = "0.00000";
$product->depth = "0.00000";
$product->weight = "0.00000";
$product->quantity_discount = "0";
$product->ean13 = "0";
$product->upc = "";
$product->cache_is_pack = "0";
$product->cache_has_attachments = "0";
$product->is_virtual = "0";
$product->save();
$product->add();
break;
/** Product suppression.
case 'del' :
if (Product::existsInDatabase()) {
}
break;
}
return false;
}
ich das „Produkt“ Objekt verwenden, aber es funktioniert nicht, und ich weiß nicht, warum :(
mir jemand bitte helfen konnte
?