本文整理汇总了PHP中shopFunctions::getInvoiceFolderName方法的典型用法代码示例。如果您正苦于以下问题:PHP shopFunctions::getInvoiceFolderName方法的具体用法?PHP shopFunctions::getInvoiceFolderName怎么用?PHP shopFunctions::getInvoiceFolderName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shopFunctions
的用法示例。
在下文中一共展示了shopFunctions::getInvoiceFolderName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInvoicePDF
function getInvoicePDF($orderDetails = 0, $viewName = 'invoice', $layout = 'invoice', $format = 'html', $force = false)
{
// $force = true;
$path = VmConfig::get('forSale_path', 0);
if (empty($path)) {
vmError('No path set to store invoices');
return false;
} else {
$path .= shopFunctions::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 = VmModel::getModel('orders');
$invoiceNumberDate = array();
if (!$orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) {
return 0;
}
if (!empty($invoiceNumberDate[0])) {
$invoiceNumber = $invoiceNumberDate[0];
} else {
$invoiceNumber = FALSE;
}
if (!$invoiceNumber or empty($invoiceNumber)) {
vmError('Cant create pdf, createInvoiceNumber failed');
return 0;
}
if (shopFunctions::InvoiceNumberReserved($invoiceNumber)) {
return 0;
}
$path .= preg_replace('/[^A-Za-z0-9_\\-\\.]/', '_', 'vm' . $layout . '_' . $invoiceNumber . '.pdf');
if (file_exists($path) and !$force) {
return $path;
}
//We come from the be, so we need to load the FE langauge
VmConfig::loadJLang('com_virtuemart', true);
$this->addViewPath(JPATH_VM_SITE . DS . 'views');
$view = $this->getView($viewName, $format);
$this->writeJs = false;
$view->addTemplatePath(JPATH_VM_SITE . DS . 'views' . DS . $viewName . DS . 'tmpl');
$vmtemplate = VmConfig::get('vmtemplate', 0);
if (!empty($vmtemplate) and $vmtemplate == 'default') {
if (JVM_VERSION == 2) {
$q = 'SELECT `template` FROM `#__template_styles` WHERE `client_id`="0" AND `home`="1"';
} else {
$q = 'SELECT `template` FROM `#__templates_menu` WHERE `client_id`="0" AND `menuid`="0"';
}
$db = JFactory::getDbo();
$db->setQuery($q);
$templateName = $db->loadResult();
} else {
$templateName = shopFunctionsF::setTemplate($vmtemplate);
}
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 = VmModel::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' => JText::sprintf('COM_VIRTUEMART_INVOICE_TITLE', $vendor->vendor_store_name, $view->invoiceNumber, $orderDetails['details']['BT']->order_number), 'keywords' => JText::_('COM_VIRTUEMART_INVOICE_CREATOR'));
return VmPdf::createVmPdf($view, $path, 'F', $metadata);
}