diff --git a/modules/basket/controllers/admin_postage_bands.php b/modules/basket/controllers/admin_postage_bands.php index 977128e3..26598bd7 100644 --- a/modules/basket/controllers/admin_postage_bands.php +++ b/modules/basket/controllers/admin_postage_bands.php @@ -60,9 +60,9 @@ class Admin_Postage_Bands_Controller extends Controller $postage_band->save(); message::success(t("Created postage band %postage_name", array( "postage_name" => html::clean($postage_band->name)))); - print json_encode(array("result" => "success")); + json::reply(array("result" => "success")); } else { - print json_encode(array("result" => "error", "form" => (string)$form)); + json::reply(array("result" => "error", "form" => (string)$form)); } } @@ -91,13 +91,13 @@ class Admin_Postage_Bands_Controller extends Controller $name = $postage->name; $postage->delete(); } else { - print json_encode(array("result" => "error", "form" => (string)$form)); + json::reply(array("result" => "error", "form" => (string)$form)); } $message = t("Deleted user %postage_band", array("postage_band" => html::clean($name))); log::success("user", $message); message::success($message); - print json_encode(array("result" => "success")); + json::reply(array("result" => "success")); } public function edit_postage_band($id) { @@ -127,9 +127,9 @@ class Admin_Postage_Bands_Controller extends Controller $postage->save(); message::success(t("Changed postage band %postage_name", array("postage_name" => html::clean($postage->name)))); - print json_encode(array("result" => "success")); + json::reply(array("result" => "success")); } else { - print json_encode(array("result" => "error", "form" => (string)$form)); + json::reply(array("result" => "error", "form" => (string)$form)); } } diff --git a/modules/basket/controllers/admin_product_lines.php b/modules/basket/controllers/admin_product_lines.php index fd11928e..197b7291 100644 --- a/modules/basket/controllers/admin_product_lines.php +++ b/modules/basket/controllers/admin_product_lines.php @@ -60,9 +60,9 @@ class Admin_Product_Lines_Controller extends Controller $product->save(); message::success(t("Created product %product_name", array( "product_name" => html::clean($product->name)))); - print json_encode(array("result" => "success")); + json::reply(array("result" => "success")); } else { - print json_encode(array("result" => "error", "form" => (string)$form)); + json::reply(array("result" => "error", "form" => (string)$form)); } } @@ -91,14 +91,14 @@ class Admin_Product_Lines_Controller extends Controller $name = $product->name; $product->delete(); } else { - print json_encode(array("result" => "error", + json::reply(array("result" => "error", "form" => $form->__toString())); } $message = t("Deleted user %product_name", array("product_name" => html::clean($name))); log::success("user", $message); message::success($message); - print json_encode(array("result" => "success")); + json::reply(array("result" => "success")); } public function edit_product($id) { @@ -129,9 +129,9 @@ class Admin_Product_Lines_Controller extends Controller $product->save(); message::success(t("Changed product %product_name", array("product_name" => html::clean($product->name)))); - print json_encode(array("result" => "success")); + json::reply(array("result" => "success")); } else { - print json_encode(array("result" => "error", "form" => (string)$form)); + json::reply(array("result" => "error", "form" => (string)$form)); } } diff --git a/modules/basket/controllers/basket.php b/modules/basket/controllers/basket.php index 1620fcdc..612708c4 100644 --- a/modules/basket/controllers/basket.php +++ b/modules/basket/controllers/basket.php @@ -189,7 +189,7 @@ Items Ordered: $form->add_to_basket->product->value, $form->add_to_basket->quantity->value); - print json_encode(array("result" => "success")); + json::reply(array("result" => "success")); } else {