本文整理汇总了PHP中Basket::getPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP Basket::getPrice方法的具体用法?PHP Basket::getPrice怎么用?PHP Basket::getPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Basket
的用法示例。
在下文中一共展示了Basket::getPrice方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addListToBasket
public static function addListToBasket()
{
$num = 0;
foreach ($_POST['id'] as $id) {
$num = $_POST['num'][$id];
$goods = Catalog::getOne($id);
$_SESSION['goods'][$id]['price'] = Basket::getPrice($goods, $num);
$_SESSION['goods'][$id]['id'] = $id;
$_SESSION['goods'][$id]['num'] = $num;
}
$data = Basket::getSimpleOrder();
die($data['sum'] . '_' . $data['goods']);
}
示例2: step4
public function step4()
{
$tree = array('name' => $_SESSION['iuser']['upload']['title']);
$id = Tree::addTree($_SESSION['iuser']['upload']['spec'], $tree, 'catalog');
if (file_exists($_SESSION['iuser']['upload']['filecover']['path']) && file_exists($_SESSION['iuser']['upload']['filepages']['path'])) {
$dir = $_SERVER['DOCUMENT_ROOT'] . IUSER_DIR . md5('fotouser' . $_SESSION['iuser']['id']) . '/';
if (!file_exists($dir)) {
mkdir($dir, 0777);
}
$dir = $dir . md5('fotobook' . $id) . '/';
mkdir($dir, 0777);
for ($file2i = 0; $file2i < 2; $file2i++) {
if ($file2i == 0) {
$filename = explode('.', $_SESSION['iuser']['upload']['filecover']['name']);
$filesource = $_SESSION['iuser']['upload']['filecover']['path'];
} else {
$filename = explode('.', $_SESSION['iuser']['upload']['filepages']['name']);
$filesource = $_SESSION['iuser']['upload']['filepages']['path'];
}
$raz = $filename[count($filename) - 1];
unset($filename[count($filename) - 1]);
$filename = implode('', $filename);
$filenameraz = Funcs::Transliterate($filename) . '.' . $raz;
$dirfile = $dir . $filenameraz;
$x = 0;
$i = 1;
while ($x == 0) {
if (file_exists($dirfile)) {
$filenameraz = Funcs::Transliterate($filename) . $i . '.' . $raz;
$dirfile = $dir . md5($filename) . '/' . $filenameraz;
} else {
$x = 1;
}
$i++;
}
copy($filesource, $dirfile);
chmod($dirfile, 0777);
unlink($filesource);
if ($file2i == 0) {
$filename1 = $filenameraz;
} else {
$filename2 = $filenameraz;
}
}
}
$price = Basket::getPrice('session');
$sql = '
INSERT INTO {{catalog}}
SET
tree=' . $id . ',
description=\'' . $_SESSION['iuser']['upload']['description'] . '\',
phrase=\'' . $_SESSION['iuser']['upload']['phrase'] . '\',
author=\'' . $_SESSION['iuser']['upload']['author'] . '\',
private=' . $_SESSION['iuser']['upload']['private'] . ',
booksize=' . $_SESSION['iuser']['upload']['booksize'] . ',
countpage=' . $_SESSION['iuser']['upload']['countpage'] . ',
binding=' . $_SESSION['iuser']['upload']['binding'] . ',
paper=' . $_SESSION['iuser']['upload']['paper'] . ',
price=' . $price . ',
filecover=\'' . $filename1 . '\',
filepages=\'' . $filename2 . '\',
vendor=' . $_SESSION['iuser']['id'] . '
';
DB::exec($sql);
unset($_SESSION['iuser']['upload']);
$_SESSION['iuser']['upload']['id'] = $id;
$_SESSION['iuser']['upload']['price'] = $price;
Upload::addGallery($id, $filename1, $filename2, $dir);
Email::uploadSend();
}
示例3: actSaveOrder
function actSaveOrder()
{
include 'modules/catalog/Basket.class.php';
global $ST, $post;
$id = $post->getInt('id');
$count = $post->getArray('count');
$price = $post->getArray('price');
if (!$count) {
echo printJSON(array('msg' => 'Ошибка сохранения. Корзина пуста'));
exit;
}
$orderItem = $count;
$rs = $ST->select("SELECT * \r\n\t\t\tFROM sc_shop_item \r\n\t\t\tWHERE id IN (" . implode(',', array_keys($count)) . ")");
while ($rs->next()) {
$orderItem[$rs->get('id')] = array('count' => $count[$rs->get('id')], 'price' => $price[$rs->get('id')]);
}
$basket = new Basket($orderItem);
$basket->delivery = $post->getFloat('delivery');
$basket->discount = $post->getFloat('discount');
$data = array('order_status' => $post->get('order_status'), 'comment' => $post->get('comment'), 'review' => $post->get('review'), 'perfid' => $this->getUserId(), 'price' => $basket->getPrice(), 'total_price' => $basket->getTotalPrice(), 'discount' => $basket->discount, 'delivery' => $basket->delivery, 'delivery_type' => $post->get('delivery_type'), 'date' => dte($post->get('date'), 'Y-m-d'), 'time' => $post->get('time'), 'fullname' => $post->get('fullname'), 'address' => $post->get('address'), 'phone' => $post->get('phone'), 'additionally' => $post->get('additionally'));
$out['msg'] = 'Сохранено';
if ($id) {
if (in_array($data['order_status'], array(3))) {
//Логируем изменения
$cur_data = array('date' => '', 'discount' => '', 'delivery' => '', 'delivery_type' => '');
$cur_data_item = array();
$rs = $ST->select("SELECT " . implode(',', array_keys($cur_data)) . " FROM sc_shop_order WHERE id={$id}");
if ($rs->next()) {
$cur_data = $rs->getRow();
$rs = $ST->select("SELECT itemid,count,price FROM sc_shop_order_item WHERE orderid={$id} ORDER BY itemid");
while ($rs->next()) {
$row = $rs->getRow();
$cur_data['items'][$rs->get('itemid')] = array('count' => $rs->get('count'), 'price' => $rs->get('price'));
}
}
// $change=array();
// foreach ($cur_data as $k=>$v){
// if(trim($v)!=trim($data[$k])){
// $change[$k]=$data[$k];
// }
// }
// ksort($orderItem);
// if(json_encode($cur_data_item)!=json_encode($orderItem)){
// $change['item']=$cur_data_item;
// }
if ($cur_data) {
$ST->insert('sc_shop_order_datalog', array('orderid' => $id, 'data' => serialize($cur_data)));
}
}
////////////////////////////////////
$ST->update('sc_shop_order', $data, "id=" . $id);
$ST->delete('sc_shop_order_item', 'orderid=' . $id);
} else {
$data['userid'] = $this->getUserId();
$id = $ST->insert('sc_shop_order', $data);
}
$this->logOrder($id, $this->getUserId(), $post->get('order_status'));
foreach ($orderItem as $key => $row) {
$d['orderid'] = $id;
$d['itemid'] = $key;
$d['count'] = $row['count'];
$d['price'] = $row['price'];
$ST->insert('sc_shop_order_item', $d);
}
$out['id'] = $id;
echo printJSON($out);
exit;
}
示例4: _executePayment
/**
* Executes payment. Additionally loads oxPaymentGateway object, initiates
* it by adding payment parameters (oxPaymentGateway::setPaymentParams())
* and finally executes it (oxPaymentGateway::executePayment()). On failure -
* deletes order and returns * error code 2.
*
* @param Basket $oBasket basket object
* @param object $oUserpayment user payment object
*
* @return integer 2 or an error code
*/
protected function _executePayment(Basket $oBasket, $oUserpayment)
{
$oPayTransaction = $this->_getGateway();
$oPayTransaction->setPaymentParams($oUserpayment);
if (!$oPayTransaction->executePayment($oBasket->getPrice()->getBruttoPrice(), $this)) {
$this->delete();
// checking for error messages
if (method_exists($oPayTransaction, 'getLastError')) {
if ($sLastError = $oPayTransaction->getLastError()) {
return $sLastError;
}
}
// checking for error codes
if (method_exists($oPayTransaction, 'getLastErrorNo')) {
if ($iLastErrorNo = $oPayTransaction->getLastErrorNo()) {
return $iLastErrorNo;
}
}
return self::ORDER_STATE_PAYMENTERROR;
// means no authentication
}
return true;
// everything fine
}
示例5: updateBasketData
function updateBasketData()
{
$data['posible'] = true;
$data['delivery_type'] = $this->getDeliveryType();
$data['delivery_cond'] = (int) $this->cfg('SHOP_DELIVERY_COND');
$data['delivery_order_cond'] = (int) $this->cfg('SHOP_ORDER_COND');
$data['delivery_express_price'] = (double) $this->cfg('SHOP_DELIVERY_EXPRESS');
$data['delivery_pickup'] = (double) $this->cfg('SHOP_DELIVERY_PICKUP');
$basket = $this->getBasketExt();
foreach ($basket as $dist => &$prop) {
$bsk = new Basket($prop['item']);
if ($dist == 0) {
//исключение для кировского
$prop['delivery_order_cond'] = $data['delivery_order_cond'];
if ($bsk->getPrice() < $data['delivery_cond'] && $this->getUser('type') != 'user_1') {
$bsk->delivery = (double) $this->cfg('SHOP_DELIVERY');
}
if ($this->getUser('type') == 'user_1') {
$prop['delivery_order_cond'] = 0;
}
if ($data['delivery_type'] == 2) {
$bsk->delivery = (double) $data['delivery_express_price'];
}
$bsk->discount = (double) $this->getUser('discount');
$data['delivery_pickup'] = max($bsk->discount, $data['delivery_pickup']);
if ($data['delivery_type'] == 3) {
$bsk->discount = $data['delivery_pickup'];
$bsk->delivery = 0;
}
} else {
$bsk->delivery = $prop['delivery'];
if ($prop['delivery_cond'] && $bsk->getPrice() >= $prop['delivery_cond']) {
$bsk->delivery = 0;
}
}
$prop['posible'] = true;
if ($prop['delivery_order_cond'] > $bsk->getPrice()) {
$prop['posible'] = false;
$data['posible'] = false;
}
$basket[$dist]['basket'] = $bsk;
}
$data['glob_basket'] = $basket;
return $data;
}