本文整理汇总了PHP中Cart66Common::convert_currency_to_number方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart66Common::convert_currency_to_number方法的具体用法?PHP Cart66Common::convert_currency_to_number怎么用?PHP Cart66Common::convert_currency_to_number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cart66Common
的用法示例。
在下文中一共展示了Cart66Common::convert_currency_to_number方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: paypalSubscriptions
public static function paypalSubscriptions()
{
$data = array();
if (CART66_PRO) {
$sub = new Cart66PayPalSubscription();
$data['subscription'] = $sub;
if ($_SERVER['REQUEST_METHOD'] == 'POST' && Cart66Common::postVal('cart66-action') == 'save paypal subscription') {
$subData = Cart66Common::postVal('subscription');
$subData['setup_fee'] = isset($subData['setup_fee']) ? Cart66Common::convert_currency_to_number($subData['setup_fee']) : '';
$subData['price'] = isset($subData['price']) ? Cart66Common::convert_currency_to_number($subData['price']) : '';
$sub->setData($subData);
$errors = $sub->validate();
if (count($errors) == 0) {
$sub->save();
$sub->clear();
$data['subscription'] = $sub;
} else {
$data['errors'] = $sub->getErrors();
$data['jqErrors'] = $sub->getJqErrors();
}
} else {
if (Cart66Common::getVal('task') == 'edit' && isset($_GET['id'])) {
$sub->load(Cart66Common::getVal('id'));
$data['subscription'] = $sub;
} elseif (Cart66Common::getVal('task') == 'delete' && isset($_GET['id'])) {
$sub->load(Cart66Common::getVal('id'));
$sub->deleteMe();
$sub->clear();
$data['subscription'] = $sub;
}
}
$data['plans'] = $sub->getModels('where is_paypal_subscription>0', 'order by name', '1');
$view = Cart66Common::getView('pro/admin/paypal-subscriptions.php', $data);
echo $view;
} else {
echo '<h2>PayPal Subscriptions</h2><p class="description">This feature is only available in <a href="http://cart66.com">Cart66 Professional</a>.</p>';
}
}
示例2: Cart66Product
<?php
$product = new Cart66Product();
$adminUrl = get_bloginfo('wpurl') . '/wp-admin/admin.php';
$errorMessage = false;
if ($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['cart66-action'] == 'save product') {
$_POST['product']['price'] = isset($_POST['product']['price']) ? Cart66Common::convert_currency_to_number($_POST['product']['price']) : '';
try {
$product->handleFileUpload();
$product->setData(Cart66Common::postVal('product'));
$product->save();
$product->clear();
} catch (Cart66Exception $e) {
$errorCode = $e->getCode();
if ($errorCode == 66102) {
// Product save failed
$errors = $product->getErrors();
$errorMessage = Cart66Common::showErrors($errors, "<p><b>" . __("The product could not be saved for the following reasons", "cart66") . ":</b></p>");
} elseif ($errorCode == 66101) {
// File upload failed
$errors = $product->getErrors();
$errorMessage = Cart66Common::showErrors($errors, "<p><b>" . __("The file upload failed", "cart66") . ":</b></p>");
}
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Product save failed ({$errorCode}): " . strip_tags($errorMessage));
}
} elseif (isset($_GET['task']) && $_GET['task'] == 'edit' && isset($_GET['id']) && $_GET['id'] > 0) {
$id = Cart66Common::getVal('id');
$product->load($id);
} elseif (isset($_GET['task']) && $_GET['task'] == 'delete' && isset($_GET['id']) && $_GET['id'] > 0) {
$id = Cart66Common::getVal('id');
$product->load($id);
示例3: Cart66Promotion
<?php
$promo = new Cart66Promotion();
$errorMessage = false;
if ($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['cart66-action'] == 'save promotion') {
$_POST['promo']['amount'] = isset($_POST['promo']['amount']) ? Cart66Common::convert_currency_to_number($_POST['promo']['amount']) : '';
$_POST['promo']['min_order'] = isset($_POST['promo']['min_order']) ? Cart66Common::convert_currency_to_number($_POST['promo']['min_order']) : '';
$_POST['promo']['max_order'] = isset($_POST['promo']['max_order']) ? Cart66Common::convert_currency_to_number($_POST['promo']['max_order']) : '';
try {
$promo->load($_POST['promo']['id']);
$promo->setData($_POST['promo']);
$promo->save();
$promo->clear();
} catch (Cart66Exception $e) {
$errorCode = $e->getCode();
if ($errorCode == 66301) {
// Promotion save failed
$errors = $promo->getErrors();
$errorMessage = Cart66Common::showErrors($errors, "<p><b>" . __("The promotion could not be saved for the following reasons", "cart66") . ":</b></p>");
}
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Promotion save failed ({$errorCode}): " . strip_tags($errorMessage));
}
} elseif (isset($_GET['task']) && $_GET['task'] == 'edit' && isset($_GET['id']) && $_GET['id'] > 0) {
$id = Cart66Common::getVal('id');
$promo->load($id);
} elseif (isset($_GET['task']) && $_GET['task'] == 'delete' && isset($_GET['id']) && $_GET['id'] > 0) {
$id = Cart66Common::getVal('id');
$promo->load($id);
$promo->deleteMe();
$promo->clear();
}