/** * Example prepare redSHOP Product method * * Method is called by the product view * * @param object The Product Template Data * @param object The product params * @param object The product object */ public function afterUpdateStock($stockroom_data) { $redshopMail = new redshopMail(); if ($stockroom_data['regular_stock'] || $stockroom_data['preorder_stock']) { $userData = $this->getNotifyUsers($stockroom_data); if (count($userData) > 0) { for ($u = 0; $u < count($userData); $u++) { $productData = $this->getProductData($userData[$u]); $productDetail = $productData['product_detail']; $productName = $productData['product_name']; $notify_template = $redshopMail->getMailtemplate(0, "notify_stock_mail"); if (count($notify_template) > 0) { $message = $notify_template[0]->mail_body; $mail_subject = $notify_template[0]->mail_subject; } else { return; } $message = str_replace("{stocknotify_intro_text}", JText::_('COM_REDSHOP_STOCK_NOTIFY_INTRO_TEXT'), $message); $message = str_replace("{product_detail}", $productDetail, $message); $mail_subject = str_replace("{product_name}", $productName, $mail_subject); if ($userData[$u]->user_email) { JUtility::sendMail(SHOP_NAME, SHOP_NAME, $userData[$u]->user_email, $mail_subject, $message, 1); } $this->deleteNotifiedUsers($userData[$u]); } } } }
/** * update status function * * @access public * @return void */ public function updatestatus() { $post = JRequest::get('post'); $option = JRequest::getVar('option'); $Itemid = JRequest::getVar('Itemid'); $encr = JRequest::getVar('encr'); $quotationHelper = new quotationHelper(); $redshopMail = new redshopMail(); $quotationHelper->updateQuotationStatus($post['quotation_id'], $post['quotation_status']); $mailbool = $redshopMail->sendQuotationMail($post['quotation_id'], $post['quotation_status']); $msg = JText::_('COM_REDSHOP_QUOTATION_STATUS_UPDATED_SUCCESSFULLY'); $this->setRedirect('index.php?option=' . $option . '&view=quotation_detail&quoid=' . $post['quotation_id'] . '&encr=' . $encr . '&Itemid=' . $Itemid, $msg); }
/** * Method to send catalog * * @return void */ public function catalog_send() { $post = JRequest::get('post'); $Itemid = JRequest::getVar('Itemid'); $option = JRequest::getVar('option', '', 'request', 'string'); $model = $this->getModel('catalog'); $post["registerDate"] = time(); $post["email"] = $post["email_address"]; $post["name"] = $post["name_2"]; if ($row = $model->catalogStore($post)) { $redshopMail = new redshopMail(); $redshopMail->sendCatalogRequest($row); $msg = JText::_('COM_REDSHOP_CATALOG_SEND_SUCCSEEFULLY'); } else { $msg = JText::_('COM_REDSHOP_ERROR_CATALOG_SEND_SUCCSEEFULLY'); } $this->setRedirect('index.php?option=' . $option . '&view=catalog&Itemid=' . $Itemid, $msg); }
public function sendMailForReview($data) { $this->store($data); $producthelper = new producthelper(); $redshopMail = new redshopMail(); $user = JFactory::getUser(); $url = JURI::base(); $option = JRequest::getVar('option'); $Itemid = JRequest::getVar('Itemid'); $mailbcc = null; $fromname = $data['username']; $from = $user->email; $subject = ""; $message = $data['title']; $comment = $data['comment']; $username = $data['username']; $product_id = $data['product_id']; $mailbody = $redshopMail->getMailtemplate(0, "review_mail"); $data_add = $message; if (count($mailbody) > 0) { $data_add = $mailbody[0]->mail_body; $subject = $mailbody[0]->mail_subject; if (trim($mailbody[0]->mail_bcc) != "") { $mailbcc = explode(",", $mailbody[0]->mail_bcc); } } $product = $producthelper->getProductById($product_id); $link = JRoute::_($url . "index.php?option=" . $option . "&view=product&pid=" . $product_id . '&Itemid=' . $Itemid); $product_url = "<a href=" . $link . ">" . $product->product_name . "</a>"; $data_add = str_replace("{product_link}", $product_url, $data_add); $data_add = str_replace("{product_name}", $product->product_name, $data_add); $data_add = str_replace("{title}", $message, $data_add); $data_add = str_replace("{comment}", $comment, $data_add); $data_add = str_replace("{username}", $username, $data_add); if (ADMINISTRATOR_EMAIL != "") { $sendto = explode(",", ADMINISTRATOR_EMAIL); if (JFactory::getMailer()->sendMail($from, $fromname, $sendto, $subject, $data_add, $mode = 1, null, $mailbcc)) { return true; } else { return false; } } }
public function sendProductMailToFriend($your_name, $friend_name, $product_id, $email) { $producthelper = new producthelper(); $redshopMail = new redshopMail(); $url = JURI::base(); $option = JRequest::getVar('option'); $mailinfo = $redshopMail->getMailtemplate(0, "product"); $data_add = ""; $subject = ""; $mailbcc = null; if (count($mailinfo) > 0) { $data_add = $mailinfo[0]->mail_body; $subject = $mailinfo[0]->mail_subject; if (trim($mailinfo[0]->mail_bcc) != "") { $mailbcc = explode(",", $mailinfo[0]->mail_bcc); } } else { $data_add = "<p>Hi {friend_name} ,</p>\r\n<p>New Product : {product_name}</p>\r\n<p>{product_desc} Please check this link : {product_url}</p>\r\n<p> </p>\r\n<p> </p>"; $subject = "Send to friend"; } $data_add = str_replace("{friend_name}", $friend_name, $data_add); $data_add = str_replace("{your_name}", $your_name, $data_add); $product = $producthelper->getProductById($product_id); $data_add = str_replace("{product_name}", $product->product_name, $data_add); $data_add = str_replace("{product_desc}", $product->product_desc, $data_add); $rlink = JRoute::_($url . "index.php?option=" . $option . "&view=product&pid=" . $product_id); $product_url = "<a href=" . $rlink . ">" . $rlink . "</a>"; $data_add = str_replace("{product_url}", $product_url, $data_add); $config = JFactory::getConfig(); $from = $config->getValue('mailfrom'); $fromname = $config->getValue('fromname'); $subject = str_replace("{product_name}", $product->product_name, $subject); $subject = str_replace("{shopname}", SHOP_NAME, $subject); if ($email != "") { if (JFactory::getMailer()->sendMail($from, $fromname, $email, $subject, $data_add, 1, null, $mailbcc)) { echo "<div class='' align='center'>" . JText::_('COM_REDSHOP_EMAIL_HAS_BEEN_SENT_SUCCESSFULLY') . "</div>"; } else { echo "<div class='' align='center'>" . JText::_('COM_REDSHOP_EMAIL_HAS_NOT_BEEN_SENT_SUCCESSFULLY') . "</div>"; } } exit; }
/** * Metod to reset Password * * @return void */ public function reset() { $post = JRequest::get('post'); $model = $this->getModel('password'); $Itemid = JRequest::getVar('Itemid'); $layout = ""; // Request a reset if ($model->resetpassword($post)) { $redshopMail = new redshopMail(); if ($redshopMail->sendResetPasswordMail($post['email'])) { $layout = "&layout=token"; $msg = JText::_('COM_REDSHOP_RESET_PASSWORD_MAIL_SEND'); } else { $msg = JText::_('COM_REDSHOP_RESET_PASSWORD_MAIL_NOT_SEND'); } } else { $msg = JText::_('COM_REDSHOP_RESET_PASSWORD_MAIL_NOT_SEND'); } $this->setRedirect('index.php?option=com_redshop&view=password' . $layout . '&Itemid=' . $Itemid, $msg); }
public function sendMailForAskQuestion($data) { $this->store($data); $producthelper = new producthelper(); $redshopMail = new redshopMail(); $url = JURI::base(); $option = JRequest::getVar('option'); $Itemid = JRequest::getVar('Itemid'); $mailbcc = null; $fromname = $data['your_name']; $from = $data['your_email']; $subject = ""; $message = $data['your_question']; $product_id = $data['pid']; $mailbody = $redshopMail->getMailtemplate(0, "ask_question_mail"); $data_add = $message; if (count($mailbody) > 0) { $data_add = $mailbody[0]->mail_body; $subject = $mailbody[0]->mail_subject; if (trim($mailbody[0]->mail_bcc) != "") { $mailbcc = explode(",", $mailbody[0]->mail_bcc); } } $product = $producthelper->getProductById($product_id); $data_add = str_replace("{product_name}", $product->product_name, $data_add); $data_add = str_replace("{product_desc}", $product->product_desc, $data_add); // Init required properties $data['address'] = isset($data['address']) ? $data['address'] : null; $data['telephone'] = isset($data['telephone']) ? $data['telephone'] : null; $link = JRoute::_($url . "index.php?option=" . $option . "&view=product&pid=" . $product_id . '&Itemid=' . $Itemid); $product_url = "<a href=" . $link . ">" . $product->product_name . "</a>"; $data_add = str_replace("{product_link}", $product_url, $data_add); $data_add = str_replace("{user_question}", $message, $data_add); $data_add = str_replace("{answer}", "", $data_add); $subject = str_replace("{user_question}", $message, $subject); $subject = str_replace("{shopname}", SHOP_NAME, $subject); $data_add = str_replace("{user_address}", $data['address'], $data_add); $data_add = str_replace("{user_telephone}", $data['telephone'], $data_add); $data_add = str_replace("{user_telephone_lbl}", JText::_('COM_REDSHOP_USER_PHONE_LBL'), $data_add); $data_add = str_replace("{user_address_lbl}", JText::_('COM_REDSHOP_USER_ADDRESS_LBL'), $data_add); if (ADMINISTRATOR_EMAIL != "") { $sendto = explode(",", ADMINISTRATOR_EMAIL); if (JFactory::getMailer()->sendMail($from, $fromname, $sendto, $subject, $data_add, $mode = 1, null, $mailbcc)) { return true; } else { return false; } } }
public function sendMailForAskQuestion($ansid) { $redshopMail = new redshopMail(); $rs = $redshopMail->sendAskQuestionMail($ansid); return $rs; }
public function sendanswer() { $option = JRequest::getVar('option', '', 'request', 'string'); $cid = JRequest::getVar('aid', array(0), 'post', 'array'); $qid = JRequest::getVar('cid', array(0), 'post', 'array'); for ($i = 0; $i < count($cid); $i++) { $redshopMail = new redshopMail(); $redshopMail->sendAskQuestionMail($cid[$i]); } $msg = JText::_('COM_REDSHOP_ANSWER_MAIL_SENT'); $this->setRedirect('index.php?option=' . $option . '&view=question_detail&task=edit&cid[]=' . $qid[0], $msg); }
public function createInvoice() { if (ECONOMIC_INTEGRATION == 1 && ECONOMIC_INVOICE_DRAFT != 2) { $order_id = JRequest::getCmd('order_id'); $order_function = new order_functions(); $paymentInfo = $order_function->getOrderPaymentDetail($order_id); if (count($paymentInfo) > 0) { $payment_name = $paymentInfo[0]->payment_method_class; $paymentArr = explode("rs_payment_", $paymentInfo[0]->payment_method_class); if (count($paymentArr) > 0) { $payment_name = $paymentArr[1]; } $economicdata['economic_payment_method'] = $payment_name; $paymentmethod = $order_function->getPaymentMethodInfo($paymentInfo[0]->payment_method_class); if (count($paymentmethod) > 0) { $paymentparams = new JRegistry($paymentmethod[0]->params); $economicdata['economic_payment_terms_id'] = $paymentparams->get('economic_payment_terms_id'); $economicdata['economic_design_layout'] = $paymentparams->get('economic_design_layout'); $economicdata['economic_is_creditcard'] = $paymentparams->get('is_creditcard'); } } $economic = new economic(); $economicdata['split_payment'] = 0; $invoiceHandle = $economic->createInvoiceInEconomic($order_id, $economicdata); if (ECONOMIC_INVOICE_DRAFT == 0) { $bookinvoicepdf = $economic->bookInvoiceInEconomic($order_id, 1); if (is_file($bookinvoicepdf)) { $redshopMail = new redshopMail(); $ret = $redshopMail->sendEconomicBookInvoiceMail($order_id, $bookinvoicepdf); } } } $this->setRedirect('index.php?option=com_redshop&view=order'); }
/** * Subscription renewal mail function * * @return void */ public function subscription_renewal_mail() { $db = $db = JFactory::getDbo(); $redshopMail = new redshopMail(); $query = "SELECT ps.* FROM #__" . TABLE_PREFIX . "_product_subscribe_detail AS ps" . " ,#__" . TABLE_PREFIX . "_subscription_renewal AS r" . " WHERE r.product_id = ps.product_id AND r.before_no_days >= DATEDIFF(FROM_UNIXTIME( ps.end_date ),curdate())" . " AND ps.renewal_reminder = 1"; $db->setQuery($query); $data = $db->loadObjectList(); for ($i = 0; $i < count($data); $i++) { // Subscription renewal mail $redshopMail->sendSubscriptionRenewalMail($data[$i]); // Update mail sent field to 0 $update_query = "UPDATE #__" . TABLE_PREFIX . "_product_subscribe_detail " . "SET renewal_reminder = 0 " . "WHERE product_subscribe_id=" . (int) $data[$i]->product_subscribe_id; $db->setQuery($update_query); $db->Query(); } }
public function send_invoicemail() { $redshopMail = new redshopMail(); $option = JRequest::getVar('option', '', 'request', 'string'); $cid = JRequest::getVar('cid', array(0), 'get', 'array'); $tmpl = JRequest::getVar('tmpl', '', 'request', 'string'); if ($redshopMail->sendInvoiceMail($cid[0])) { $msg = JText::_('COM_REDSHOP_INVOICE_MAIL_HAS_BEEN_SENT'); } else { $msg = JText::_('COM_REDSHOP_ERROR_INVOICE_MAIL_FAIL'); } if ($tmpl) { $this->setRedirect('index.php?option=' . $option . '&view=order_detail&cid[]=' . $cid[0] . '&tmpl=' . $tmpl, $msg); } else { $this->setRedirect('index.php?option=' . $option . '&view=order_detail&cid[]=' . $cid[0], $msg); } }
public function newsletterUnsubscribe($email = "") { $db = JFactory::getDbo(); $user = JFactory::getUser(); $and = ""; if (DEFAULT_NEWSLETTER != "") { $and .= "AND newsletter_id='" . DEFAULT_NEWSLETTER . "' "; } if ($user->id) { $and .= "AND `user_id` = " . (int) $user->id . " "; $email = $user->email; } if ($and != "") { $query = "DELETE FROM " . $this->_table_prefix . "newsletter_subscription " . "WHERE email = " . $db->quote($email) . " " . $and; $this->_db->setQuery($query); $this->_db->query(); $redshopMail = new redshopMail(); $redshopMail->sendNewsletterCancellationMail($email); } return true; }
public function sendWishlist($post) { $user = JFactory::getUser(); $redshopMail = new redshopMail(); $redhelper = new redhelper(); $wishlist_id = JRequest::getInt('wishlist_id'); $emailto = $post['emailto']; $sender = $post['sender']; $email = $post['email']; $subject = $post['subject']; $Itemid = $post['Itemid']; $producthelper = new producthelper(); // Get data from database if not than fetch from session if ($user->id && $wishlist_id) { $query = "SELECT DISTINCT w.* ,p.* FROM " . $this->_table_prefix . "wishlist AS w " . "LEFT JOIN " . $this->_table_prefix . "wishlist_product AS pw ON w.wishlist_id=pw.wishlist_id " . "LEFT JOIN " . $this->_table_prefix . "product AS p ON p.product_id = pw.product_id " . "WHERE w.user_id = " . (int) $user->id . " " . "AND w.wishlist_id = " . (int) $wishlist_id . " "; } else { // Add this code to send wishlist while user is not loged in ... $prod_id = ""; for ($add_i = 1; $add_i < $_SESSION["no_of_prod"]; $add_i++) { $prod_id .= (int) $_SESSION['wish_' . $add_i]->product_id . ","; } $prod_id .= (int) $_SESSION['wish_' . $add_i]->product_id; $query = "SELECT DISTINCT p.* FROM " . $this->_table_prefix . "product AS p " . "WHERE p.product_id IN (" . $prod_id . ")"; } $MyWishlist = $this->_getList($query); $i = 0; $data = ""; $mailbcc = null; $wishlist_body = $redshopMail->getMailtemplate(0, "mywishlist_mail"); if (count($wishlist_body) > 0) { $wishlist_body = $wishlist_body[0]; $data = $wishlist_body->mail_body; $subject = $wishlist_body->mail_subject; if (trim($wishlist_body->mail_bcc) != "") { $mailbcc = explode(",", $wishlist_body->mail_bcc); } } if ($data) { $template_d1 = explode("{product_loop_start}", $data); $template_d2 = explode("{product_loop_end}", $template_d1[1]); $wishlist_desc = $template_d2[0]; if (strstr($data, '{product_thumb_image_2}')) { $tag = '{product_thumb_image_2}'; $h_thumb = THUMB_HEIGHT_2; $w_thumb = THUMB_WIDTH_2; } elseif (strstr($data, '{product_thumb_image_3}')) { $tag = '{product_thumb_image_3}'; $h_thumb = THUMB_HEIGHT_3; $w_thumb = THUMB_WIDTH_3; } elseif (strstr($data, '{product_thumb_image_1}')) { $tag = '{product_thumb_image_1}'; $h_thumb = THUMB_HEIGHT; $w_thumb = THUMB_WIDTH; } else { $tag = '{product_thumb_image}'; $h_thumb = THUMB_HEIGHT; $w_thumb = THUMB_WIDTH; } $temp_template = ''; if (count($MyWishlist)) { foreach ($MyWishlist as $row) { $Itemid = $redhelper->getItemid($row->product_id); $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&Itemid=' . (int) $Itemid, true, -1); $thum_image = $producthelper->getProductImage($row->product_id, $link, $w_thumb, $h_thumb); $pname = $row->product_name; $pname = $pname; $wishlist_data = str_replace($tag, $thum_image, $wishlist_desc); $wishlist_data = str_replace('{product_name}', $pname, $wishlist_data); // Attribute ajax change if (!$row->not_for_sale) { $wishlist_data = $producthelper->GetProductShowPrice($row->product_id, $wishlist_data); } else { $wishlist_data = str_replace("{product_price}", "", $wishlist_data); $wishlist_data = str_replace("{price_excluding_vat}", "", $wishlist_data); $wishlist_data = str_replace("{product_price_table}", "", $wishlist_data); $wishlist_data = str_replace("{product_old_price}", "", $wishlist_data); $wishlist_data = str_replace("{product_price_saving}", "", $wishlist_data); } $temp_template .= $wishlist_data; } } $data = $template_d1[0] . $temp_template . $template_d2[1]; $name = @explode('@', $emailto); $data = str_replace('{from}', $sender, $data); $data = str_replace('{name}', $name[0], $data); $data = str_replace('{from_name}', $sender, $data); $data_add = $data; } else { if (count($MyWishlist)) { $link = JURI::root() . "index.php?tmpl=component&option=com_redshop&view=account&layout=mywishlist&mail=1"; foreach ($MyWishlist as $row) { $data_add .= '<div class="redProductWishlist">'; $thum_image = ""; $pname = $row->product_name; $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&Itemid=' . $Itemid); $thum_image = $producthelper->getProductImage($row->product_id, $link, THUMB_WIDTH, THUMB_HEIGHT); $data_add .= $thum_image; $pname = "<div><a href='" . $link . "' >" . $pname . "</a></div>"; $data_add .= $pname; $formatted_price = $producthelper->GetProductShowPrice($row->product_id, $wishlist_data); // For attribute price count $price_add = '<span id="pr_price">' . $formatted_price . '</span>'; $i++; $data_add .= '</div>'; } } } if (JFactory::getMailer()->sendMail($email, $sender, $emailto, $subject, $data_add, true, null, $mailbcc)) { return true; } else { return false; } }
public function storeUser_bk($post) { $app = JFactory::getApplication(); $redshopMail = new redshopMail(); // Start data into user table // Initialize some variables $db = JFactory::getDbo(); $me = JFactory::getUser(); $acl = JFactory::getACL(); // Create a new JUser object $user = new JUser($post['id']); $original_gid = $user->get('gid'); $post['name'] = isset($post['name']) ? $post['name'] : $post['username']; // Changed for shipping code moved out of condition if (!$user->bind($post)) { $app->enqueueMessage(JText::_('COM_REDSHOP_CANNOT_SAVE_THE_USER_INFORMATION'), 'message'); $app->enqueueMessage($user->getError(), 'error'); return false; } $objectID = $acl->get_object_id('users', $user->get('id'), 'ARO'); $groups = $acl->get_object_groups($objectID, 'ARO'); $this_group = strtolower($acl->get_group_name($groups[0], 'ARO')); if ($user->get('id') == $me->get('id') && $user->get('block') == 1) { $msg = JText::_('COM_REDSHOP_YOU_CANNOT_BLOCK_YOURSELF'); $app->enqueueMessage($msg, 'message'); return false; } elseif ($this_group == 'super administrator' && $user->get('block') == 1) { $msg = JText::_('COM_REDSHOP_YOU_CANNOT_BLOCK_A_SUPER_ADMINISTRATOR'); $app->enqueueMessage($msg, 'message'); return false; } elseif ($this_group == 'administrator' && $me->get('gid') == 24 && $user->get('block') == 1) { $msg = JText::_('COM_REDSHOP_WARNBLOCK'); $app->enqueueMessage($msg, 'message'); return false; } elseif ($this_group == 'super administrator' && $me->get('gid') != 25) { $msg = JText::_('COM_REDSHOP_YOU_CANNOT_EDIT_A_SUPER_ADMINISTRATOR_ACCOUNT'); $app->enqueueMessage($msg, 'message'); return false; } // Are we dealing with a new user which we need to create? $isNew = $user->get('id') < 1; if (!$isNew) { // If group has been changed and where original group was a Super Admin if ($user->get('gid') != $original_gid && $original_gid == 25) { // Count number of active super admins $query = 'SELECT COUNT( id )' . ' FROM #__users' . ' WHERE gid = 25' . ' AND block = 0'; $db->setQuery($query); $count = $db->loadResult(); if ($count <= 1) { // Disallow change if only one Super Admin exists $this->setRedirect('index.php?option=' . $option . '&view=user', JText::_('COM_REDSHOP_WARN_ONLY_SUPER')); return false; } } } /* * Lets save the JUser object */ if (!$user->save()) { $app->enqueueMessage(JText::_('COM_REDSHOP_CANNOT_SAVE_THE_USER_INFORMATION'), 'message'); $app->enqueueMessage($user->getError(), 'error'); return false; } /* * Time for the email magic so get ready to sprinkle the magic dust... */ if ($isNew) { $redshopMail->sendRegistrationMail($post); } // If updating self, load the new user object into the session if ($user->get('id') == $me->get('id')) { // Get an ACL object $acl = JFactory::getACL(); // Get the user group from the ACL $grp = $acl->getAroGroup($user->get('id')); // Mark the user as logged in $user->set('guest', 0); $user->set('aid', 1); // Fudge Authors, Editors, Publishers and Super Administrators into the special access group if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) { $user->set('aid', 2); } // Set the usertype based on the ACL group name $user->set('usertype', $grp->name); $session = JFactory::getSession(); $session->set('user', $user); } // End data into user table return $user; }
public function sendRegistrationMail($post) { $redshopMail = new redshopMail(); $redshopMail->sendRegistrationMail($post); }
public function special_discount($data, $chk = false) { $redshopMail = new redshopMail(); $orderdata = $this->getTable('order_detail'); $orderdata->load($this->_id); $order_functions = new order_functions(); $OrderItems = $order_functions->getOrderItemDetail($this->_id); if (!$orderdata->special_discount) { $orderdata->special_discount = 0; } if (!$orderdata->special_discount_amount) { $orderdata->special_discount_amount = 0; } if ($data['special_discount'] == $orderdata->special_discount && $chk != true) { return false; } $special_discount = $data['special_discount']; $subtotal = 0; $subtotal_excl_vat = 0; for ($i = 0; $i < count($OrderItems); $i++) { if ($order_item_id != $OrderItems[$i]->order_item_id) { $subtotal_excl_vat = $subtotal_excl_vat + $OrderItems[$i]->product_item_price_excl_vat * $OrderItems[$i]->product_quantity; $subtotal = $subtotal + $OrderItems[$i]->product_item_price * $OrderItems[$i]->product_quantity; } } $discount_price = $subtotal * $special_discount / 100; $orderdata->special_discount = $special_discount; $orderdata->special_discount_amount = $discount_price; $order_total = $subtotal + $orderdata->order_shipping - $discount_price - $orderdata->order_discount; $orderdata->order_total = $order_total; $orderdata->mdate = time(); if (!$orderdata->store()) { return false; } if (ECONOMIC_INTEGRATION == 1) { $economic = new economic(); $invoiceHandle = $economic->renewInvoiceInEconomic($orderdata); } // Send mail from template $redshopMail->sendOrderSpecialDiscountMail($this->_id); return true; }
public function sendQuotationMail($quotaion_id) { $redshopMail = new redshopMail(); $send = $redshopMail->sendQuotationMail($quotaion_id); return $send; }
public function createShippedInvoicePdf($order_id) { $redconfig = new Redconfiguration(); $producthelper = new producthelper(); $extra_field = new extra_field(); $config = JFactory::getConfig(); $redTemplate = new Redtemplate(); $carthelper = new rsCarthelper(); $redshopMail = new redshopMail(); $message = ""; $subject = ""; $cart = ''; $arr_discount_type = array(); $mailinfo = $redTemplate->getTemplate("shippment_invoice_template"); if (count($mailinfo) > 0) { $message = $mailinfo[0]->template_desc; } else { return false; } $row = $this->getOrderDetails($order_id); $barcode_code = $row->barcode; $arr_discount = explode('@', $row->discount_type); $discount_type = ''; for ($d = 0; $d < count($arr_discount); $d++) { if ($arr_discount[$d]) { $arr_discount_type = explode(':', $arr_discount[$d]); if ($arr_discount_type[0] == 'c') { $discount_type .= JText::_('COM_REDSHOP_COUPON_CODE') . ' : ' . $arr_discount_type[1] . '<br>'; } if ($arr_discount_type[0] == 'v') { $discount_type .= JText::_('COM_REDSHOP_VOUCHER_CODE') . ' : ' . $arr_discount_type[1] . '<br>'; } } } if (!$discount_type) { $discount_type = JText::_('COM_REDSHOP_NO_DISCOUNT_AVAILABLE'); } $search[] = "{discount_type}"; $replace[] = $discount_type; $message = str_replace($search, $replace, $message); $message = $redshopMail->imginmail($message); $user = JFactory::getUser(); $billingaddresses = $this->getOrderBillingUserInfo($order_id); $email = $billingaddresses->user_email; $userfullname = $billingaddresses->firstname . " " . $billingaddresses->lastname; $message = $carthelper->replaceOrderTemplate($row, $message); echo "<div id='redshopcomponent' class='redshop'>"; if (strstr($message, "{barcode}")) { $img_url = REDSHOP_FRONT_IMAGES_RELPATH . "barcode/" . $barcode_code . ".png"; if (function_exists("curl_init")) { $bar_codeIMG = '<img src="' . $img_url . '" alt="Barcode" border="0" />'; $message = str_replace("{barcode}", $bar_codeIMG, $message); } } $body = $message; return $body; }