当前位置: 首页>>代码示例>>PHP>>正文


PHP PDF::render方法代码示例

本文整理汇总了PHP中PDF::render方法的典型用法代码示例。如果您正苦于以下问题:PHP PDF::render方法的具体用法?PHP PDF::render怎么用?PHP PDF::render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PDF的用法示例。


在下文中一共展示了PDF::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 public function display()
 {
     $order_invoice_list = $this->order->getInvoicesCollection();
     Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list));
     $pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty);
     $pdf->render();
 }
开发者ID:NathanGiesbrecht,项目名称:PrestaShopAutomationFramework,代码行数:7,代码来源:PdfInvoiceController.php

示例2: display

 public function display()
 {
     $pdf = new PDF($this->order_slip, PDF::TEMPLATE_ORDER_SLIP, $this->context->smarty);
     $pdf->render();
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:5,代码来源:PdfOrderSlipController.php

示例3: validateOrder


//.........这里部分代码省略.........
                     $customer_message->id_customer_thread = $customer_thread->id;
                     $customer_message->id_employee = 0;
                     $customer_message->message = $update_message->message;
                     $customer_message->private = 0;
                     if (!$customer_message->add()) {
                         $this->errors[] = Tools::displayError('An error occurred while saving message');
                     }
                 }
                 if (self::DEBUG_MODE) {
                     PrestaShopLogger::addLog('PaymentModule::validateOrder - Hook validateOrder is about to be called', 1, null, 'Cart', (int) $id_cart, true);
                 }
                 // Hook validate order
                 Hook::exec('actionValidateOrder', array('cart' => $this->context->cart, 'order' => $order, 'customer' => $this->context->customer, 'currency' => $this->context->currency, 'orderStatus' => $order_status));
                 foreach ($this->context->cart->getProducts() as $product) {
                     if ($order_status->logable) {
                         ProductSale::addProductSale((int) $product['id_product'], (int) $product['cart_quantity']);
                     }
                 }
                 if (self::DEBUG_MODE) {
                     PrestaShopLogger::addLog('PaymentModule::validateOrder - Order Status is about to be added', 1, null, 'Cart', (int) $id_cart, true);
                 }
                 // Set the order status
                 $new_history = new OrderHistory();
                 $new_history->id_order = (int) $order->id;
                 $new_history->changeIdOrderState((int) $id_order_state, $order, true);
                 $new_history->addWithemail(true, $extra_vars);
                 // Switch to back order if needed
                 if (Configuration::get('PS_STOCK_MANAGEMENT') && $order_detail->getStockState()) {
                     $history = new OrderHistory();
                     $history->id_order = (int) $order->id;
                     $history->changeIdOrderState(Configuration::get($order->valid ? 'PS_OS_OUTOFSTOCK_PAID' : 'PS_OS_OUTOFSTOCK_UNPAID'), $order, true);
                     $history->addWithemail();
                 }
                 unset($order_detail);
                 // Order is reloaded because the status just changed
                 $order = new Order($order->id);
                 // Send an e-mail to customer (one order = one email)
                 if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && $this->context->customer->id) {
                     $invoice = new Address($order->id_address_invoice);
                     $delivery = new Address($order->id_address_delivery);
                     $delivery_state = $delivery->id_state ? new State($delivery->id_state) : false;
                     $invoice_state = $invoice->id_state ? new State($invoice->id_state) : false;
                     $data = array('{firstname}' => $this->context->customer->firstname, '{lastname}' => $this->context->customer->lastname, '{email}' => $this->context->customer->email, '{delivery_block_txt}' => $this->_getFormatedAddress($delivery, "\n"), '{invoice_block_txt}' => $this->_getFormatedAddress($invoice, "\n"), '{delivery_block_html}' => $this->_getFormatedAddress($delivery, '<br />', array('firstname' => '<span style="font-weight:bold;">%s</span>', 'lastname' => '<span style="font-weight:bold;">%s</span>')), '{invoice_block_html}' => $this->_getFormatedAddress($invoice, '<br />', array('firstname' => '<span style="font-weight:bold;">%s</span>', 'lastname' => '<span style="font-weight:bold;">%s</span>')), '{delivery_company}' => $delivery->company, '{delivery_firstname}' => $delivery->firstname, '{delivery_lastname}' => $delivery->lastname, '{delivery_address1}' => $delivery->address1, '{delivery_address2}' => $delivery->address2, '{delivery_city}' => $delivery->city, '{delivery_postal_code}' => $delivery->postcode, '{delivery_country}' => $delivery->country, '{delivery_state}' => $delivery->id_state ? $delivery_state->name : '', '{delivery_phone}' => $delivery->phone ? $delivery->phone : $delivery->phone_mobile, '{delivery_other}' => $delivery->other, '{invoice_company}' => $invoice->company, '{invoice_vat_number}' => $invoice->vat_number, '{invoice_firstname}' => $invoice->firstname, '{invoice_lastname}' => $invoice->lastname, '{invoice_address2}' => $invoice->address2, '{invoice_address1}' => $invoice->address1, '{invoice_city}' => $invoice->city, '{invoice_postal_code}' => $invoice->postcode, '{invoice_country}' => $invoice->country, '{invoice_state}' => $invoice->id_state ? $invoice_state->name : '', '{invoice_phone}' => $invoice->phone ? $invoice->phone : $invoice->phone_mobile, '{invoice_other}' => $invoice->other, '{order_name}' => $order->getUniqReference(), '{date}' => Tools::displayDate(date('Y-m-d H:i:s'), null, 1), '{carrier}' => $virtual_product || !isset($carrier->name) ? Tools::displayError('No carrier') : $carrier->name, '{payment}' => Tools::substr($order->payment, 0, 32), '{products}' => $product_list_html, '{products_txt}' => $product_list_txt, '{discounts}' => $cart_rules_list_html, '{discounts_txt}' => $cart_rules_list_txt, '{total_paid}' => Tools::displayPrice($order->total_paid, $this->context->currency, false), '{total_products}' => Tools::displayPrice($order->total_paid - $order->total_shipping - $order->total_wrapping + $order->total_discounts, $this->context->currency, false), '{total_discounts}' => Tools::displayPrice($order->total_discounts, $this->context->currency, false), '{total_shipping}' => Tools::displayPrice($order->total_shipping, $this->context->currency, false), '{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $this->context->currency, false), '{total_tax_paid}' => Tools::displayPrice($order->total_products_wt - $order->total_products + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $this->context->currency, false));
                     if (is_array($extra_vars)) {
                         $data = array_merge($data, $extra_vars);
                     }
                     // Join PDF invoice
                     if ((int) Configuration::get('PS_INVOICE') && $order_status->invoice && $order->invoice_number) {
                         $pdf = new PDF($order->getInvoicesCollection(), PDF::TEMPLATE_INVOICE, $this->context->smarty);
                         $file_attachement = array();
                         $file_attachement['content'] = $pdf->render(false);
                         $file_attachement['name'] = Configuration::get('PS_INVOICE_PREFIX', (int) $order->id_lang, null, $order->id_shop) . sprintf('%06d', $order->invoice_number) . '.pdf';
                         $file_attachement['mime'] = 'application/pdf';
                     } else {
                         $file_attachement = null;
                     }
                     if (self::DEBUG_MODE) {
                         PrestaShopLogger::addLog('PaymentModule::validateOrder - Mail is about to be sent', 1, null, 'Cart', (int) $id_cart, true);
                     }
                     if (Validate::isEmail($this->context->customer->email)) {
                         Mail::Send((int) $order->id_lang, 'order_conf', Mail::l('Order confirmation', (int) $order->id_lang), $data, $this->context->customer->email, $this->context->customer->firstname . ' ' . $this->context->customer->lastname, null, null, $file_attachement, null, _PS_MAIL_DIR_, false, (int) $order->id_shop);
                     }
                 }
                 // updates stock in shops
                 if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
                     $product_list = $order->getProducts();
                     foreach ($product_list as $product) {
                         // if the available quantities depends on the physical stock
                         if (StockAvailable::dependsOnStock($product['product_id'])) {
                             // synchronizes
                             StockAvailable::synchronize($product['product_id'], $order->id_shop);
                         }
                     }
                 }
             } else {
                 $error = Tools::displayError('Order creation failed');
                 PrestaShopLogger::addLog($error, 4, '0000002', 'Cart', (int) $order->id_cart);
                 die($error);
             }
         }
         // End foreach $order_detail_list
         // Update Order Details Tax in case cart rules have free shipping
         foreach ($order->getOrderDetailList() as $detail) {
             $order_detail = new OrderDetail($detail['id_order_detail']);
             $order_detail->updateTaxAmount($order);
         }
         // Use the last order as currentOrder
         if (isset($order) && $order->id) {
             $this->currentOrder = (int) $order->id;
         }
         if (self::DEBUG_MODE) {
             PrestaShopLogger::addLog('PaymentModule::validateOrder - End of validateOrder', 1, null, 'Cart', (int) $id_cart, true);
         }
         return true;
     } else {
         $error = Tools::displayError('Cart cannot be loaded or an order has already been placed using this cart');
         PrestaShopLogger::addLog($error, 4, '0000001', 'Cart', (int) $this->context->cart->id);
         die($error);
     }
 }
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:101,代码来源:PaymentModule.php

示例4: display

 public function display()
 {
     $pdf = new PDF($this->orderReturn, PDF::TEMPLATE_ORDER_RETURN, $this->context->smarty);
     $pdf->render();
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:5,代码来源:PdfOrderReturnController.php

示例5: sendEmail

    public function sendEmail($order, $template_vars = false)
    {
        $result = Db::getInstance()->getRow('
			SELECT osl.`template`, c.`lastname`, c.`firstname`, osl.`name` AS osname, c.`email`, os.`module_name`, os.`id_order_state`, os.`pdf_invoice`, os.`pdf_delivery`
			FROM `' . _DB_PREFIX_ . 'order_history` oh
				LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON oh.`id_order` = o.`id_order`
				LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON o.`id_customer` = c.`id_customer`
				LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON oh.`id_order_state` = os.`id_order_state`
				LEFT JOIN `' . _DB_PREFIX_ . 'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = o.`id_lang`)
			WHERE oh.`id_order_history` = ' . (int) $this->id . ' AND os.`send_email` = 1');
        if (isset($result['template']) && Validate::isEmail($result['email'])) {
            ShopUrl::cacheMainDomainForShop($order->id_shop);
            $topic = $result['osname'];
            $data = array('{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int) $this->id_order, '{order_name}' => $order->getUniqReference());
            if ($result['module_name']) {
                $module = Module::getInstanceByName($result['module_name']);
                if (Validate::isLoadedObject($module) && isset($module->extra_mail_vars) && is_array($module->extra_mail_vars)) {
                    $data = array_merge($data, $module->extra_mail_vars);
                }
            }
            if ($template_vars) {
                $data = array_merge($data, $template_vars);
            }
            $data['{total_paid}'] = Tools::displayPrice((double) $order->total_paid, new Currency((int) $order->id_currency), false);
            if (Validate::isLoadedObject($order)) {
                // Attach invoice and / or delivery-slip if they exists and status is set to attach them
                if ($result['pdf_invoice'] || $result['pdf_delivery']) {
                    $context = Context::getContext();
                    $invoice = $order->getInvoicesCollection();
                    $file_attachement = array();
                    if ($result['pdf_invoice'] && (int) Configuration::get('PS_INVOICE') && $order->invoice_number) {
                        Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $invoice));
                        $pdf = new PDF($invoice, PDF::TEMPLATE_INVOICE, $context->smarty);
                        $file_attachement['invoice']['content'] = $pdf->render(false);
                        $file_attachement['invoice']['name'] = Configuration::get('PS_INVOICE_PREFIX', (int) $order->id_lang, null, $order->id_shop) . sprintf('%06d', $order->invoice_number) . '.pdf';
                        $file_attachement['invoice']['mime'] = 'application/pdf';
                    }
                    if ($result['pdf_delivery'] && $order->delivery_number) {
                        $pdf = new PDF($invoice, PDF::TEMPLATE_DELIVERY_SLIP, $context->smarty);
                        $file_attachement['delivery']['content'] = $pdf->render(false);
                        $file_attachement['delivery']['name'] = Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id, null, $order->id_shop) . sprintf('%06d', $order->delivery_number) . '.pdf';
                        $file_attachement['delivery']['mime'] = 'application/pdf';
                    }
                } else {
                    $file_attachement = null;
                }
                if (!Mail::Send((int) $order->id_lang, $result['template'], $topic, $data, $result['email'], $result['firstname'] . ' ' . $result['lastname'], null, null, $file_attachement, null, _PS_MAIL_DIR_, false, (int) $order->id_shop)) {
                    return false;
                }
            }
            ShopUrl::resetMainDomainCache();
        }
        return true;
    }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:54,代码来源:OrderHistory.php

示例6: addWithemail

    /**
     * @param bool $autodate Optional
     * @param array $template_vars Optional
     * @param Context $context Optional
     * @return bool
     */
    public function addWithemail($autodate = true, $template_vars = false, Context $context = null)
    {
        if (!$context) {
            $context = Context::getContext();
        }
        $order = new Order($this->id_order);
        if (!$this->add($autodate)) {
            return false;
        }
        $result = Db::getInstance()->getRow('
			SELECT osl.`template`, c.`lastname`, c.`firstname`, osl.`name` AS osname, c.`email`, os.`module_name`, os.`id_order_state`
			FROM `' . _DB_PREFIX_ . 'order_history` oh
				LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON oh.`id_order` = o.`id_order`
				LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON o.`id_customer` = c.`id_customer`
				LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON oh.`id_order_state` = os.`id_order_state`
				LEFT JOIN `' . _DB_PREFIX_ . 'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = o.`id_lang`)
			WHERE oh.`id_order_history` = ' . (int) $this->id . ' AND os.`send_email` = 1');
        if (isset($result['template']) && Validate::isEmail($result['email'])) {
            ShopUrl::cacheMainDomainForShop($order->id_shop);
            $topic = $result['osname'];
            $data = array('{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int) $this->id_order, '{order_name}' => $order->getUniqReference());
            if ($template_vars) {
                $data = array_merge($data, $template_vars);
            }
            if ($result['module_name']) {
                $module = Module::getInstanceByName($result['module_name']);
                if (Validate::isLoadedObject($module) && isset($module->extra_mail_vars) && is_array($module->extra_mail_vars)) {
                    $data = array_merge($data, $module->extra_mail_vars);
                }
            }
            $data['{total_paid}'] = Tools::displayPrice((double) $order->total_paid, new Currency((int) $order->id_currency), false);
            $data['{order_name}'] = $order->getUniqReference();
            if (Validate::isLoadedObject($order)) {
                // Join PDF invoice if order state is "payment accepted"
                if ((int) $result['id_order_state'] === 2 && (int) Configuration::get('PS_INVOICE') && $order->invoice_number) {
                    $context = Context::getContext();
                    $pdf = new PDF($order->getInvoicesCollection(), PDF::TEMPLATE_INVOICE, $context->smarty);
                    $file_attachement['content'] = $pdf->render(false);
                    $file_attachement['name'] = Configuration::get('PS_INVOICE_PREFIX', (int) $order->id_lang, null, $order->id_shop) . sprintf('%06d', $order->invoice_number) . '.pdf';
                    $file_attachement['mime'] = 'application/pdf';
                } else {
                    $file_attachement = null;
                }
                Mail::Send((int) $order->id_lang, $result['template'], $topic, $data, $result['email'], $result['firstname'] . ' ' . $result['lastname'], null, null, $file_attachement, null, _PS_MAIL_DIR_, false, (int) $order->id_shop);
            }
            ShopUrl::resetMainDomainCache();
        }
        return true;
    }
开发者ID:dev-lav,项目名称:htdocs,代码行数:55,代码来源:OrderHistory.php

示例7: validateOrder


//.........这里部分代码省略.........
						</tr>';
                    }
                    // Specify order id for message
                    $old_message = Message::getMessageByCartId((int) $this->context->cart->id);
                    if ($old_message) {
                        $update_message = new Message((int) $old_message['id_message']);
                        $update_message->id_order = (int) $order->id;
                        $update_message->update();
                        // Add this message in the customer thread
                        $customer_thread = new CustomerThread();
                        $customer_thread->id_contact = 0;
                        $customer_thread->id_customer = (int) $order->id_customer;
                        $customer_thread->id_shop = (int) $this->context->shop->id;
                        $customer_thread->id_order = (int) $order->id;
                        $customer_thread->id_lang = (int) $this->context->language->id;
                        $customer_thread->email = $this->context->customer->email;
                        $customer_thread->status = 'open';
                        $customer_thread->token = Tools::passwdGen(12);
                        $customer_thread->add();
                        $customer_message = new CustomerMessage();
                        $customer_message->id_customer_thread = $customer_thread->id;
                        $customer_message->id_employee = 0;
                        $customer_message->message = $update_message->message;
                        $customer_message->private = 0;
                        if (!$customer_message->add()) {
                            $this->errors[] = Tools::displayError('An error occurred while saving message');
                        }
                    }
                    // Hook validate order
                    Hook::exec('actionValidateOrder', array('cart' => $this->context->cart, 'order' => $order, 'customer' => $this->context->customer, 'currency' => $this->context->currency, 'orderStatus' => $order_status));
                    foreach ($this->context->cart->getProducts() as $product) {
                        if ($order_status->logable) {
                            ProductSale::addProductSale((int) $product['id_product'], (int) $product['cart_quantity']);
                        }
                    }
                    if (Configuration::get('PS_STOCK_MANAGEMENT') && $order_detail->getStockState()) {
                        $history = new OrderHistory();
                        $history->id_order = (int) $order->id;
                        $history->changeIdOrderState(Configuration::get('PS_OS_OUTOFSTOCK'), $order, true);
                        $history->addWithemail();
                    }
                    // Set order state in order history ONLY even if the "out of stock" status has not been yet reached
                    // So you migth have two order states
                    $new_history = new OrderHistory();
                    $new_history->id_order = (int) $order->id;
                    $new_history->changeIdOrderState((int) $id_order_state, $order, true);
                    $new_history->addWithemail(true, $extra_vars);
                    unset($order_detail);
                    // Order is reloaded because the status just changed
                    $order = new Order($order->id);
                    // Send an e-mail to customer (one order = one email)
                    if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && $this->context->customer->id) {
                        $invoice = new Address($order->id_address_invoice);
                        $delivery = new Address($order->id_address_delivery);
                        $delivery_state = $delivery->id_state ? new State($delivery->id_state) : false;
                        $invoice_state = $invoice->id_state ? new State($invoice->id_state) : false;
                        $data = array('{firstname}' => $this->context->customer->firstname, '{lastname}' => $this->context->customer->lastname, '{email}' => $this->context->customer->email, '{delivery_block_txt}' => $this->_getFormatedAddress($delivery, "\n"), '{invoice_block_txt}' => $this->_getFormatedAddress($invoice, "\n"), '{delivery_block_html}' => $this->_getFormatedAddress($delivery, '<br />', array('firstname' => '<span style="font-weight:bold;">%s</span>', 'lastname' => '<span style="font-weight:bold;">%s</span>')), '{invoice_block_html}' => $this->_getFormatedAddress($invoice, '<br />', array('firstname' => '<span style="font-weight:bold;">%s</span>', 'lastname' => '<span style="font-weight:bold;">%s</span>')), '{delivery_company}' => $delivery->company, '{delivery_firstname}' => $delivery->firstname, '{delivery_lastname}' => $delivery->lastname, '{delivery_address1}' => $delivery->address1, '{delivery_address2}' => $delivery->address2, '{delivery_city}' => $delivery->city, '{delivery_postal_code}' => $delivery->postcode, '{delivery_country}' => $delivery->country, '{delivery_state}' => $delivery->id_state ? $delivery_state->name : '', '{delivery_phone}' => $delivery->phone ? $delivery->phone : $delivery->phone_mobile, '{delivery_other}' => $delivery->other, '{invoice_company}' => $invoice->company, '{invoice_vat_number}' => $invoice->vat_number, '{invoice_firstname}' => $invoice->firstname, '{invoice_lastname}' => $invoice->lastname, '{invoice_address2}' => $invoice->address2, '{invoice_address1}' => $invoice->address1, '{invoice_city}' => $invoice->city, '{invoice_postal_code}' => $invoice->postcode, '{invoice_country}' => $invoice->country, '{invoice_state}' => $invoice->id_state ? $invoice_state->name : '', '{invoice_phone}' => $invoice->phone ? $invoice->phone : $invoice->phone_mobile, '{invoice_other}' => $invoice->other, '{order_name}' => $order->getUniqReference(), '{date}' => Tools::displayDate(date('Y-m-d H:i:s'), (int) $order->id_lang, 1), '{carrier}' => $virtual_product ? Tools::displayError('No carrier') : $carrier->name, '{payment}' => Tools::substr($order->payment, 0, 32), '{products}' => $this->formatProductAndVoucherForEmail($products_list), '{discounts}' => $this->formatProductAndVoucherForEmail($cart_rules_list), '{total_paid}' => Tools::displayPrice($order->total_paid, $this->context->currency, false), '{total_products}' => Tools::displayPrice($order->total_paid - $order->total_shipping - $order->total_wrapping + $order->total_discounts, $this->context->currency, false), '{total_discounts}' => Tools::displayPrice($order->total_discounts, $this->context->currency, false), '{total_shipping}' => Tools::displayPrice($order->total_shipping, $this->context->currency, false), '{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $this->context->currency, false));
                        if (is_array($extra_vars)) {
                            $data = array_merge($data, $extra_vars);
                        }
                        // Join PDF invoice
                        if ((int) Configuration::get('PS_INVOICE') && $order_status->invoice && $order->invoice_number) {
                            $pdf = new PDF($order->getInvoicesCollection(), PDF::TEMPLATE_INVOICE, $this->context->smarty);
                            $file_attachement['content'] = $pdf->render(false);
                            $file_attachement['name'] = Configuration::get('PS_INVOICE_PREFIX', (int) $order->id_lang, null, $order->id_shop) . sprintf('%06d', $order->invoice_number) . '.pdf';
                            $file_attachement['mime'] = 'application/pdf';
                        } else {
                            $file_attachement = null;
                        }
                        if (Validate::isEmail($this->context->customer->email)) {
                            Mail::Send((int) $order->id_lang, 'order_conf', Mail::l('Order confirmation', (int) $order->id_lang), $data, $this->context->customer->email, $this->context->customer->firstname . ' ' . $this->context->customer->lastname, null, null, $file_attachement, null, _PS_MAIL_DIR_, false, (int) $order->id_shop);
                        }
                    }
                    // updates stock in shops
                    if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
                        $product_list = $order->getProducts();
                        foreach ($product_list as $product) {
                            // if the available quantities depends on the physical stock
                            if (StockAvailable::dependsOnStock($product['product_id'])) {
                                // synchronizes
                                StockAvailable::synchronize($product['product_id'], $order->id_shop);
                            }
                        }
                    }
                } else {
                    $error = Tools::displayError('Order creation failed');
                    Logger::addLog($error, 4, '0000002', 'Cart', intval($order->id_cart));
                    die($error);
                }
            }
            // End foreach $order_detail_list
            // Use the last order as currentOrder
            $this->currentOrder = (int) $order->id;
            return true;
        } else {
            $error = Tools::displayError('Cart cannot be loaded or an order has already been placed using this cart');
            Logger::addLog($error, 4, '0000001', 'Cart', intval($this->context->cart->id));
            die($error);
        }
    }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:101,代码来源:PaymentModule.php

示例8: generatePDF

 public function generatePDF($object, $template)
 {
     $pdf = new PDF($object, $template, Context::getContext()->smarty);
     $pdf->render();
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:5,代码来源:AdminPdfController.php

示例9: processGenerateSupplyOrderFormPDF

 public function processGenerateSupplyOrderFormPDF()
 {
     require_once _PS_MODULE_DIR_ . 'erpillicopresta/classes/pdf/HTMLTemplateErpSupplyOrderForm.php';
     // generate multiple supply order PDF
     if (Tools::isSubmit('print_pdf_bulk')) {
         $supply_order_collection = array();
         foreach (explode(',', Tools::getValue('supply_order_created')) as $id_supply_order) {
             if (is_array($supply_order = ErpSupplyOrderClasses::getSupplyOrderCollection((int) $id_supply_order))) {
                 $supply_order_collection = array_merge($supply_order, $supply_order_collection);
             }
         }
         if (!count($supply_order_collection)) {
             die($this->errors[] = Tools::displayError('No supply order was found.'));
         }
         //$this->generatePDF( $supply_order_collection , PDF::TEMPLATE_SUPPLY_ORDER_FORM);
         $pdf = new PDF($supply_order_collection, 'ErpSupplyOrderForm', Context::getContext()->smarty);
         $pdf->render();
     }
 }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:19,代码来源:AdminGenerateSupplyOrdersController.php

示例10: processGenerateSupplyOrderFormPDF

 public function processGenerateSupplyOrderFormPDF()
 {
     require_once _PS_MODULE_DIR_ . 'erpillicopresta/classes/pdf/HTMLTemplateErpSupplyOrderForm.php';
     // generate multiple supply order PDF
     if (!Tools::isSubmit('print_pdf_bulk')) {
         if (!Tools::isSubmit('id_supply_order')) {
             die($this->errors[] = Tools::displayError('The supply order ID is missing.'));
         }
         $id_supply_order = (int) Tools::getValue('id_supply_order');
         $supply_order = new SupplyOrder($id_supply_order);
         if (!Validate::isLoadedObject($supply_order)) {
             die($this->errors[] = Tools::displayError('The supply order cannot be found within your database.'));
         }
         //$this->generatePDF($supply_order, PDF::TEMPLATE_SUPPLY_ORDER_FORM);
         $pdf = new PDF(array($supply_order), 'ErpSupplyOrderForm', Context::getContext()->smarty);
         $pdf->render(true);
     }
 }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:18,代码来源:AdminAdvancedSupplyOrder.php

示例11: generatePDF

 public function generatePDF($object, $template, $orientation = 'P')
 {
     $pdf = new PDF($object, $template, Context::getContext()->smarty);
     $pdf->render(true, $orientation);
 }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:5,代码来源:ErpAdminPdfController.php

示例12: processGenerateTransferPDF

 public function processGenerateTransferPDF()
 {
     // if we have movments
     $ids_mvt = Tools::getValue('ids_mvt');
     if (!empty($ids_mvt)) {
         require_once _PS_MODULE_DIR_ . 'erpillicopresta/classes/pdf/HTMLTemplateTransfer.php';
         $movements = new ErpStockMvt();
         $pdf = new PDF(array($movements->getMovementsByIds($ids_mvt)), 'Transfer', Context::getContext()->smarty);
         $pdf->render(true);
     }
 }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:11,代码来源:AdminStockTransfer.php

示例13: hookActionOrderStatusPostUpdate

 public function hookActionOrderStatusPostUpdate($params)
 {
     $order = new Order((int) $params['id_order']);
     $order_status = $params['newOrderStatus'];
     if ((int) Configuration::get('MEDIAFINANZ_SEND_OS_MAILS') == 1 && (Configuration::get('PS_OS_MF_REMINDER') == $order_status->id || Configuration::get('PS_OS_MF_LASTREMINDER') == $order_status->id)) {
         if (Validate::isLoadedObject($order)) {
             $customer = new Customer((int) $order->id_customer);
             $iso = Language::getIsoById((int) $order->id_lang);
             $date_reminder = '';
             if (Configuration::get('PS_OS_MF_REMINDER') == $order_status->id) {
                 $template = 'mediafinanz_reminder';
                 $subject = $this->l('Payment reminder');
             } else {
                 $history_entities = $order->getHistory((int) $order->id_lang, Configuration::get('PS_OS_MF_REMINDER'));
                 if (count($history_entities)) {
                     $last_history_entity = end($history_entities);
                     $date_reminder = Tools::displayDate($last_history_entity['date_add'], null, false);
                 }
                 $template = 'mediafinanz_lastreminder';
                 $subject = $this->l('Last payment reminder');
             }
             $total_to_pay = Tools::displayPrice((double) $order->total_paid + (double) Configuration::get('MEDIAFINANZ_OVERDUEFEES', null, null, $order->id_shop), new Currency((int) $order->id_currency), false);
             $total_paid = Tools::displayPrice((double) $order->total_paid, new Currency((int) $order->id_currency), false);
             $total_overduefees = Tools::displayPrice((double) Configuration::get('MEDIAFINANZ_OVERDUEFEES', null, null, $order->id_shop), new Currency((int) $order->id_currency), false);
             $data = array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{order_name}' => $order->reference, '{id_order}' => $order->id, '{total_to_pay}' => $total_to_pay, '{total_paid}' => $total_paid, '{order_date}' => Tools::displayDate($order->date_add, null, false), '{reminder_date}' => $date_reminder, '{total_overduefees}' => $total_overduefees, '{payment_information}' => nl2br(str_replace(array('{total_to_pay}', '{total_paid}', '{total_overduefees}'), array($total_to_pay, $total_paid, $total_overduefees), Configuration::get('MEDIAFINANZ_REMINDER_INFO', null, null, $order->id_shop))));
             // Attach invoice if they exists and status is set to attach them
             $context = Context::getContext();
             $invoice = $order->getInvoicesCollection();
             $file_attachment = array();
             if ((int) Configuration::get('PS_INVOICE') && $order->invoice_number) {
                 $pdf = new PDF($invoice, PDF::TEMPLATE_INVOICE, $context->smarty);
                 $file_attachment['invoice']['content'] = $pdf->render(false);
                 $file_attachment['invoice']['name'] = Configuration::get('PS_INVOICE_PREFIX', (int) $order->id_lang, null, $order->id_shop) . sprintf('%06d', $order->invoice_number) . '.pdf';
                 $file_attachment['invoice']['mime'] = 'application/pdf';
             }
             if (file_exists(dirname(__FILE__) . '/mails/' . $iso . '/' . $template . '.html') && file_exists(dirname(__FILE__) . '/mails/' . $iso . '/' . $template . '.txt')) {
                 Mail::Send($order->id_lang, $template, $subject, $data, $customer->email, $customer->firstname . ' ' . $customer->lastname, null, null, $file_attachment, null, dirname(__FILE__) . '/mails/', true);
             }
         }
     }
 }
开发者ID:silbersaiten,项目名称:mediafinanz,代码行数:41,代码来源:mediafinanz.php

示例14: managePaymentRequestIfApplicable

 public function managePaymentRequestIfApplicable($order)
 {
     $context = Context::getContext();
     if ($order->hasInvoice() && count($order->getHistory($context->language->id, Configuration::get('PS_OS_DELIVERED'), true, 0)) > 0) {
         $paymentRequest = new InvipayPaymentRequest(InvipayPaymentRequest::getIdByOrderId($order->id));
         if (!$paymentRequest->completed) {
             $order_invoice_list = $order->getInvoicesCollection();
             $pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $context->smarty);
             $pdfData = $pdf->render(false);
             $invoiceNumbers = array();
             $issueDate = $order->date_add;
             foreach ($order_invoice_list as $invoice) {
                 $invoiceNumbers[] = $invoice->getInvoiceNumberFormatted($context->language->id, $context->shop !== null ? $context->shop->id : null);
                 $issueDate = $invoice->date_add;
             }
             $documentNumber = join(', ', $invoiceNumbers);
             $issueDate = strtotime($issueDate);
             $config = $this->loadConfiguration();
             $dueDateDays = (int) $config['BASE_DUE_DATE'];
             $dueDate = $issueDate + $dueDateDays * 60 * 60 * 24;
             $client = $this->getApiClient();
             $request = new PaymentManagementData();
             $request->setPaymentId($paymentRequest->payment_id);
             $request->setDoConfirmDelivery(true);
             $conversionData = new OrderToInvoiceData();
             $conversionData->setInvoiceDocumentNumber($documentNumber);
             $conversionData->setIssueDate(date('Y-m-d', $issueDate));
             $conversionData->setDueDate(date('Y-m-d', $dueDate));
             $request->setConversionData($conversionData);
             $document = new FileData();
             $document->setName($order->reference . '.pdf');
             $document->setMimeType('application/pdf');
             $document->setContentFromBin($pdfData);
             $request->setDocument($document);
             $client->managePayment($request);
             $paymentRequest->delivery_confirmed = true;
             $paymentRequest->completed = true;
             $paymentRequest->save();
         }
     }
 }
开发者ID:invipay,项目名称:invipay-prestashop,代码行数:41,代码来源:Helper.php

示例15: processGenerateInventoryPDF

 public function processGenerateInventoryPDF()
 {
     require_once _PS_MODULE_DIR_ . 'erpillicopresta/models/InventoryProduct.php';
     $id_warehouse = (int) Tools::getValue('id_warehouse');
     $id_category = (int) Tools::getValue('id_category');
     $id_supplier = (int) Tools::getValue('id_supplier');
     $id_manufacturer = (int) Tools::getValue('id_manufacturer');
     $area = Tools::getValue('area');
     $subarea = Tools::getValue('subarea');
     // get products
     $inventoryProduct = new InventoryProduct();
     $inventoryGrid = $inventoryProduct->getInventoryGrid($id_warehouse, $id_category, $id_supplier, $id_manufacturer, $area, $subarea);
     // Generate PDF --> Go HTMLTemplateInventory.php (landscape or portrait, depends of the template to display
     if (Tools::getValue('advanced') == 'true') {
         $orientation = 'L';
     } else {
         $orientation = 'P';
     }
     require_once _PS_MODULE_DIR_ . 'erpillicopresta/classes/pdf/HTMLTemplateInventory.php';
     if ($this->controller_status == STATUS1) {
         $inventoryGrid = array_splice($inventoryGrid, 0, ERP_IVTFR);
         $inventoryGrid[] = array('name' => sprintf($this->l('You are using the free version of 1-Click ERP which limits the display to %d products'), ERP_IVTFR), 'reference' => '', 'ean' => '', 'id_product' => '', 'id_warehouse' => '', 'id_product_attribute' => '', 'manufacturer_name' => '', 'zone' => '', 'sous_zone' => '', 'location' => '', 'quantity' => '', 'image' => '');
     }
     $pdf = new PDF(array($inventoryGrid), 'Inventory', Context::getContext()->smarty);
     $pdf->render(true, $orientation);
 }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:26,代码来源:AdminInventory.php


注:本文中的PDF::render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。