Example #1
0
if ($res === false) {
    echo "<p>Error raised on update request: <b>" . $merchium->getLastError() . "</b></p>";
    exit;
}
echo "<p>Price for product with product_id={$res['product_id']} was successfully updated.</p>";
//
// Send
//
$gres = $merchium->getRequest('products', array('q' => 'Test product', 'pname' => 'Y'));
if ($gres === false) {
    echo "<p>Error raised on get request: <b>" . $merchium->getLastError() . "</b></p>";
    exit;
}
$product_id = $gres['products'][0]['product_id'];
echo "<p>Product with product_id={$product_id} was successfully found.</p>";
//
// Send Delete
//
foreach ($gres['products'] as $r) {
    $product_id = $r['product_id'];
    $res = $merchium->deleteRequest("products/{$product_id}", array('price' => 2500.0));
    if ($res == false) {
        echo "<p>Error raised on delete request: <b>" . $merchium->getLastError() . "</b></p>";
        exit;
    }
    echo "<p>Product with product_id={$product_id} was successfully deleted.</p>";
}
?>
</body>
</html>