/** * Send the Recommend to a friend email. * * @author Kohl Patrick, */ public function mailRecommend () { JRequest::checkToken () or jexit ('Invalid Token'); // Display it all $view = $this->getView ('recommend', 'html'); if(!VmConfig::get('show_emailfriend',false)){ $view->display (); } if (!class_exists ('shopFunctionsF')) { require(JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'); } if(!class_exists('ShopFunctions')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'shopfunctions.php'); $mainframe = JFactory::getApplication (); $vars = array(); $virtuemart_product_idArray = JRequest::getInt ('virtuemart_product_id', 0); if (is_array ($virtuemart_product_idArray)) { $virtuemart_product_id = (int)$virtuemart_product_idArray[0]; } else { $virtuemart_product_id = (int)$virtuemart_product_idArray; } $productModel = VmModel::getModel ('product'); $vars['product'] = $productModel->getProduct ($virtuemart_product_id); $user = JFactory::getUser (); $vars['user'] = array('name' => $user->name, 'email' => $user->email); $vars['vendorEmail'] = $user->email; $vendorModel = VmModel::getModel ('vendor'); $vendor = $vendorModel->getVendor ($vars['product']->virtuemart_vendor_id); $vendorModel->addImages ($vars['vendor']); $vendor->vendorFields = $vendorModel->getVendorAddressFields(); $vars['vendor'] = $vendor; $vars['vendorAddress']= shopFunctions::renderVendorAddress($vars['product']->virtuemart_vendor_id); $vars['vendorEmail']= $user->email; $vars['vendor']->vendor_name =$user->name; $toMail = JRequest::getVar ('email'); //is sanitized then $toMail = str_replace (array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $toMail); if (shopFunctionsF::renderMail ('recommend', $toMail, $vars, 'productdetails', TRUE)) { $string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY'; } else { $string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY'; } $mainframe->enqueueMessage (JText::_ ($string)); // vmdebug('my email vars ',$vars,$TOMail); $view->setLayout ('mail_confirmed'); $view->display (); }
/** * Notify customers product is back in stock * * @author RolandD * @author Christopher Rouseel * @todo Add Itemid * @todo Do something if the mail cannot be send * @todo Update mail from * @todo Get the from name/email from the vendor */ public function notifyList($virtuemart_product_id, $subject = '', $mailbody = '', $max_number = 0) { if (!$virtuemart_product_id) { return FALSE; } //sanitize id $virtuemart_product_id = (int) $virtuemart_product_id; $max_number = (int) $max_number; if (!class_exists('shopFunctionsF')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } $vars = array(); $waitinglistModel = VmModel::getModel('waitinglist'); $waiting_users = $waitinglistModel->getWaitingusers($virtuemart_product_id); /* Load the product details */ $db = JFactory::getDbo(); $q = "SELECT l.product_name,product_in_stock FROM `#__virtuemart_products_" . VMLANG . "` l\r\n\t\t\t\tJOIN `#__virtuemart_products` p ON p.virtuemart_product_id=l.virtuemart_product_id\r\n\t\t\t WHERE p.virtuemart_product_id = " . $virtuemart_product_id; $db->setQuery($q); $item = $db->loadObject(); $vars['productName'] = $item->product_name; /* if ($item->product_in_stock <= 0) { return FALSE; } */ $url = JURI::root() . 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $virtuemart_product_id; $vars['link'] = '<a href="' . $url . '">' . $item->product_name . '</a>'; if (empty($subject)) { $subject = JText::sprintf('COM_VIRTUEMART_PRODUCT_WAITING_LIST_EMAIL_SUBJECT', $item->product_name); } $vars['subject'] = $subject; $vars['mailbody'] = $mailbody; $virtuemart_vendor_id = 1; $vendorModel = VmModel::getModel('vendor'); $vendor = $vendorModel->getVendor($virtuemart_vendor_id); $vendorModel->addImages($vendor); $vars['vendor'] = $vendor; $vars['vendorAddress'] = shopFunctions::renderVendorAddress($virtuemart_vendor_id); $vendorEmail = $vendorModel->getVendorEmail($virtuemart_vendor_id); $vars['vendorEmail'] = $vendorEmail; $i = 0; foreach ($waiting_users as $waiting_user) { $vars['user'] = $waiting_user->name; if (shopFunctionsF::renderMail('productdetails', $waiting_user->notify_email, $vars, 'productdetails')) { $db->setQuery('UPDATE #__virtuemart_waitingusers SET notified=1 WHERE virtuemart_waitinguser_id=' . $waiting_user->virtuemart_waitinguser_id); $db->query(); $i++; } if (!empty($max_number) && $i >= $max_number) { break; } } return TRUE; }
?> <div class="vendor-image"> <?php echo $this->vendor->images[0]->displayMediaThumb('', false); ?> </div> <?php } ?> </h1> <?php if (!class_exists('ShopFunctions')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php'; } echo shopFunctions::renderVendorAddress($this->vendor->virtuemart_vendor_id); /* foreach($this->userFields as $userfields){ foreach($userfields['fields'] as $item){ if(!empty($item['value'])){ if($item['name']==='agreed'){ $item['value'] = ($item['value']===0) ? vmText::_('COM_VIRTUEMART_USER_FORM_BILLTO_TOS_NO'):vmText::_('COM_VIRTUEMART_USER_FORM_BILLTO_TOS_YES'); } ?><!-- span class="titles"><?php echo $item['title'] ?></span --> <span class="values vm2<?php echo '-'.$item['name'] ?>" ><?php echo $this->escape($item['value']) ?></span> <?php if ($item['name'] != 'title' and $item['name'] != 'first_name' and $item['name'] != 'middle_name' and $item['name'] != 'zip') { ?> <br class="clear" /> <?php } } }
function sentProductEmailToShoppers() { jimport('joomla.utilities.arrayhelper'); if (!class_exists('ShopFunctions')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php'; } $product_id = JRequest::getVar('virtuemart_product_id', ''); vmdebug('sentProductEmailToShoppers product id', $product_id); $vars = array(); $vars['subject'] = JRequest::getVar('subject'); $vars['mailbody'] = JRequest::getVar('mailbody'); $order_states = JRequest::getVar('statut', array(), '', 'ARRAY'); $productShoppers = $this->getProductShoppersByStatus($product_id, $order_states); vmdebug('productShoppers ', $productShoppers); $productModel = VmModel::getModel('product'); $product = $productModel->getProduct($product_id); $vendorModel = VmModel::getModel('vendor'); $vendor = $vendorModel->getVendor($product->virtuemart_vendor_id); $vendorModel->addImages($vendor); $vars['vendor'] = $vendor; $vars['vendorEmail'] = $vendorModel->getVendorEmail($product->virtuemart_vendor_id); $vars['vendorAddress'] = shopFunctions::renderVendorAddress($product->virtuemart_vendor_id); $orderModel = VmModel::getModel('orders'); foreach ($productShoppers as $productShopper) { $vars['user'] = $productShopper['name']; if (shopFunctionsF::renderMail('productdetails', $productShopper['email'], $vars, 'productdetails', TRUE)) { $string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY'; } else { $string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY'; } /* Update the order history for each order */ foreach ($productShopper['order_info'] as $order_info) { $orderModel->_updateOrderHist($order_info['order_id'], $order_info['order_status'], 1, $vars['subject'] . ' ' . $vars['mailbody']); } // todo: when there is an error while sending emails //vmInfo (JText::sprintf ($string, $productShopper['email'])); } }
static function replaceVendorFields($txt, $vendor) { // TODO: Implement more Placeholders (ordernr, invoicenr, etc.); // REMEMBER TO CHANGE VmVendorPDF::replace_variables IN vmpdf.php, TOO!!! // Page nrs. for mails is always "1" $txt = str_replace('{vm:pagenum}', "1", $txt); $txt = str_replace('{vm:pagecount}', "1", $txt); $txt = str_replace('{vm:vendorname}', $vendor->vendor_store_name, $txt); $imgrepl = ''; if (!empty($vendor->images)) { $img = $vendor->images[0]; $imgrepl = "<div class=\"vendor-image\">" . $img->displayIt($img->file_url, '', '', false, '', false, false) . "</div>"; } $txt = str_replace('{vm:vendorimage}', $imgrepl, $txt); $vendorAddress = shopFunctions::renderVendorAddress($vendor->virtuemart_vendor_id, "<br/>"); // Trim the final <br/> from the address, which is inserted by renderVendorAddress automatically! if (substr($vendorAddress, -5, 5) == '<br/>') { $vendorAddress = substr($vendorAddress, 0, -5); } $txt = str_replace('{vm:vendoraddress}', $vendorAddress, $txt); $txt = str_replace('{vm:vendorlegalinfo}', $vendor->vendor_legal_info, $txt); $txt = str_replace('{vm:vendordescription}', $vendor->vendor_store_desc, $txt); $txt = str_replace('{vm:tos}', $vendor->vendor_terms_of_service, $txt); return "{$txt}"; }
public function __construct() { // Load the vendor, so we have the data for the header/footer... // The images are NOT loaded by default, so do it manually, just in case $vendorModel = VmModel::getModel('vendor'); $this->vendor = $vendorModel->getVendor($this->virtuemart_vendor_id); $vendorModel->addImages($this->vendor, 1); $this->vendor->vendorFields = $vendorModel->getVendorAddressFields(); parent::__construct($this->vendor->vendor_letter_orientation, 'mm', $this->vendor->vendor_letter_format); $this->css = $this->vendor->vendor_letter_css; // set document information $this->SetCreator(JText::_('COM_VIRTUEMART_PDF_CREATOR')); if (empty($this->vendor->images[0])) { vmError('Vendor image given path empty '); } else { if (empty($this->vendor->images[0]->file_url_folder) or empty($this->vendor->images[0]->file_name) or empty($this->vendor->images[0]->file_extension)) { vmError('Vendor image given image is not complete ' . $this->vendor->images[0]->file_url_folder . $this->vendor->images[0]->file_name . '.' . $this->vendor->images[0]->file_extension); vmdebug('Vendor image given image is not complete, the given media', $this->vendor->images[0]); } else { if (!empty($this->vendor->images[0]->file_extension) and strtolower($this->vendor->images[0]->file_extension) == 'png') { vmError('Warning extension of the image is a png, tpcdf has problems with that in the header, choose a jpg or gif'); } else { $imagePath = str_replace('/', DS, $this->vendor->images[0]->file_url_folder . $this->vendor->images[0]->file_name . '.' . $this->vendor->images[0]->file_extension); if (!file_exists(JPATH_ROOT . DS . $imagePath)) { vmError('Vendor image missing ' . $imagePath); } else { $this->vendorImage = $imagePath; } } } } $this->setHeaderData($this->vendor->vendor_letter_header_image ? $this->vendorImage : '', $this->vendor->vendor_letter_header_image ? $this->vendor->vendor_letter_header_imagesize : 0, '', $this->vendor->vendor_letter_header_html, array(0, 0, 0), $this->convertHTMLColorToDec($this->vendor->vendor_letter_footer_line_color)); $this->vendorAddress = shopFunctions::renderVendorAddress($this->vendor->virtuemart_vendor_id, "<br/>"); // Trim the final <br/> from the address, which is inserted by renderVendorAddress automatically! if (substr($this->vendorAddress, -5, 5) == '<br/>') { $this->vendorAddress = substr($this->vendorAddress, 0, -5); } $vmFont = $this->vendor->vendor_letter_font; $this->SetFont($vmFont, '', $this->vendor->vendor_letter_font_size, '', 'false'); $this->setHeaderFont(array($vmFont, '', $this->vendor->vendor_letter_header_font_size)); $this->setFooterFont(array($vmFont, '', $this->vendor->vendor_letter_footer_font_size)); // Remove all vertical margins and padding from the HTML cells (default is excessive padding): $this->SetCellPadding(0); $tagvs = array('p' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'div' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'h1' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'h2' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'h3' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'table' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0))); $this->setHtmlVSpace($tagvs); // set default font subsetting mode $this->setFontSubsetting(true); // set default monospaced font // $this->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $this->SetMargins($this->vendor->vendor_letter_margin_left, $this->vendor->vendor_letter_margin_top, $this->vendor->vendor_letter_margin_right); $this->SetHeaderMargin($this->vendor->vendor_letter_margin_header); $this->SetFooterMargin($this->vendor->vendor_letter_margin_footer); $this->SetAutoPageBreak(TRUE, $this->vendor->vendor_letter_margin_bottom); //set image scale factor $this->setImageScale(PDF_IMAGE_SCALE_RATIO); //TODO include the right file (in libraries/tcpdf/config/lang set some language-dependent strings $l = ''; $this->setLanguageArray($l); }
public function display($tpl = null) { $document = JFactory::getDocument(); if (empty($this->uselayout)) { $layout = JRequest::getWord('layout', 'mail'); } else { $layout = $this->uselayout; } if ($layout == 'mail') { if (VmConfig::get('order_mail_html')) { $layout = 'mail_html'; } else { $layout = 'mail_raw'; } } $this->setLayout($layout); $tmpl = JRequest::getWord('tmpl'); $print = false; if ($tmpl) { $print = true; } $this->assignRef('print', $print); $this->format = JRequest::getWord('format', 'html'); if ($layout == 'invoice') { $document->setTitle(JText::_('COM_VIRTUEMART_INVOICE')); } $order_print = false; if ($print and $this->format == 'html') { $order_print = true; } $orderModel = VmModel::getModel('orders'); $orderDetails = $this->orderDetails; if ($orderDetails == 0) { // If the user is not logged in, we will check the order number and order pass if ($orderPass = JRequest::getString('order_pass', false) and $orderNumber = JRequest::getString('order_number', false)) { $orderId = $orderModel->getOrderIdByOrderPass($orderNumber, $orderPass); if (empty($orderId)) { echo 'Invalid order_number/password ' . JText::_('COM_VIRTUEMART_RESTRICTED_ACCESS'); return 0; } $orderDetails = $orderModel->getOrder($orderId); } if ($orderDetails == 0) { $_currentUser = JFactory::getUser(); $cuid = $_currentUser->get('id'); // If the user is logged in, we will check if the order belongs to him $virtuemart_order_id = JRequest::getInt('virtuemart_order_id', 0); if (!$virtuemart_order_id) { $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber(JRequest::getString('order_number')); } $orderDetails = $orderModel->getOrder($virtuemart_order_id); if (!class_exists('Permissions')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php'; } if (!Permissions::getInstance()->check("admin")) { if (!empty($orderDetails['details']['BT']->virtuemart_user_id)) { if ($orderDetails['details']['BT']->virtuemart_user_id != $cuid) { echo 'view ' . JText::_('COM_VIRTUEMART_RESTRICTED_ACCESS'); return; } } } } } if (empty($orderDetails['details'])) { echo JText::_('COM_VIRTUEMART_ORDER_NOTFOUND'); return 0; } $this->assignRef('orderDetails', $orderDetails); // if it is order print, invoice number should not be created, either it is there, either it has not been created if (empty($this->invoiceNumber) and !$order_print) { $invoiceNumberDate = array(); if ($orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) { if (ShopFunctions::InvoiceNumberReserved($invoiceNumberDate[0])) { if ($this->uselayout != 'mail') { $document->setTitle(JText::_('COM_VIRTUEMART_PAYMENT_INVOICE')); return; } } $this->invoiceNumber = $invoiceNumberDate[0]; $this->invoiceDate = $invoiceNumberDate[1]; if (!$this->invoiceNumber or empty($this->invoiceNumber)) { vmError('Cant create pdf, createInvoiceNumber failed'); if ($this->uselayout != 'mail') { return; } } } else { // Could OR should not create Invoice Number, createInvoiceNumber failed if ($this->uselayout != 'mail') { return; } } } $company = empty($orderDetails['details']['BT']->company) ? "" : $orderDetails['details']['BT']->company . ", "; $shopperName = $company . $orderDetails['details']['BT']->title . ' ' . $orderDetails['details']['BT']->first_name . ' ' . $orderDetails['details']['BT']->last_name; $this->assignRef('shopperName', $shopperName); //Todo multix $vendorId = 1; $emailCurrencyId = 0; $exchangeRate = FALSE; if (!class_exists('vmPSPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'; } JPluginHelper::importPlugin('vmpayment'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('plgVmgetEmailCurrency', array($orderDetails['details']['BT']->virtuemart_paymentmethod_id, $orderDetails['details']['BT']->virtuemart_order_id, &$emailCurrencyId)); if (!class_exists('CurrencyDisplay')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php'; } $currency = CurrencyDisplay::getInstance($emailCurrencyId, $vendorId); if ($emailCurrencyId) { $currency->exchangeRateShopper = $orderDetails['details']['BT']->user_currency_rate; } $this->assignRef('currency', $currency); //Create BT address fields $userFieldsModel = VmModel::getModel('userfields'); $_userFields = $userFieldsModel->getUserFields('account', array('captcha' => true, 'delimiters' => true), array('delimiter_userinfo', 'user_is_vendor', 'username', 'password', 'password2', 'agreed', 'address_type')); $userfields = $userFieldsModel->getUserFieldsFilled($_userFields, $orderDetails['details']['BT']); $this->assignRef('userfields', $userfields); //Create ST address fields $orderst = array_key_exists('ST', $orderDetails['details']) ? $orderDetails['details']['ST'] : $orderDetails['details']['BT']; $shipmentFieldset = $userFieldsModel->getUserFields('shipment', array(), array('delimiter_userinfo', 'username', 'email', 'password', 'password2', 'agreed', 'address_type')); $shipmentfields = $userFieldsModel->getUserFieldsFilled($shipmentFieldset, $orderst); $this->assignRef('shipmentfields', $shipmentfields); // Create an array to allow orderlinestatuses to be translated // We'll probably want to put this somewhere in ShopFunctions.. $orderStatusModel = VmModel::getModel('orderstatus'); $_orderstatuses = $orderStatusModel->getOrderStatusList(); $orderstatuses = array(); foreach ($_orderstatuses as $_ordstat) { $orderstatuses[$_ordstat->order_status_code] = JText::_($_ordstat->order_status_name); } $this->assignRef('orderstatuslist', $orderstatuses); $this->assignRef('orderstatuses', $orderstatuses); $_itemStatusUpdateFields = array(); $_itemAttributesUpdateFields = array(); foreach ($orderDetails['items'] as $_item) { // $_itemStatusUpdateFields[$_item->virtuemart_order_item_id] = JHTML::_('select.genericlist', $orderstatuses, "item_id[".$_item->virtuemart_order_item_id."][order_status]", 'class="selectItemStatusCode"', 'order_status_code', 'order_status_name', $_item->order_status, 'order_item_status'.$_item->virtuemart_order_item_id,true); $_itemStatusUpdateFields[$_item->virtuemart_order_item_id] = $_item->order_status; } if (empty($orderDetails['shipmentName'])) { if (!class_exists('vmPSPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'; } JPluginHelper::importPlugin('vmshipment'); $dispatcher = JDispatcher::getInstance(); $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEShipment', array($orderDetails['details']['BT']->virtuemart_order_id, $orderDetails['details']['BT']->virtuemart_shipmentmethod_id, &$orderDetails['shipmentName'])); } if (empty($orderDetails['paymentName'])) { if (!class_exists('vmPSPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'; } JPluginHelper::importPlugin('vmpayment'); $dispatcher = JDispatcher::getInstance(); $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEPayment', array($orderDetails['details']['BT']->virtuemart_order_id, $orderDetails['details']['BT']->virtuemart_paymentmethod_id, &$orderDetails['paymentName'])); } $virtuemart_vendor_id = 1; $vendorModel = VmModel::getModel('vendor'); $vendor = $vendorModel->getVendor($virtuemart_vendor_id); $vendorModel->addImages($vendor); $vendor->vendorFields = $vendorModel->getVendorAddressFields(); $this->assignRef('vendor', $vendor); // vmdebug('vendor', $vendor); $task = JRequest::getWord('task', 0); if ($task == 'checkStoreInvoice') { $headFooter = false; } else { $headFooter = true; } if (strpos($layout, 'mail') !== false) { $lineSeparator = "<br />"; } else { $lineSeparator = "\n"; } $this->assignRef('headFooter', $headFooter); //Attention, this function will be removed, it wont be deleted, but it is obsoloete in any view.html.php if (!class_exists('ShopFunctions')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php'; } $vendorAddress = shopFunctions::renderVendorAddress($virtuemart_vendor_id, $lineSeparator); $this->assignRef('vendorAddress', $vendorAddress); $vendorEmail = $vendorModel->getVendorEmail($virtuemart_vendor_id); $vars['vendorEmail'] = $vendorEmail; // this is no setting in BE to change the layout ! //shopFunctionsF::setVmTemplate($this,0,0,$layoutName); //vmdebug('renderMailLayout invoice '.date('H:i:s'),$this->order); if (strpos($layout, 'mail') !== false) { if ($this->doVendor) { //Old text key COM_VIRTUEMART_MAIL_SUBJ_VENDOR_C $this->subject = JText::sprintf('COM_VIRTUEMART_MAIL_SUBJ_VENDOR_' . $orderDetails['details']['BT']->order_status, $this->shopperName, strip_tags($currency->priceDisplay($orderDetails['details']['BT']->order_total)), $orderDetails['details']['BT']->order_number); $recipient = 'vendor'; } else { $this->subject = JText::sprintf('COM_VIRTUEMART_MAIL_SUBJ_SHOPPER_' . $orderDetails['details']['BT']->order_status, $vendor->vendor_store_name, strip_tags($currency->priceDisplay($orderDetails['details']['BT']->order_total)), $orderDetails['details']['BT']->order_number); $recipient = 'shopper'; } $this->assignRef('recipient', $recipient); } $tpl = null; // vmdebug('my view data',$this->getLayout(),$layout); // ob_start(); // echo '<pre>'; // echo debug_print_backtrace(); // echo '</pre>'; // $dumptrace = ob_get_contents(); // ob_end_clean(); // return false; parent::display($tpl); }
function renderMailLayout($doVendor, $recipient) { $this->comment = nl2br(JRequest::getString('comment')); $this->name = vRequest::getString('name'); if (VmConfig::get('order_mail_html')) { $tpl = 'mail_html'; } else { $tpl = 'mail_raw'; } $this->setLayout($tpl); // Load the product $productModel = VmModel::getModel('product'); $virtuemart_product_id = vRequest::getInt('virtuemart_product_id', 0); $this->product = $productModel->getProduct($virtuemart_product_id); $productModel->addImages($this->product); $layout = $this->getLayout(); //if($layout != 'form' and $layout != 'mail_confirmed'){ $user = JFactory::getUser(); $vars['user'] = array('name' => $user->name, 'email' => $user->email); $vars['vendorEmail'] = $user->email; $vendorModel = VmModel::getModel('vendor'); $this->vendor = $vendorModel->getVendor($this->product->virtuemart_vendor_id); $vendorModel->addImages($this->vendor); $this->vendor->vendorFields = $vendorModel->getVendorAddressFields(); $vars['vendorAddress'] = shopFunctions::renderVendorAddress($this->product->virtuemart_vendor_id, ' - '); $this->vendor->vendor_name = $user->name; foreach ($vars as $key => $val) { $this->{$key} = $val; } $this->subject = JText::sprintf('COM_VIRTUEMART_RECOMMEND_PRODUCT', $this->name, $this->product->product_name); parent::display(); }
function sendRatingEmailToVendor($data) { if (!class_exists('ShopFunctions')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php'; } $vars = array(); $productModel = VmModel::getModel('product'); $product = $productModel->getProduct($data['virtuemart_product_id']); $vars['subject'] = JText::sprintf('COM_VIRTUEMART_RATING_EMAIL_SUBJECT', $product->product_name); $vars['mailbody'] = JText::sprintf('COM_VIRTUEMART_RATING_EMAIL_BODY', $product->product_name); $vendorModel = VmModel::getModel('vendor'); $vendor = $vendorModel->getVendor($product->virtuemart_vendor_id); $vendorModel->addImages($vendor); $vars['vendor'] = $vendor; $vars['vendorEmail'] = $vendorModel->getVendorEmail($product->virtuemart_vendor_id); if (!class_exists('shopFunctions')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctions.php'; } $vars['vendorAddress'] = shopFunctions::renderVendorAddress($product->virtuemart_vendor_id); //$orderModel = VmModel::getModel ('orders'); shopFunctionsF::renderMail('productdetails', $vars['vendorEmail'], $vars, 'productdetails', TRUE); }