本文整理汇总了PHP中OrderSlip类的典型用法代码示例。如果您正苦于以下问题:PHP OrderSlip类的具体用法?PHP OrderSlip怎么用?PHP OrderSlip使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OrderSlip类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createOrderSlip
public static function createOrderSlip($order, $productList, $qtyList, $shipping_cost = false)
{
// create orderSlip
$orderSlip = new OrderSlip();
$orderSlip->id_customer = intval($order->id_customer);
$orderSlip->id_order = intval($order->id);
$orderSlip->shipping_cost = intval($shipping_cost);
if (!$orderSlip->add()) {
return false;
}
// add details
$orderSlip->addSlipDetail($productList, $qtyList);
return true;
}
示例2: __construct
public function __construct(OrderSlip $order_slip, $smarty)
{
$this->order_slip = $order_slip;
$this->order = new Order((int) $order_slip->id_order);
$products = OrderSlip::getOrdersSlipProducts($this->order_slip->id, $this->order);
$customized_datas = Product::getAllCustomizedDatas((int) $this->order->id_cart);
Product::addCustomizationPrice($products, $customized_datas);
$this->order->products = $products;
$this->smarty = $smarty;
// header informations
$this->date = Tools::displayDate($this->order->invoice_date, (int) $this->order->id_lang);
$this->title = HTMLTemplateOrderSlip::l('Slip #') . sprintf('%06d', (int) $this->order_slip->id);
// footer informations
$this->shop = new Shop((int) $this->order->id_shop);
}
示例3: __construct
public function __construct(OrderSlip $order_slip, $smarty)
{
$this->order_slip = $order_slip;
$this->order = new Order((int) $order_slip->id_order);
$products = OrderSlip::getOrdersSlipProducts($this->order_slip->id, $this->order);
$customized_datas = Product::getAllCustomizedDatas((int) $this->order->id_cart);
Product::addCustomizationPrice($products, $customized_datas);
$this->order->products = $products;
$this->smarty = $smarty;
// header informations
$this->date = Tools::displayDate($this->order_slip->date_add);
$this->title = HTMLTemplateOrderSlip::l('Order slip #') . Configuration::get('PS_CREDIT_SLIP_PREFIX', Context::getContext()->language->id) . sprintf('%06d', (int) $this->order_slip->id);
// footer informations
$this->shop = new Shop((int) $this->order->id_shop);
}
示例4: getTemplateVarCreditSlips
public function getTemplateVarCreditSlips()
{
$credit_slips = [];
$orders_slip = OrderSlip::getOrdersSlip((int) $this->context->cookie->id_customer);
foreach ($orders_slip as $order_slip) {
$order = new Order($order_slip['id_order']);
$credit_slips[$order_slip['id_order_slip']] = $order_slip;
$credit_slips[$order_slip['id_order_slip']]['credit_slip_number'] = sprintf($this->trans('#%06d', array(), 'Shop.Theme.CustomerAccount'), $order_slip['id_order_slip']);
$credit_slips[$order_slip['id_order_slip']]['order_number'] = sprintf($this->trans('#%06d', array(), 'Shop.Theme.CustomerAccount'), $order_slip['id_order']);
$credit_slips[$order_slip['id_order_slip']]['order_reference'] = $order->reference;
$credit_slips[$order_slip['id_order_slip']]['credit_slip_date'] = Tools::displayDate($order_slip['date_add'], null, false);
$credit_slips[$order_slip['id_order_slip']]['url'] = $this->context->link->getPageLink('pdf-order-slip', true, null, 'id_order_slip=' . (int) $order_slip['id_order_slip']);
$credit_slips[$order_slip['id_order_slip']]['order_url_details'] = $this->context->link->getPageLink('order-detail', true, null, 'id_order=' . (int) $order_slip['id_order']);
}
return $credit_slips;
}
示例5: __construct
/**
* @param OrderSlip $order_slip
* @param $smarty
* @throws PrestaShopException
*/
public function __construct(OrderSlip $order_slip, $smarty)
{
$this->order_slip = $order_slip;
$this->order = new Order((int) $order_slip->id_order);
$this->id_cart = $this->order->id_cart;
$products = OrderSlip::getOrdersSlipProducts($this->order_slip->id, $this->order);
foreach ($products as $product) {
$customized_datas = Product::getAllCustomizedDatas($this->id_cart, null, true, null, (int) $product['id_customization']);
Product::addProductCustomizationPrice($product, $customized_datas);
}
$this->order->products = $products;
$this->smarty = $smarty;
// header informations
$this->date = Tools::displayDate($this->order_slip->date_add);
$prefix = Configuration::get('PS_CREDIT_SLIP_PREFIX', Context::getContext()->language->id);
$this->title = sprintf(HTMLTemplateOrderSlip::l('%1$s%2$06d'), $prefix, (int) $this->order_slip->id);
$this->shop = new Shop((int) $this->order->id_shop);
}
示例6: postProcess
public function postProcess()
{
if (Tools::isSubmit('submitPrint')) {
if (!Validate::isDate(Tools::getValue('date_from'))) {
$this->_errors[] = $this->l('Invalid from date');
}
if (!Validate::isDate(Tools::getValue('date_to'))) {
$this->_errors[] = $this->l('Invalid end date');
}
if (!sizeof($this->_errors)) {
$orderSlips = OrderSlip::getSlipsIdByDate(Tools::getValue('date_from'), Tools::getValue('date_to'));
if (count($orderSlips)) {
Tools::redirectAdmin('pdf.php?slips&date_from=' . urlencode(Tools::getValue('date_from')) . '&date_to=' . urlencode(Tools::getValue('date_to')) . '&token=' . $this->token);
}
$this->_errors[] = $this->l('No order slips found for this period');
}
}
return parent::postProcess();
}
示例7: postProcess
public function postProcess()
{
if (Tools::getValue('submitAddorder_slip')) {
if (!Validate::isDate(Tools::getValue('date_from'))) {
$this->errors[] = $this->l('Invalid "From" date');
}
if (!Validate::isDate(Tools::getValue('date_to'))) {
$this->errors[] = $this->l('Invalid "To" date');
}
if (!count($this->errors)) {
$order_slips = OrderSlip::getSlipsIdByDate(Tools::getValue('date_from'), Tools::getValue('date_to'));
if (count($order_slips)) {
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf') . '&submitAction=generateOrderSlipsPDF&date_from=' . urlencode(Tools::getValue('date_from')) . '&date_to=' . urlencode(Tools::getValue('date_to')));
}
$this->errors[] = $this->l('No order slips were found for this period.');
}
} else {
return parent::postProcess();
}
}
示例8: addPartialSlipDetail
public function addPartialSlipDetail($order_detail_list)
{
foreach ($order_detail_list as $id_order_detail => $tab) {
$order_detail = new OrderDetail($id_order_detail);
$order_slip_resume = OrderSlip::getProductSlipResume($id_order_detail);
if ($tab['amount'] + $order_slip_resume['amount_tax_incl'] > $order_detail->total_price_tax_incl) {
$tab['amount'] = $order_detail->total_price_tax_incl - $order_slip_resume['amount_tax_incl'];
}
if ($tab['amount'] == 0) {
continue;
}
if ($tab['quantity'] + $order_slip_resume['product_quantity'] > $order_detail->product_quantity) {
$tab['quantity'] = $order_detail->product_quantity - $order_slip_resume['product_quantity'];
}
$tab['amount_tax_excl'] = $tab['amount_tax_incl'] = $tab['amount'];
$id_tax = (int) Db::getInstance()->getValue('
SELECT `id_tax`
FROM `' . _DB_PREFIX_ . 'order_detail_tax`
WHERE `id_order_detail` = ' . (int) $id_order_detail);
if ($id_tax > 0) {
$rate = (double) Db::getInstance()->getValue('
SELECT `rate`
FROM `' . _DB_PREFIX_ . 'tax`
WHERE `id_tax` = ' . (int) $id_tax);
if ($rate > 0) {
$rate = 1 + $rate / 100;
$tab['amount_tax_excl'] = $tab['amount_tax_excl'] / $rate;
}
}
if ($tab['quantity'] > 0 && $tab['quantity'] > $order_detail->product_quantity_refunded) {
$order_detail->product_quantity_refunded = $tab['quantity'];
$order_detail->save();
}
$insert_order_slip = array('id_order_slip' => (int) $this->id, 'id_order_detail' => (int) $id_order_detail, 'product_quantity' => (int) $tab['quantity'], 'amount_tax_excl' => (double) $tab['amount_tax_excl'], 'amount_tax_incl' => (double) $tab['amount_tax_incl']);
Db::getInstance()->insert('order_slip_detail', $insert_order_slip);
}
}
示例9: processGenerateOrderSlipsPDF
public function processGenerateOrderSlipsPDF()
{
$id_order_slips_list = OrderSlip::getSlipsIdByDate(Tools::getValue('date_from'), Tools::getValue('date_to'));
if (!count($id_order_slips_list)) {
die(Tools::displayError('No order slips were found.'));
}
$order_slips = array();
foreach ($id_order_slips_list as $id_order_slips) {
$order_slips[] = new OrderSlip((int) $id_order_slips);
}
$this->generatePDF($order_slips, PDF::TEMPLATE_ORDER_SLIP);
}
示例10: multipleOrderSlips
public static function multipleOrderSlips($orderSlips)
{
$pdf = new PDF('P', 'mm', 'A4');
foreach ($orderSlips as $id_order_slip) {
$orderSlip = new OrderSlip((int) $id_order_slip);
$order = new Order((int) $orderSlip->id_order);
$order->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $order);
if (Validate::isLoadedObject($orderSlip) and Validate::isLoadedObject($order)) {
PDF::invoice($order, 'D', true, $pdf, $orderSlip);
}
}
return $pdf->Output('order_slips.pdf', 'D');
}
示例11: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$this->context->smarty->assign('ordersSlip', OrderSlip::getOrdersSlip((int) $this->context->cookie->id_customer));
$this->setTemplate(_PS_THEME_DIR_ . 'order-slip.tpl');
}
示例12: hookPayment
//.........这里部分代码省略.........
if ($discount == '0') {
$discount = 'false';
}
if ($discount == '1') {
$discount = 'true';
}
$discount_boolean = $discount == 'true' ? 1 : 0;
$iframe = Configuration::get('PAYLATER_IFRAME');
if ($iframe == 1) {
$iframe = 'true';
}
$endpoint = $this->url;
$order_id = $this->context->cart->id;
//description
$description = implode(',', $desciption);
$convert_price = Tools::convertPrice($this->context->cart->getOrderTotal(true, 3), $this->context->currency);
$amount = number_format($convert_price, 2, '.', '');
$amount = str_replace('.', '', $amount);
if (Configuration::get('PAYLATER_ENVIRONMENT') == 1) {
$key_to_use = Configuration::get('PAYLATER_ACCOUNT_KEY_LIVE');
} else {
$key_to_use = Configuration::get('PAYLATER_ACCOUNT_KEY_TEST');
}
$widget_type = Configuration::get('PAYLATER_TYPE') == 'false' ? '0' : '1';
$total_paid = 0;
$num_prev_orders = 0;
$sign_up_date = '';
$num_partial_refunds = 0;
$amount_refunded = 0;
$num_full_refunds = 0;
$super_checkout_enabled = false;
$onepagecheckoutps_enabled = false;
$onepagecheckout_enabled = false;
if (version_compare(_PS_VERSION_, "1.5", "<")) {
if ($this->context->cookie->logged) {
$orders = Order::getCustomerOrders($this->context->customer->id);
foreach ($orders as $o) {
$total_paid += $o['total_paid'];
$num_prev_orders++;
}
$sign_up_date = Tools::substr($this->context->customer->date_add, 0, 10);
$order_slips = OrderSlip::getOrdersSlip((int) $this->context->cookie->id_customer);
foreach ($order_slips as $o) {
$num_full_refunds++;
$amount_refunded += $o['amount'];
}
}
} else {
//query for paid statuses
$sql = new DbQuery();
$sql->select('id_order_state');
$sql->from('order_state', 'c');
$sql->where('c.paid = 1');
$db_paid_statuses = Db::getInstance()->executeS($sql);
$paid_statuses = [];
foreach ($db_paid_statuses as $p) {
$paid_statuses[] = $p['id_order_state'];
}
if ($this->context->cookie->logged) {
$orders = Order::getCustomerOrders($this->context->customer->id);
foreach ($orders as $o) {
if (array_key_exists('id_order_state', $o) && in_array($o['id_order_state'], $paid_statuses)) {
$total_paid += $o['total_paid'];
$num_prev_orders++;
}
}
$sign_up_date = Tools::substr($this->context->customer->date_add, 0, 10);
$order_slips = OrderSlip::getOrdersSlip((int) $this->context->cookie->id_customer);
foreach ($order_slips as $o) {
$sql = new DbQuery();
$sql->select('total_paid');
$sql->from('orders', 'c');
$sql->where('c.id_order = ' . $o['id_order']);
$db_total_paid = Db::getInstance()->executeS($sql);
if ($db_total_paid[0]['total_paid'] <= $o['amount']) {
$num_full_refunds++;
} else {
$num_partial_refunds++;
}
$amount_refunded += $o['amount'];
}
}
$super_checkout_enabled = Module::isEnabled('supercheckout');
$onepagecheckoutps_enabled = Module::isEnabled('onepagecheckoutps');
$onepagecheckout_enabled = Module::isEnabled('onepagecheckout');
}
//d($key_to_use.$account_id.$order_id.$amount.$this->context->currency->iso_code.$url_OK.$url_NOK);
$text = $key_to_use . $account_id . $order_id . $amount . $this->context->currency->iso_code . $url_OK . $url_NOK . $callback_url . $discount . $cancelled_url;
$signature = hash('sha512', $text);
$this->smarty->assign(array('endpoint' => $endpoint, 'account_id' => $account_id, 'currency' => $this->context->currency->iso_code, 'ok_url' => $url_OK, 'nok_url' => $url_NOK, 'cancelled_url' => $cancelled_url, 'order_id' => $order_id, 'amount' => $amount, 'description' => $description, 'items' => $items, 'signature' => $signature, 'customer_name' => $this->context->cookie->logged ? $this->context->cookie->customer_firstname . ' ' . $this->context->cookie->customer_lastname : $customer->firstname . " " . $customer->lastname, 'customer_email' => $this->context->cookie->logged ? $this->context->cookie->email : $customer->email, 'locale' => $this->context->language->iso_code, 'cart_products' => $cart_products, 'street' => $street, 'city' => $city, 'province' => $province, 'zipcode' => $zipcode, 'sstreet' => $sstreet, 'scity' => $scity, 'sprovince' => $sprovince, 'szipcode' => $szipcode, 'phone' => $phone, 'mobile_phone' => $mobile_phone, 'dni' => $dni, 'callback_url' => $callback_url, 'discount' => $discount, 'discount_boolean' => $discount_boolean, 'dob' => $this->context->customer->birthday ? $this->context->customer->birthday : $customer->birthday, 'iframe' => $iframe, 'total_paid' => $total_paid, 'num_prev_orders' => $num_prev_orders, 'sign_up_date' => $sign_up_date, 'amount_refunded' => $amount_refunded, 'num_full_refunds' => $num_full_refunds, 'num_partial_refunds' => $num_partial_refunds, 'version4' => version_compare(_PS_VERSION_, "1.5", "<"), 'version3' => version_compare(_PS_VERSION_, "1.4", "<"), 'content' => "javascript:\$('#paylater_form').submit();"));
if ($super_checkout_enabled) {
return $this->display(__FILE__, 'views/templates/front/payment_supercheckout.tpl');
} elseif ($onepagecheckoutps_enabled || $onepagecheckout_enabled) {
return $this->display(__FILE__, 'views/templates/front/payment.tpl');
} elseif ($widget_type) {
return $this->display(__FILE__, 'views/templates/front/payment_widget.tpl');
} else {
return $this->display(__FILE__, 'views/templates/front/payment.tpl');
}
}
示例13: dirname
<?php
include dirname(__FILE__) . '/config/config.inc.php';
include dirname(__FILE__) . '/init.php';
$cookie = new Cookie('ps');
if (!$cookie->isLogged()) {
Tools::redirect('authentication.php?back=order-follow.php');
}
if (isset($_GET['id_order_slip']) and Validate::isUnsignedId($_GET['id_order_slip'])) {
$orderSlip = new OrderSlip(intval($_GET['id_order_slip']));
}
if (!isset($orderSlip) or !Validate::isLoadedObject($orderSlip)) {
die(Tools::displayError('order return not found'));
} elseif ($orderSlip->id_customer != $cookie->id_customer) {
die(Tools::displayError('order return not found'));
}
$order = new Order(intval($orderSlip->id_order));
if (!Validate::isLoadedObject($order)) {
die(Tools::displayError('order not found'));
}
$order->products = OrderSlip::getOrdersSlipProducts(intval($orderSlip->id), $order);
$ref = NULL;
PDF::invoice($order, 'D', false, $ref, $orderSlip);
示例14: processGenerateOrderSlipsPDF
public function processGenerateOrderSlipsPDF()
{
$id_order_slips_list = OrderSlip::getSlipsIdByDate(Tools::getValue('date_from'), Tools::getValue('date_to'));
if (!count($id_order_slips_list)) {
die($this->trans('No order slips were found.', array(), 'Admin.OrdersCustomers.Notification'));
}
$order_slips = array();
foreach ($id_order_slips_list as $id_order_slips) {
$order_slips[] = new OrderSlip((int) $id_order_slips);
}
$this->generatePDF($order_slips, PDF::TEMPLATE_ORDER_SLIP);
}
示例15: process
public function process()
{
parent::process();
self::$smarty->assign('ordersSlip', OrderSlip::getOrdersSlip((int) self::$cookie->id_customer));
}