Ejemplo n.º 1
0
                    $price = "\$" . $item->price;
                }
                $product = array('item', "<strong>" . $item->name . "</strong>", sprintf($format, $description, $detail, $price), $item->id);
                array_push($formattedStoreItems, $product);
            }
            $packages = getPackagesWithItems($itemsForPackages);
            foreach ($packages as $package) {
                $description = "";
                if ($item->description != "") {
                    $description = $package->description . "<br/>";
                }
                $price = "Not billable";
                if ($package->billable == "1") {
                    $price = "\$" . $package->price;
                }
                $detail = sto_getItemDescription($package->id);
                $product = array('package', "<strong>" . $package->name . "</strong>", sprintf($formatPackage, $description, $detail, $price), $package->id);
                array_push($formattedStoreItems, $product);
            }
        }
        echo json_encode($formattedStoreItems);
    } catch (Exception $e) {
        echo $e->getMessage();
    } catch (SoapFault $soapfault) {
        echo $soapfault->getMessage();
    }
} else {
    if ($action == "getItem") {
        if (isset($_POST['itemid'])) {
            $id = $_POST['itemid'];
        } else {
Ejemplo n.º 2
0
                    $price = "\$" . $item['price'];
                }
                $product = array('item', "<strong>" . $item['name'] . "</strong>", sprintf($format, $description, $detail, $price), $item['id']);
                array_push($formattedStoreItems, $product);
            }
            $packages = getPackagesWithItems($itemsForPackages);
            foreach ($packages as $package) {
                $description = "";
                if ($item['description'] != "") {
                    $description = $package['description'] . "<br/>";
                }
                $price = "Not billable";
                if ($package['billable'] == "1") {
                    $price = "\$" . $package['price'];
                }
                $detail = sto_getItemDescription($package['id']);
                $product = array('package', "<strong>" . $package->name . "</strong>", sprintf($formatPackage, $description, $detail, $price), $package['id']);
                array_push($formattedStoreItems, $product);
            }
        }
        echo json_encode($formattedStoreItems);
    } catch (Exception $e) {
        echo $e->getMessage();
    } catch (SoapFault $soapfault) {
        echo $soapfault->getMessage();
    }
} else {
    if ($action == "getItem") {
        if (isset($_POST['itemid'])) {
            $id = $_POST['itemid'];
        } else {