本文整理匯總了PHP中shopFunctionsF::getInvoiceFolderName方法的典型用法代碼示例。如果您正苦於以下問題:PHP shopFunctionsF::getInvoiceFolderName方法的具體用法?PHP shopFunctionsF::getInvoiceFolderName怎麽用?PHP shopFunctionsF::getInvoiceFolderName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類shopFunctionsF
的用法示例。
在下文中一共展示了shopFunctionsF::getInvoiceFolderName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getInvoicePDF
function getInvoicePDF($orderDetails = 0, $viewName = 'invoice', $layout = 'invoice', $format = 'html', $force = false)
{
// $force = true;
$path = tsmConfig::get('forSale_path', 0);
if (empty($path)) {
vmError('No path set to store invoices');
return false;
} else {
$path .= shopFunctionsF::getInvoiceFolderName() . DS;
if (!file_exists($path)) {
vmError('Path wrong to store invoices, folder invoices does not exist ' . $path);
return false;
} else {
if (!is_writable($path)) {
vmError('Cannot store pdf, directory not writeable ' . $path);
return false;
}
}
}
$orderModel = tmsModel::getModel('orders');
$invoiceNumberDate = array();
if (!$orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) {
return false;
}
if (!empty($invoiceNumberDate[0])) {
$invoiceNumber = $invoiceNumberDate[0];
} else {
$invoiceNumber = FALSE;
}
if (!$invoiceNumber or empty($invoiceNumber)) {
vmError('Cant create pdf, createInvoiceNumber failed');
return 0;
}
if (shopFunctionsF::InvoiceNumberReserved($invoiceNumber)) {
return 0;
}
//$path .= preg_replace('/[^A-Za-z0-9_\-\.]/', '_', 'vm'.$layout.'_'.$invoiceNumber.'.pdf');
$path .= shopFunctionsF::getInvoiceName($invoiceNumber, $layout) . '.pdf';
if (file_exists($path) and !$force) {
return $path;
}
//We come from the be, so we need to load the FE language
tsmConfig::loadJLang('com_virtuemart', true);
$this->addViewPath(VMPATH_SITE . DS . 'views');
$view = $this->getView($viewName, $format);
$this->writeJs = false;
$view->addTemplatePath(VMPATH_SITE . DS . 'views' . DS . $viewName . DS . 'tmpl');
if (!class_exists('VmTemplate')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
}
$template = VmTemplate::loadVmTemplateStyle();
$templateName = VmTemplate::setTemplate($template);
if (!empty($templateName)) {
$TemplateOverrideFolder = JPATH_SITE . DS . "templates" . DS . $templateName . DS . "html" . DS . "com_virtuemart" . DS . "invoice";
if (file_exists($TemplateOverrideFolder)) {
$view->addTemplatePath($TemplateOverrideFolder);
}
}
$view->invoiceNumber = $invoiceNumberDate[0];
$view->invoiceDate = $invoiceNumberDate[1];
$view->orderDetails = $orderDetails;
$view->uselayout = $layout;
$view->showHeaderFooter = false;
$vendorModel = tmsModel::getModel('vendor');
$virtuemart_vendor_id = 1;
//We could set this automatically by the vendorId stored in the order.
$vendor = $vendorModel->getVendor($virtuemart_vendor_id);
$metadata = array('title' => tsmText::sprintf('COM_VIRTUEMART_INVOICE_TITLE', $vendor->vendor_store_name, $view->invoiceNumber, $orderDetails['details']['BT']->order_number), 'keywords' => tsmText::_('COM_VIRTUEMART_INVOICE_CREATOR'));
return VmPdf::createVmPdf($view, $path, 'F', $metadata);
}