public function writeXMLExportFile($xmlexport_id = 0) { $config = new Redconfiguration(); $shipping = new shipping(); $uri = JURI::getInstance(); $url = $uri->root(); $xmlarray = array(); $xmlexportdata = $this->getXMLExportInfo($xmlexport_id); if (count($xmlexportdata) <= 0) { return false; } $destpath = JPATH_SITE . "/components/com_redshop/assets/xmlfile/export/"; $section = $xmlexportdata->section_type; $columns = $this->getSectionColumnList($section, "orderdetail"); for ($i = 0; $i < count($columns); $i++) { $tag = $this->getXMLFileTag($columns[$i]->Field, $xmlexportdata->xmlexport_filetag); if ($tag[0] != "") { $xmlarray[$columns[$i]->Field] = $tag[0]; } } $datalist = array(); $billinglist = array(); $shippinglist = array(); $orderItemlist = array(); $stocklist = array(); $prdextrafieldlist = array(); $xmlbilling = array(); $xmlshipping = array(); $xmlOrderitem = array(); $xmlstock = array(); $xmlprdextrafield = array(); $prdfullimage = ""; $prdthmbimage = ""; switch ($section) { case "product": if (array_key_exists("product_full_image", $xmlarray)) { $prdfullimage = $xmlarray['product_full_image']; } if (array_key_exists("product_thumb_image", $xmlarray)) { $prdthmbimage = $xmlarray['product_thumb_image']; } $datalist = $this->getProductList($xmlarray, $xmlexportdata); $columns = $this->getSectionColumnList($section, "stockdetail"); for ($i = 0; $i < count($columns); $i++) { $tag = $this->getXMLFileTag($columns[$i]->Field, $xmlexportdata->xmlexport_stocktag); if ($tag[0] != "") { $xmlstock[$columns[$i]->Field] = $tag[0]; } } $columns = $this->getSectionColumnList($section, "prdextrafield"); for ($i = 0; $i < count($columns); $i++) { $tag = $this->getXMLFileTag($columns[$i]->Field, $xmlexportdata->xmlexport_prdextrafieldtag); if ($tag[0] != "") { $xmlprdextrafield[$columns[$i]->Field] = $tag[0]; } } break; case "order": $datalist = $this->getOrderList($xmlarray); $columns = $this->getSectionColumnList($section, "billingdetail"); for ($i = 0; $i < count($columns); $i++) { $tag = $this->getXMLFileTag($columns[$i]->Field, $xmlexportdata->xmlexport_billingtag); if ($tag[0] != "") { $xmlbilling[$columns[$i]->Field] = $tag[0]; } } $columns = $this->getSectionColumnList($section, "shippingdetail"); for ($i = 0; $i < count($columns); $i++) { $tag = $this->getXMLFileTag($columns[$i]->Field, $xmlexportdata->xmlexport_shippingtag); if ($tag[0] != "") { $xmlshipping[$columns[$i]->Field] = $tag[0]; } } $columns = $this->getSectionColumnList($section, "orderitem"); for ($i = 0; $i < count($columns); $i++) { $tag = $this->getXMLFileTag($columns[$i]->Field, $xmlexportdata->xmlexport_orderitemtag); if ($tag[0] != "") { $xmlOrderitem[$columns[$i]->Field] = $tag[0]; } } break; default: return false; } if ($xmlexportdata->filename != "") { if (is_file($destpath . $xmlexportdata->filename)) { // unlink($destpath.$xmlexportdata->filename); } } $filetmpname = str_replace(" ", "_", strtolower($xmlexportdata->display_filename)); $filename = JPath::clean(time() . '_' . $filetmpname . '.xml'); //Make the filename unique $xml_document = "<?xml version='1.0' encoding='utf-8'?>"; if (trim($xmlexportdata->element_name) == "") { $xmlexportdata->element_name = $xmlexportdata->parent_name . "_element"; } $xml_document .= "<" . $xmlexportdata->parent_name . ">"; for ($i = 0; $i < count($datalist); $i++) { $product_id = 0; if ($section == "product") { $product_id = $datalist[$i]['product_id']; } $xml_billingdocument = ""; $xml_shippingdocument = ""; $xml_itemdocument = ""; $xml_stockdocument = ""; $xml_prdextradocument = ""; if (count($xmlbilling) > 0) { $billinglist = $this->getOrderUserInfoList($xmlbilling, $datalist[$i]->order_id); if (count($billinglist) > 0) { $xml_billingdocument .= "<{$xmlexportdata->billing_element_name}>"; while (list($prop, $val) = each($billinglist)) { $val = html_entity_decode($val); $xml_billingdocument .= "<{$prop}><![CDATA[{$val}]]></{$prop}>"; } $xml_billingdocument .= "</{$xmlexportdata->billing_element_name}>"; } } if (count($xmlshipping) > 0) { $shippinglist = $this->getOrderUserInfoList($xmlshipping, $datalist[$i]->order_id, "ST"); if (count($shippinglist) > 0) { $xml_shippingdocument .= "<{$xmlexportdata->shipping_element_name}>"; while (list($prop, $val) = each($shippinglist)) { $val = html_entity_decode($val); $xml_shippingdocument .= "<{$prop}><![CDATA[{$val}]]></{$prop}>"; } $xml_shippingdocument .= "</{$xmlexportdata->shipping_element_name}>"; } } if (count($xmlOrderitem) > 0) { $orderItemlist = $this->getOrderItemList($xmlOrderitem, $datalist[$i]->order_id); if (count($orderItemlist) > 0) { $xml_itemdocument .= "<" . $xmlexportdata->orderitem_element_name . "s>"; for ($j = 0; $j < count($orderItemlist); $j++) { $xml_itemdocument .= "<{$xmlexportdata->orderitem_element_name}>"; while (list($prop, $val) = each($orderItemlist[$j])) { $val = html_entity_decode($val); $xml_itemdocument .= "<{$prop}><![CDATA[{$val}]]></{$prop}>"; } $xml_itemdocument .= "</{$xmlexportdata->orderitem_element_name}>"; } $xml_itemdocument .= "</" . $xmlexportdata->orderitem_element_name . "s>"; } } if (count($xmlstock) > 0) { $stocklist = $this->getStockroomList($xmlstock, $product_id); if (count($stocklist) > 0) { $xml_stockdocument .= "<" . $xmlexportdata->stock_element_name . "s>"; for ($j = 0; $j < count($stocklist); $j++) { $xml_stockdocument .= "<{$xmlexportdata->stock_element_name}>"; while (list($prop, $val) = each($stocklist[$j])) { $val = html_entity_decode($val); $xml_stockdocument .= "<{$prop}><![CDATA[{$val}]]></{$prop}>"; } $xml_stockdocument .= "</{$xmlexportdata->stock_element_name}>"; } $xml_stockdocument .= "</" . $xmlexportdata->stock_element_name . "s>"; } } if (count($xmlprdextrafield) > 0) { $prdextrafieldlist = $this->getExtraFieldList($xmlprdextrafield, $product_id, 1); if (count($prdextrafieldlist) > 0) { $xml_prdextradocument .= "<" . $xmlexportdata->prdextrafield_element_name . "s>"; for ($j = 0; $j < count($prdextrafieldlist); $j++) { $xml_prdextradocument .= "<{$xmlexportdata->prdextrafield_element_name}>"; while (list($prop, $val) = each($prdextrafieldlist[$j])) { $val = html_entity_decode($val); $xml_prdextradocument .= "<{$prop}><![CDATA[{$val}]]></{$prop}>"; } $xml_prdextradocument .= "</{$xmlexportdata->prdextrafield_element_name}>"; } $xml_prdextradocument .= "</" . $xmlexportdata->prdextrafield_element_name . "s>"; } } if ($section == "order" && $xml_itemdocument == "") { } else { $xml_document .= "<{$xmlexportdata->element_name}>"; while (list($prop, $val) = each($datalist[$i])) { $val = html_entity_decode($val); if ($prop == $prdfullimage && $val != "") { $val = REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . $val; } if ($prop == $prdthmbimage && $val != "") { $val = REDSHOP_FRONT_IMAGES_ABSPATH . "product/thumb/" . $val; } if (isset($xmlarray['cdate']) && $prop == $xmlarray['cdate'] || isset($xmlarray['mdate']) && $prop == $xmlarray['mdate']) { $val = $config->convertDateFormat($val); } if ($prop != "order_id" && $prop != "product_id") { // Start Code for display product url,delivertime,pickup,charges,freight if ($prop == "manufacturer") { $val = "noname"; } if ($prop == "link") { $val = JURI::root() . 'index.php?option=com_redshop&view=product&pid=' . $product_id; } elseif ($prop == "pickup") { $val = ""; } elseif ($prop == "charge") { $d['product_id'] = $product_id; $srate = $shipping->getDefaultShipping_xmlexport($d); $val1 = $srate['shipping_rate']; $val = round($val1); } elseif ($prop == "freight") { $d['product_id'] = $product_id; $srate = $shipping->getDefaultShipping_xmlexport($d); $val1 = $srate['shipping_rate']; $val = round($val1); } elseif ($prop == "delivertime") { $query = "SELECT * FROM " . $this->_table_prefix . "stockroom AS s " . "LEFT JOIN " . $this->_table_prefix . "product_stockroom_xref AS sx ON s.stockroom_id=sx.stockroom_id " . "WHERE product_id=" . (int) $product_id . " " . "ORDER BY s.stockroom_id ASC "; $this->_db->setQuery($query); $list = $this->_db->loadObject(); for ($k = 0; $k < count($list); $k++) { if ($list->max_del_time == 1 && $list->max_del_time < 2) { $val = "1"; } elseif ($list->max_del_time == 2 && $list->max_del_time <= 3) { $val = "2"; } elseif ($list->max_del_time == 4) { $val = "4"; } elseif ($list->max_del_time == 5) { $val = "5"; } elseif ($list->max_del_time >= 6 && $list->max_del_time <= 10) { $val = "6,7,8,9,10"; } elseif ($list->max_del_time == "") { $val = ""; } } } if ($prop == "link") { $xml_document .= "<{$prop}><![CDATA[{$val}]]></{$prop}>"; } else { $xml_document .= "<{$prop}>{$val}</{$prop}>"; } } } $xml_document .= $xml_billingdocument; $xml_document .= $xml_shippingdocument; $xml_document .= $xml_itemdocument; $xml_document .= $xml_stockdocument; $xml_document .= $xml_prdextradocument; $xml_document .= "</" . $xmlexportdata->element_name . ">"; } } $xml_document .= "</" . $xmlexportdata->parent_name . ">"; /* Data in Variables ready to be written to an XML file */ $fp = fopen($destpath . $filename, 'w'); $write = fwrite($fp, $xml_document); $this->insertXMLExportlog($xmlexport_id, $filename); // Update new generated exported file in database record $this->updateXMLExportFilename($xmlexport_id, $filename); return $filename; }
$qend = ""; $question_start = explode("{question_loop_start}", $template_desc); if (count($question_start) > 0) { $qstart = $question_start[0]; $question_end = explode("{question_loop_end}", $question_start[1]); if (count($question_end) > 1) { $qmiddle = $question_end[0]; $qend = $question_end[1]; } } $product_question = $producthelper->getQuestionAnswer(0, $this->data->product_id, 0, 1); $questionloop = ""; if ($qmiddle != "") { for ($q = 0; $q < count($product_question); $q++) { $qloop = str_replace("{question}", $product_question[$q]->question, $qmiddle); $qloop = str_replace("{question_date}", $config->convertDateFormat($product_question[$q]->question_date), $qloop); $qloop = str_replace("{question_owner}", $product_question[$q]->user_name, $qloop); $astart = $qloop; $amiddle = ""; $aend = ""; $answer_start = explode("{answer_loop_start}", $qloop); if (count($answer_start) > 0) { $astart = $answer_start[0]; $answer_end = explode("{answer_loop_end}", $answer_start[1]); if (count($answer_end) > 0) { $amiddle = $answer_end[0]; $aend = $answer_end[1]; } } $product_answer = $producthelper->getQuestionAnswer($product_question[$q]->question_id, 0, 1, 1); $answerloop = "";
$print = JRequest::getInt('print'); $p_url = @explode('?', $_SERVER['REQUEST_URI']); $print_tag = ''; if ($print) { $print_tag = "<a onclick='window.print();' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' ><img src=" . JSYSTEM_IMAGES_PATH . "printButton.png alt='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' /></a>"; } else { $print_url = $url . "index.php?tmpl=component&option=com_redshop&view=quotation_detail&quoid=" . $quoid . "&print=1"; $print_tag = "<a href='#' onclick='window.open(\"{$print_url}\",\"mywindow\",\"scrollbars=1\",\"location=1\")' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' ><img src=" . JSYSTEM_IMAGES_PATH . "printButton.png alt='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' /></a>"; } $quotation_template = str_replace("{print}", $print_tag, $quotation_template); $search[] = "{quotation_id}"; $replace[] = $quoid; $search[] = "{quotation_number}"; $replace[] = $quotationDetail->quotation_number; $search[] = "{quotation_date}"; $replace[] = $redconfig->convertDateFormat($quotationDetail->quotation_cdate); $statustext = $quotationHelper->getQuotationStatusName($quotationDetail->quotation_status); if ($quotationDetail->quotation_status == '2') { $frm = "<form method='post'>\n\t<input type='radio' name='quotation_status' checked value='3'>" . JText::_('COM_REDSHOP_ACCEPT') . "\n\t<input type='radio' name='quotation_status' value='4'>" . JText::_('COM_REDSHOP_REJECT') . "\n\t<input type='hidden' name='quotation_id' value='{$quoid}'>\n\t<input type='hidden' name='option' value='com_redshop'>\n\t<input type='hidden' name='Itemid' value='{$Itemid}'>\n\t<input type='hidden' name='encr' value='{$encr}'>\n\t<input type='hidden' name='view' value='quotation_detail'>\n\t<input type='hidden' name='task' value='updatestatus'>\n\t<input type='submit' name='submit' value='" . JText::_("COM_REDSHOP_SUBMIT") . "' onclick='return confirm(\"" . JText::_('COM_REDSHOP_CONFIRM_SEND_QUOTATION') . "\")' />\n\t</form>"; } elseif ($quotationDetail->quotation_status == '3') { $frm = "<form method='post'>\n\t<input type='hidden' name='quotation_id' value='{$quoid}'>\n\t<input type='hidden' name='option' value='com_redshop'>\n\t<input type='hidden' name='Itemid' value='{$Itemid}'>\n\t<input type='hidden' name='encr' value='{$encr}'>\n\t<input type='hidden' name='task' value='checkout'>\n\t<input type='hidden' name='view' value='quotation_detail'>\n\t<input type='submit' name='submit' value='" . JText::_("COM_REDSHOP_CHECKOUT") . "' />\n\t</form>"; } elseif ($quotationDetail->quotation_status == '5') { $frm = " (" . JText::_('COM_REDSHOP_ORDER_ID') . "-" . $quotationDetail->order_id . " )"; } else { $frm = ''; } $search[] = "{quotation_status}"; $replace[] = $statustext . $frm; $search[] = "{quotation_note_lbl}"; $replace[] = JText::_('COM_REDSHOP_QUOTATION_NOTE'); $search[] = "{quotation_note}";
public function replaceOrderTemplate($row, $ReceiptTemplate) { $url = JURI::base(); $redconfig = new Redconfiguration(); $order_id = $row->order_id; $session = JFactory::getSession(); $orderitem = $this->_order_functions->getOrderItemDetail($order_id); if (strstr($ReceiptTemplate, "{product_loop_start}") && strstr($ReceiptTemplate, "{product_loop_end}")) { $template_sdata = explode('{product_loop_start}', $ReceiptTemplate); $template_start = $template_sdata[0]; $template_edata = explode('{product_loop_end}', $template_sdata[1]); $template_end = $template_edata[1]; $template_middle = $template_edata[0]; $cartArr = $this->repalceOrderItems($template_middle, $orderitem); $ReceiptTemplate = $template_start . $cartArr[0] . $template_end; } $orderdetailurl = JURI::root() . 'index.php?option=com_redshop&view=order_detail&oid=' . $order_id . '&encr=' . $row->encr_key; $downloadProducts = $this->_order_functions->getDownloadProduct($order_id); $paymentmethod = $this->_order_functions->getOrderPaymentDetail($order_id); $paymentmethod = $paymentmethod[0]; $paymentmethod_detail = $this->_order_functions->getPaymentMethodInfo($paymentmethod->payment_method_class); $paymentmethod_detail = $paymentmethod_detail[0]; $OrderStatus = $this->_order_functions->getOrderStatusTitle($row->order_status); $product_name = ""; $product_price = ""; $subtotal_excl_vat = $cartArr[1]; $barcode_code = $row->barcode; $img_url = REDSHOP_FRONT_IMAGES_ABSPATH . "barcode/" . $barcode_code . ".png"; $bar_replace = '<img alt="" src="' . $img_url . '">'; $total_excl_vat = $subtotal_excl_vat + ($row->order_shipping - $row->order_shipping_tax) - ($row->order_discount - $row->order_discount_vat); $sub_total_vat = $row->order_tax + $row->order_shipping_tax; if (isset($row->voucher_discount) === false) { $row->voucher_discount = 0; } $Total_discount = $row->coupon_discount + $row->order_discount + $row->special_discount + $row->tax_after_discount + $row->voucher_discount; // For Payment and Shipping Extra Fields if (strstr($ReceiptTemplate, '{payment_extrafields}')) { $PaymentExtrafields = $this->_producthelper->getPaymentandShippingExtrafields($row, 18); if ($PaymentExtrafields == "") { $ReceiptTemplate = str_replace("{payment_extrafields_lbl}", "", $ReceiptTemplate); $ReceiptTemplate = str_replace("{payment_extrafields}", "", $ReceiptTemplate); } else { $ReceiptTemplate = str_replace("{payment_extrafields_lbl}", JText::_("COM_REDSHOP_ORDER_PAYMENT_EXTRA_FILEDS"), $ReceiptTemplate); $ReceiptTemplate = str_replace("{payment_extrafields}", $PaymentExtrafields, $ReceiptTemplate); } } if (strstr($ReceiptTemplate, '{shipping_extrafields}')) { $ShippingExtrafields = $this->_producthelper->getPaymentandShippingExtrafields($row, 19); if ($ShippingExtrafields == "") { $ReceiptTemplate = str_replace("{shipping_extrafields_lbl}", "", $ReceiptTemplate); $ReceiptTemplate = str_replace("{shipping_extrafields}", "", $ReceiptTemplate); } else { $ReceiptTemplate = str_replace("{shipping_extrafields_lbl}", JText::_("COM_REDSHOP_ORDER_SHIPPING_EXTRA_FILEDS"), $ReceiptTemplate); $ReceiptTemplate = str_replace("{shipping_extrafields}", $ShippingExtrafields, $ReceiptTemplate); } } // End $ReceiptTemplate = $this->replaceShippingMethod($row, $ReceiptTemplate); if (!APPLY_VAT_ON_DISCOUNT) { $total_for_discount = $subtotal_excl_vat; } else { $total_for_discount = $row->order_subtotal; } $ReceiptTemplate = $this->replaceLabel($ReceiptTemplate); $search[] = "{order_subtotal}"; $chktag = $this->_producthelper->getApplyVatOrNot($ReceiptTemplate); if (!empty($chktag)) { $replace[] = $this->_producthelper->getProductFormattedPrice($row->order_total); } else { $replace[] = $this->_producthelper->getProductFormattedPrice($total_excl_vat); } $search[] = "{subtotal_excl_vat}"; $replace[] = $this->_producthelper->getProductFormattedPrice($total_excl_vat); $search[] = "{product_subtotal}"; if (!empty($chktag)) { $replace[] = $this->_producthelper->getProductFormattedPrice($row->order_subtotal); } else { $replace[] = $this->_producthelper->getProductFormattedPrice($subtotal_excl_vat); } $search[] = "{product_subtotal_excl_vat}"; $replace[] = $this->_producthelper->getProductFormattedPrice($subtotal_excl_vat); $search[] = "{order_subtotal_excl_vat}"; $replace[] = $this->_producthelper->getProductFormattedPrice($total_excl_vat); $search[] = "{order_number_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_NUMBER_LBL'); $search[] = "{order_number}"; $replace[] = $row->order_number; $search[] = "{special_discount}"; $replace[] = $row->special_discount . '%'; $search[] = "{special_discount_amount}"; $replace[] = $this->_producthelper->getProductFormattedPrice($row->special_discount_amount); $search[] = "{order_detail_link}"; $replace[] = "<a href='" . $orderdetailurl . "'>" . JText::_("COM_REDSHOP_ORDER_MAIL") . "</a>"; $dpData = ""; if (count($downloadProducts) > 0) { $dpData .= "<table>"; for ($d = 0; $d < count($downloadProducts); $d++) { $g = $d + 1; $downloadProduct = $downloadProducts[$d]; $downloadfilename = substr(basename($downloadProduct->file_name), 11); $downloadToken = $downloadProduct->download_id; $product_name = $downloadProduct->product_name; $mailtoken = $product_name . ": <a href='" . JUri::root() . "index.php?option=com_redshop&view=product&layout=downloadproduct&tid=" . $downloadToken . "'>" . $downloadfilename . "</a>"; $dpData .= "</tr>"; $dpData .= "<td>(" . $g . ") " . $mailtoken . "</td>"; $dpData .= "</tr>"; } $dpData .= "</table>"; } if ($row->order_status == "C" && $row->order_payment_status == "Paid") { $search[] = "{download_token}"; $replace[] = $dpData; $search[] = "{download_token_lbl}"; if ($dpData != "") { $replace[] = JText::_('COM_REDSHOP_DOWNLOAD_TOKEN'); } else { $replace[] = ""; } } else { $search[] = "{download_token}"; $replace[] = ""; $search[] = "{download_token_lbl}"; $replace[] = ""; } $issplitdisplay = ""; $issplitdisplay2 = ""; if ((strstr($ReceiptTemplate, "{discount_denotation}") || strstr($ReceiptTemplate, "{shipping_denotation}")) && ($Total_discount != 0 || $row->order_shipping != 0)) { $search[] = "{denotation_label}"; $replace[] = JText::_('COM_REDSHOP_DENOTATION_TXT'); } else { $search[] = "{denotation_label}"; $replace[] = ""; } $search[] = "{discount_denotation}"; if (strstr($ReceiptTemplate, "{discount_excl_vat}")) { $replace[] = "*"; } else { $replace[] = ""; } $search[] = "{shipping_denotation}"; if (strstr($ReceiptTemplate, "{shipping_excl_vat}")) { $replace[] = "*"; } else { $replace[] = ""; } $search[] = "{payment_status}"; if (trim($row->order_payment_status) == 'Paid') { $orderPaymentStatus = JText::_('COM_REDSHOP_PAYMENT_STA_PAID'); } elseif (trim($row->order_payment_status) == 'Unpaid') { $orderPaymentStatus = JText::_('COM_REDSHOP_PAYMENT_STA_UNPAID'); } elseif (trim($row->order_payment_status) == 'Partial Paid') { $orderPaymentStatus = JText::_('COM_REDSHOP_PAYMENT_STA_PARTIAL_PAID'); } else { $orderPaymentStatus = $row->order_payment_status; } $replace[] = $orderPaymentStatus . " " . JRequest::getVar('order_payment_log') . $issplitdisplay . $issplitdisplay2; $search[] = "{order_payment_status}"; $replace[] = $orderPaymentStatus . " " . JRequest::getVar('order_payment_log') . $issplitdisplay . $issplitdisplay2; $search[] = "{order_total}"; $replace[] = $this->_producthelper->getProductFormattedPrice($row->order_total); $search[] = "{total_excl_vat}"; $replace[] = $this->_producthelper->getProductFormattedPrice($total_excl_vat); $search[] = "{sub_total_vat}"; $replace[] = $this->_producthelper->getProductFormattedPrice($sub_total_vat); $search[] = "{order_id}"; $replace[] = $order_id; $search[] = "{discount_denotation}"; $replace[] = "*"; $arr_discount_type = array(); $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>'; } } } $search[] = "{discount_type}"; $replace[] = $discount_type; $search[] = "{discount_excl_vat}"; $replace[] = $this->_producthelper->getProductFormattedPrice($row->order_discount - $row->order_discount_vat); $search[] = "{order_status}"; $replace[] = $OrderStatus; $search[] = "{order_id_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_ID_LBL'); $search[] = "{order_date}"; $replace[] = $redconfig->convertDateFormat($row->cdate); $search[] = "{customer_note}"; $replace[] = $row->customer_note; $search[] = "{customer_message}"; $replace[] = $row->customer_message; $search[] = "{referral_code}"; $replace[] = $row->referral_code; $search[] = "{payment_method}"; $replace[] = JText::_($paymentmethod->order_payment_name); $txtextra_info = ''; if ($paymentmethod_detail->element == "rs_payment_banktransfer" || $paymentmethod_detail->element == "rs_payment_banktransfer_discount" || $paymentmethod_detail->element == "rs_payment_banktransfer2" || $paymentmethod_detail->element == "rs_payment_banktransfer3" || $paymentmethod_detail->element == "rs_payment_banktransfer4" || $paymentmethod_detail->element == "rs_payment_banktransfer5") { $paymentpath = JPATH_SITE . '/plugins/redshop_payment/' . $paymentmethod_detail->element . '/' . $paymentmethod_detail->element . '.xml'; $paymentparams = new JRegistry($paymentmethod_detail->params); $txtextra_info = $paymentparams->get('txtextra_info', ''); } $search[] = "{payment_extrainfo}"; $replace[] = $txtextra_info; if (JRequest::getVar('order_delivery')) { $search[] = "{delivery_time_lbl}"; $replace[] = JText::_('COM_REDSHOP_DELIVERY_TIME'); } else { $search[] = "{delivery_time_lbl}"; $replace[] = " "; } $search[] = "{delivery_time}"; $replace[] = JRequest::getVar('order_delivery'); $search[] = "{without_vat}"; $replace[] = ''; $search[] = "{with_vat}"; $replace[] = ''; if (strstr($ReceiptTemplate, '{order_detail_link_lbl}')) { $search[] = "{order_detail_link_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_DETAIL_LINK_LBL'); } if (strstr($ReceiptTemplate, '{product_subtotal_lbl}')) { $search[] = "{product_subtotal_lbl}"; $replace[] = JText::_('COM_REDSHOP_PRODUCT_SUBTOTAL_LBL'); } if (strstr($ReceiptTemplate, '{product_subtotal_excl_vat_lbl}')) { $search[] = "{product_subtotal_excl_vat_lbl}"; $replace[] = JText::_('COM_REDSHOP_PRODUCT_SUBTOTAL_EXCL_LBL'); } if (strstr($ReceiptTemplate, '{shipping_with_vat_lbl}')) { $search[] = "{shipping_with_vat_lbl}"; $replace[] = JText::_('COM_REDSHOP_SHIPPING_WITH_VAT_LBL'); } if (strstr($ReceiptTemplate, '{shipping_excl_vat_lbl}')) { $search[] = "{shipping_excl_vat_lbl}"; $replace[] = JText::_('COM_REDSHOP_SHIPPING_EXCL_VAT_LBL'); } if (strstr($ReceiptTemplate, '{product_price_excl_lbl}')) { $search[] = "{product_price_excl_lbl}"; $replace[] = JText::_('COM_REDSHOP_PRODUCT_PRICE_EXCL_LBL'); } $billingaddresses = $this->_order_functions->getOrderBillingUserInfo($order_id); $shippingaddresses = $this->_order_functions->getOrderShippingUserInfo($order_id); $search[] = "{requisition_number}"; $replace[] = $row->requisition_number ? $row->requisition_number : "N/A"; $search[] = "{requisition_number_lbl}"; $replace[] = JText::_('COM_REDSHOP_REQUISITION_NUMBER'); if (strstr($ReceiptTemplate, '{redcrm_debitornumber_lbl}')) { if ($session->get('isredcrmuser_debitor')) { $search[] = "{redcrm_debitornumber_lbl}"; $replace[] = JText::_('COM_REDSHOP_DEBITOR_NUMBER'); } else { $search[] = "{redcrm_debitornumber_lbl}"; $replace[] = ""; } } if (strstr($ReceiptTemplate, '{redcrm_debitornumber}')) { if ($session->get('isredcrmuser_debitor')) { $search[] = "{redcrm_debitornumber}"; $replace[] = $row->user_info_id; } else { $search[] = "{redcrm_debitornumber}"; $replace[] = ""; } } $ReceiptTemplate = $this->replaceBillingAddress($ReceiptTemplate, $billingaddresses); $ReceiptTemplate = $this->replaceShippingAddress($ReceiptTemplate, $shippingaddresses); $message = str_replace($search, $replace, $ReceiptTemplate); $message = $this->replacePayment($message, $row->payment_discount, 0, $row->payment_oprand); $message = $this->replaceDiscount($message, $row->order_discount, $total_for_discount); $message = $this->replaceTax($message, $row->order_tax + $row->order_shipping_tax, $row->tax_after_discount, 1); return $message; }
function display($tpl = null) { $config = new Redconfiguration(); $redTemplate = new Redtemplate(); $order_functions = new order_functions(); $producthelper = new producthelper(); $model = $this->getModel(); $redTemplate = new Redtemplate(); $detail = $this->get('data'); $carthelper = new rsCarthelper(); $shippinghelper = new shipping(); $products = $order_functions->getOrderItemDetail($detail->order_id); $template = $model->getStockNoteTemplate(); if (count($template) > 0 && $template->template_desc != "") { $html_template = $template->template_desc; } else { $html_template = '<table border="0" cellspacing="2" cellpadding="2" width="100%"><tr><td>{order_id_lbl} : {order_id}</td><td> {order_date_lbl} : {order_date}</td></tr></table> <table border="1" cellspacing="0" cellpadding="0" width="100%"><tbody><tr style="background-color: #d7d7d4"><th align="center">{product_name_lbl}</th> <th align="center">{product_number_lbl}</th> <th align="center">{product_quantity_lbl}</th></tr> {product_loop_start} <tr> <td align="center"> <table> <tr><td>{product_name}</td></tr> <tr><td>{product_attribute}</td></tr> </table> </td> <td align="center">{product_number}</td> <td align="center">{product_quantity}</td> </tr> {product_loop_end} </tbody> </table>'; } ob_start(); if (strstr($html_template, "{product_loop_start}") && strstr($html_template, "{product_loop_end}")) { $template_sdata = explode('{product_loop_start}', $html_template); $template_start = $template_sdata[0]; $template_edata = explode('{product_loop_end}', $template_sdata[1]); $template_end = $template_edata[1]; $template_middle = $template_edata[0]; $middle_data = ''; for ($p = 0; $p < count($products); $p++) { $middle_data .= $template_middle; $product_detail = $producthelper->getProductById($products[$p]->product_id); $middle_data = str_replace("{product_number}", $product_detail->product_number, $middle_data); $middle_data = str_replace("{product_name}", $products[$p]->order_item_name, $middle_data); $middle_data = str_replace("{product_attribute}", $products[$p]->product_attribute, $middle_data); $middle_data = str_replace("{product_quantity}", $products[$p]->product_quantity, $middle_data); } $html_template = $template_start . $middle_data . $template_end; } $html_template = str_replace("{order_id_lbl}", JText::_('COM_REDSHOP_ORDER_ID'), $html_template); $html_template = str_replace("{order_id}", $detail->order_id, $html_template); $html_template = str_replace("{order_date_lbl}", JText::_('COM_REDSHOP_ORDER_DATE'), $html_template); $html_template = str_replace("{order_date}", $config->convertDateFormat($detail->cdate), $html_template); $html_template = str_replace("{product_name_lbl}", JText::_('COM_REDSHOP_PRODUCT_NAME'), $html_template); $html_template = str_replace("{product_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER'), $html_template); $html_template = str_replace("{product_quantity_lbl}", JText::_('COM_REDSHOP_QUANTITY'), $html_template); $billing = $order_functions->getOrderBillingUserInfo($detail->order_id); $html_template = $carthelper->replaceBillingAddress($html_template, $billing); $shipping = $order_functions->getOrderShippingUserInfo($detail->order_id); $html_template = $carthelper->replaceShippingAddress($html_template, $shipping); $html_template = str_replace("{requisition_number}", $detail->requisition_number, $html_template); $html_template = str_replace("{requisition_number_lbl}", JText::_('COM_REDSHOP_REQUISITION_NUMBER'), $html_template); // start pdf code $pdfObj = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'A5', true, 'UTF-8', false); $pdfObj->SetTitle("Order StockNote: " . $detail->order_id); $pdfObj->SetAuthor('redSHOP'); $pdfObj->SetCreator('redSHOP'); $pdfObj->SetMargins(15, 15, 15); $font = 'times'; $pdfObj->SetHeaderData('', '', '', "Order " . $detail->order_id); $pdfObj->setHeaderFont(array($font, '', 10)); //$pdfObj->setFooterFont(array($font, '', 8)); $pdfObj->SetFont($font, "", 10); //$pdfObj->AliasNbPages(); $pdfObj->AddPage(); $pdfObj->WriteHTML($html_template); $pdfObj->Output("StocNoteOrder_" . $detail->order_id . ".pdf", "D"); exit; }
<td align="center"><?php echo $row->section_type; ?> </td> <td align="center"><?php $row->published = $row->auto_sync; echo $auto_sync = JHTML::_('grid.published', $row, $i, 'tick.png', 'publish_x.png', 'auto_sync'); ?> </td> <td align="center"><?php $row->published = $row->use_to_all_users; echo $usetoall = JHTML::_('grid.published', $row, $i, 'tick.png', 'publish_x.png', 'usetoall'); ?> </td> <!-- <td align="center"><?php echo $config->convertDateFormat($row->xmlexport_date); ?> </td> --> <td align="center"><?php echo $published; ?> </td> <td align="center"><?php echo $row->id; ?> </td> </tr> </tr> <?php $k = 1 - $k; }
$template_middle = $template_edata[0]; $cart_mdata = ""; for ($i = 0; $i < count($this->detail); $i++) { $prolist = $order_function->getOrderItemDetail($this->detail[$i]->order_id); $statusname = $order_function->getOrderStatusTitle($this->detail[$i]->order_status); $order_item_name = array(); for ($j = 0; $j < count($prolist); $j++) { $order_item_name[$j] = $prolist[$j]->order_item_name; } $orderdetailurl = JRoute::_('index.php?option=com_redshop&view=order_detail&oid=' . $this->detail[$i]->order_id); $reorderurl = JUri::root() . 'index.php?option=com_redshop&view=order_detail&order_id=' . $this->detail[$i]->order_id . '&task=reorder&tmpl=component'; $order_number = "<div class='order_number'>" . $this->detail[$i]->order_number . "</div>"; $order_id = "<div class='order_id'>" . $this->detail[$i]->order_id . "</div>"; $order_products = "<div class='order_products'>" . implode(',<br/>', $order_item_name) . "</div>"; $order_total = "<div class='order_total'>" . $producthelper->getProductFormattedPrice($this->detail[$i]->order_total) . "</div>"; $order_date = "<div class='order_date'>" . $redconfig->convertDateFormat($this->detail[$i]->cdate) . "</div>"; $order_status = "<div class='order_status'>" . $statusname . "</div>"; $order_detail_link = "<div class='order_detail_link'><a href='" . $orderdetailurl . "'>" . JText::_('COM_REDSHOP_ORDER_DETAIL') . "</a></div>"; $reorder_link = "<div class='reorder_link'><a href='javascript:if(confirm(\"" . JText::_('COM_REDSHOP_CONFIRM_CART_EMPTY') . "\")){window.location=\"" . $reorderurl . "\";}'>" . JText::_('COM_REDSHOP_REORDER') . "</a></div>"; $cart_mdata .= $template_middle; $cart_mdata = str_replace("{order_number}", $order_number, $cart_mdata); $cart_mdata = str_replace("{order_id}", $order_id, $cart_mdata); $cart_mdata = str_replace("{order_products}", $order_products, $cart_mdata); $cart_mdata = str_replace("{order_total}", $order_total, $cart_mdata); $cart_mdata = str_replace("{order_date}", $order_date, $cart_mdata); $cart_mdata = str_replace("{order_status}", $order_status, $cart_mdata); $cart_mdata = str_replace("{order_detail_link}", $order_detail_link, $cart_mdata); $cart_mdata = str_replace("{reorder_link}", $reorder_link, $cart_mdata); } $template_desc = str_replace("{product_loop_start}", "", $template_desc); $template_desc = str_replace($template_middle, $cart_mdata, $template_desc);
<?php echo $row->voucher_code; ?> </a> </td> <td align="center"> <?php echo $producthelper->getProductFormattedPrice($row->amount); ?> </td> <td align="center"><?php echo $row->voucher_type; ?> </td> <td align="center"><?php echo $config->convertDateFormat($row->start_date); ?> </td> <td align="center"><?php echo $config->convertDateFormat($row->end_date); ?> </td> <td align="center"><?php echo $row->voucher_left; ?> </td> <td align="center"><?php echo $published; ?> </td> <td align="center"><?php
?> </a> </td> <td width="15%"> <?php if ($username != "") { echo $username; } ?> </td> <td width="15%"> <a href="<?php echo $link; ?> "><?php echo $config->convertDateFormat($row->time); ?> </a> </td> <td class="order" width="12%"> <img src="<?php echo REDSHOP_ADMIN_IMAGES_ABSPATH; ?> star_rating/<?php echo $row->user_rating; ?> .gif" border="0"> </td>
<tr> <td> <table border="0" cellspacing="0" cellpadding="0" class="adminlist"> <tr style="background-color: #cccccc"> <th colspan="2" align="left"><?php echo JText::_('COM_REDSHOP_QUOTATION_INFORMATION'); ?> </th> </tr> <tr> <td width="25%"><?php echo JText::_('COM_REDSHOP_QUOTATION_DATE'); ?> </td> <td><?php echo $redconfig->convertDateFormat($quotation->quotation_cdate); ?> </td> </tr> <tr> <td><?php echo JText::_('COM_REDSHOP_QUOTATION_NUMBER'); ?> </td> <td><?php echo $quotation->quotation_number; ?> <input name="quotation_number" id="quotation_number" type="hidden" value="<?php echo $quotation->quotation_number;
?> </td> <td><?php echo $order_detail->order_number; ?> </td> <td><?php echo $itemlist; ?> </td> <td><?php echo $producthelper->getProductFormattedPrice($order_detail->order_total); ?> </td> <td><?php echo $redconfig->convertDateFormat($order_detail->cdate); ?> </td> <td><?php echo $statusname; ?> </td> <td><a href="<?php echo $orderdetailurl; ?> "> <?php echo JText::_('COM_REDSHOP_ORDER_DETAIL'); ?> </a></td>
</a> </td> <td><?php echo $display; ?> </td> <td align="center"><?php echo $status; ?> </td> <td align="center"><?php echo $producthelper->getProductFormattedPrice($row->quotation_total); ?> </td> <td align="center"><?php echo $config->convertDateFormat($row->quotation_cdate); ?> </td> </tr> <?php $k = 1 - $k; } ?> <tr> <td colspan="8"><?php echo $this->pagination->getListFooter(); ?> </td> </table> </div>
public function changeOrderStatusMail($order_id, $newstatus, $order_comment = '') { $db = JFactory::getDbo(); $app = JFactory::getApplication(); $config = new Redconfiguration(); $carthelper = new rsCarthelper(); $order_functions = new order_functions(); $redshopMail = new redshopMail(); $shippinghelper = new shipping(); $MailFrom = $app->getCfg('mailfrom'); $FromName = $app->getCfg('fromname'); $mailbcc = null; $mailtemplate = $redshopMail->getMailtemplate(0, '', 'mail_section LIKE "order_status" AND mail_order_status LIKE ' . $db->quote($newstatus) . ' '); if (count($mailtemplate) > 0) { $maildata = $mailtemplate[0]->mail_body; $mailsubject = $mailtemplate[0]->mail_subject; if (trim($mailtemplate[0]->mail_bcc) != "") { $mailbcc = explode(",", $mailtemplate[0]->mail_bcc); } // Getting the order details $orderdetail = $this->getOrderDetails($order_id); $barcode_code = $orderdetail->barcode; // Changes to parse all tags same as order mail start $row = $order_functions->getOrderDetails($order_id); $maildata = str_replace("{order_mail_intro_text_title}", JText::_('COM_REDSHOP_ORDER_MAIL_INTRO_TEXT_TITLE'), $maildata); $maildata = str_replace("{order_mail_intro_text}", JText::_('COM_REDSHOP_ORDER_MAIL_INTRO_TEXT'), $maildata); $maildata = $carthelper->replaceOrderTemplate($row, $maildata); $arr_discount_type = array(); $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; $maildata = str_replace($search_sub, $replace_sub, $maildata); // Changes to parse all tags same as order mail end $userdetail = $this->getOrderBillingUserInfo($order_id); // For barcode if (strstr($maildata, "{barcode}")) { if ($barcode_code != "" && file_exists(REDSHOP_FRONT_IMAGES_RELPATH . "barcode/" . $barcode_code . ".png")) { $barcode_code = $barcode_code; } else { $barcode_code = $this->barcode_randon_number(12, 1); $this->updatebarcode($order_id, $barcode_code); } $img_url = REDSHOP_FRONT_IMAGES_ABSPATH . "barcode/" . $barcode_code . ".png"; $bar_replace = '<img alt="" src="' . $img_url . '">'; $search[] = "{barcode}"; $replace[] = $bar_replace; } // Getting the order status changed template from mail center end $maildata = $carthelper->replaceBillingAddress($maildata, $userdetail); // Get ShippingAddress From order Users info $shippingaddresses = $this->getOrderShippingUserInfo($order_id); if (count($shippingaddresses) <= 0) { $shippingaddresses = $userdetail; } $maildata = $carthelper->replaceShippingAddress($maildata, $shippingaddresses); $search[] = "{shopname}"; $replace[] = SHOP_NAME; $search[] = "{fullname}"; $replace[] = $userdetail->firstname . " " . $userdetail->lastname; $search[] = "{customer_id}"; $replace[] = $userdetail->users_info_id; $search[] = "{order_id}"; $replace[] = $order_id; $search[] = "{order_number}"; $replace[] = $orderdetail->order_number; $search[] = "{order_date}"; $replace[] = $config->convertDateFormat($orderdetail->cdate); $search[] = "{customer_note_lbl}"; $replace[] = JText::_('COM_REDSHOP_COMMENT'); $search[] = "{customer_note}"; $replace[] = $order_comment; $search[] = "{order_detail_link_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_DETAIL_LBL'); $orderdetailurl = JURI::root() . 'index.php?option=com_redshop&view=order_detail&oid=' . $order_id . '&encr=' . $orderdetail->encr_key; $search[] = "{order_detail_link}"; $replace[] = "<a href='" . $orderdetailurl . "'>" . JText::_("COM_REDSHOP_ORDER_DETAIL_LINK_LBL") . "</a>"; $details = explode("|", $shippinghelper->decryptShipping(str_replace(" ", "+", $orderdetail->ship_method_id))); if (count($details) <= 1) { $details = explode("|", $orderdetail->ship_method_id); } $shopLocation = $orderdetail->shop_id; if ($details[0] != 'plgredshop_shippingdefault_shipping_GLS') { $shopLocation = ''; } $arrLocationDetails = explode('|', $shopLocation); $orderdetail->track_no = $arrLocationDetails[0]; $search[] = "{order_track_no}"; $replace[] = trim($orderdetail->track_no); $order_trackURL = 'http://www.pacsoftonline.com/ext.po.dk.dk.track?key=' . POSTDK_CUSTOMER_NO . '&order=' . $order_id; $search[] = "{order_track_url}"; $replace[] = "<a href='" . $order_trackURL . "'>" . JText::_("COM_REDSHOP_TRACK_LINK_LBL") . "</a>"; $mailbody = str_replace($search, $replace, $maildata); $mailsubject = str_replace($search, $replace, $mailsubject); if ($userdetail->user_email != '' && $mailbody) { JUtility::sendMail($MailFrom, $FromName, $userdetail->user_email, $mailsubject, $mailbody, 1, null, $mailbcc); } } }
if ($stockroom_id != "") { $stockroom_list = $stockroomhelper->getStockroom(substr_replace($stockroom_id, "", -1)); for ($s = 0; $s < count($stockroom_list); $s++) { echo $stockroom_list[$s]->stockroom_name; echo "<br>"; echo $delivery_time = $stockroom_list[$s]->min_del_time . "-" . $stockroom_list[$s]->max_del_time . " " . $stockroom_list[$s]->delivery_time; echo "<br>"; } } ?> </td> <td align="center"> <?php if ($stockroom_id != "") { $max_delivery = $stockroomhelper->getStockroom_maxdelivery(substr_replace($stockroom_id, "", -1)); $orderdate = $config->convertDateFormat($row->cdate); $stamp = mktime(0, 0, 0, date('m', $row->cdate), date('d', $row->cdate) + $max_delivery[0]->max_del_time, date('Y', $row->cdate)); $delivery_date = date('d/m/Y', $stamp); $current_date = date('d/m/Y'); $datediff = $stockroomhelper->getdateDiff($stamp, time()); if ($datediff < 0) { $datediff = 0; } echo $datediff . " " . $max_delivery[0]->delivery_time; } ?> </td> <?php } ?> <td align="center">
function display($tpl = null) { $config = new Redconfiguration(); $redTemplate = new Redtemplate(); $order_functions = new order_functions(); $model = $this->getModel(); $detail = $this->get('data'); $billing = $order_functions->getBillingAddress($detail->user_id); $shipping = $order_functions->getOrderShippingUserInfo($detail->order_id); if (!$shipping) { $shipping = $billing; } $template = $redTemplate->getTemplate("shipping_pdf"); $html_template = $template[0]->template_desc; ob_start(); $order_status = $order_functions->getOrderStatusTitle($detail->order_status); $html_template = str_replace("{order_information_lbl}", JText::_('COM_REDSHOP_ORDER_INFORMATION'), $html_template); $html_template = str_replace("{order_id_lbl}", JText::_('COM_REDSHOP_ORDER_ID'), $html_template); $html_template = str_replace("{order_number_lbl}", JText::_('COM_REDSHOP_ORDER_NUMBER'), $html_template); $html_template = str_replace("{order_date_lbl}", JText::_('COM_REDSHOP_ORDER_DATE'), $html_template); $html_template = str_replace("{order_status_lbl}", JText::_('COM_REDSHOP_ORDER_STATUS'), $html_template); $html_template = str_replace("{shipping_address_info_lbl}", JText::_('COM_REDSHOP_SHIPPING_ADDRESS_INFORMATION'), $html_template); $html_template = str_replace("{shipping_firstname_lbl}", JText::_('COM_REDSHOP_FIRSTNAME'), $html_template); $html_template = str_replace("{shipping_lastname_lbl}", JText::_('COM_REDSHOP_LASTNAME'), $html_template); $html_template = str_replace("{shipping_address_lbl}", JText::_('COM_REDSHOP_ADDRESS'), $html_template); $html_template = str_replace("{shipping_zip_lbl}", JText::_('COM_REDSHOP_ZIP'), $html_template); $html_template = str_replace("{shipping_city_lbl}", JText::_('COM_REDSHOP_CITY'), $html_template); $html_template = str_replace("{shipping_country_lbl}", JText::_('COM_REDSHOP_COUNTRY'), $html_template); $html_template = str_replace("{shipping_state_lbl}", JText::_('COM_REDSHOP_STATE'), $html_template); $html_template = str_replace("{shipping_phone_lbl}", JText::_('COM_REDSHOP_PHONE'), $html_template); $html_template = str_replace("{order_id}", $detail->order_id, $html_template); $html_template = str_replace("{order_number}", $detail->order_number, $html_template); $html_template = str_replace("{order_date}", $config->convertDateFormat($detail->cdate), $html_template); $html_template = str_replace("{order_status}", $order_status, $html_template); $html_template = str_replace("{shipping_firstname}", $shipping->firstname, $html_template); $html_template = str_replace("{shipping_lastname}", $shipping->lastname, $html_template); $html_template = str_replace("{shipping_address}", $shipping->address, $html_template); $html_template = str_replace("{shipping_zip}", $shipping->zipcode, $html_template); $html_template = str_replace("{shipping_city}", $shipping->city, $html_template); $html_template = str_replace("{shipping_country}", JTEXT::_($order_functions->getCountryName($shipping->country_code)), $html_template); $html_template = str_replace("{shipping_state}", $order_functions->getStateName($shipping->state_code, $shipping->country_code), $html_template); $html_template = str_replace("{shipping_phone}", $shipping->zipcode, $html_template); // if user is company than if ($billing->is_company && $billing->company_name != "") { $html_template = str_replace("{company_name}", $billing->company_name, $html_template); $html_template = str_replace("{company_name_lbl}", JText::_('COM_REDSHOP_COMPANY_NAME'), $html_template); } else { $html_template = str_replace("{company_name}", "", $html_template); $html_template = str_replace("{company_name_lbl}", "", $html_template); } $pdfObj = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'A5', true, 'UTF-8', false); $pdfObj->SetTitle("Order :" . $detail->order_id); $pdfObj->SetAuthor('redSHOP'); $pdfObj->SetCreator('redSHOP'); $pdfObj->SetMargins(15, 15, 15); $font = 'times'; $pdfObj->SetHeaderData('', '', '', "Order " . $detail->order_id); $pdfObj->setHeaderFont(array($font, '', 10)); //$pdfObj->setFooterFont(array($font, '', 8)); $pdfObj->SetFont($font, "", 12); //$pdfObj->AliasNbPages(); $pdfObj->AddPage(); $pdfObj->WriteHTML($html_template); $pdfObj->Output("Order_" . $detail->order_id . ".pdf", "D"); exit; }
/** * After purchased order mail function * * @return void */ public function after_purchased_order_mail() { $redshopMail = new redshopMail(); $redconfig = new Redconfiguration(); $stockroomhelper = new rsstockroomhelper(); $db = JFactory::getDbo(); $date = JFactory::getDate(); $fdate = $date->toFormat('%Y-%m-%d'); $query = "SELECT * FROM #__redshop_orders where order_payment_status ='Paid' and order_status = 'C'"; $db->setQuery($query); $data = $db->loadObjectList(); JTable::addIncludePath(JPATH_SITE . '/administrator/components/com_redshop/tables'); foreach ($data as $mail_detail) { $bodytmp = ""; $subject = ""; $order_id = $mail_detail->order_id; $mailbcc = null; $config = JFactory::getConfig(); $from = $config->getValue('mailfrom'); $fromname = $config->getValue('fromname'); $start_date = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $end_date = $start_date + DISCOUPON_DURATION * 23 * 59 * 59; $valid_end_date = $redconfig->convertDateFormat($end_date); $discoupon_value = DISCOUPON_PERCENT_OR_TOTAL == 0 ? REDCURRENCY_SYMBOL . " " . number_format(DISCOUPON_VALUE, 2, PRICE_SEPERATOR, THOUSAND_SEPERATOR) : ($discoupon_value = DISCOUPON_VALUE . " %"); $sql = "SELECT CONCAT(firstname,' ',lastname) as name,user_email as email FROM `#__redshop_order_users_info` WHERE `order_id` = " . (int) $mail_detail->order_id . " AND `address_type` = 'BT' limit 0,1"; $db->setQuery($sql); $orderuserarr = $db->loadObject(); $sql = "SELECT coupon_left as total,coupon_code,end_date FROM `#__redshop_coupons` WHERE `order_id` = " . (int) $order_id . " AND coupon_left != 0 limit 0,1"; $db->setQuery($sql); $couponeArr = $db->loadObject(); if (count($couponeArr) <= 0) { continue; } $total = $couponeArr->total; $coupon_code = $couponeArr->coupon_code; $cend_date = $couponeArr->end_date; $name = ""; $recipient = ""; if (isset($orderuserarr)) { $recipient = $orderuserarr->email; $name = $orderuserarr->name; } if ($mail_detail->mail1_status == 0 && (DAYS_MAIL1 != 0 || DAYS_MAIL1 != '')) { $send_date = date("Y-m-d", $mail_detail->cdate + DAYS_MAIL1 * (60 * 60 * 24)); $firstmail_data = $redshopMail->getMailtemplate(0, "first_mail_after_order_purchased"); if (count($firstmail_data) > 0) { $bodytmp = $firstmail_data[0]->mail_body; $subject = $firstmail_data[0]->mail_subject; if (trim($firstmail_data[0]->mail_bcc) != "") { $mailbcc = explode(",", $firstmail_data[0]->mail_bcc); } } $jpathurl = '<a href="' . JURI::root() . '">' . JURI::root() . '</a>'; $body = str_replace("{name}", $name, $bodytmp); $body = str_replace("{url}", $jpathurl, $body); $body = str_replace("{coupon_amount}", $discoupon_value, $body); if ($fdate == $send_date) { $better_token = md5(uniqid(mt_rand(), true)); $token = substr($better_token, 0, 10); $body = str_replace("{coupon_code}", $token, $body); $body = str_replace("{coupon_duration}", $valid_end_date, $body); $sent = JUtility::sendMail($from, $fromname, $recipient, $subject, $body, $mode = 1, null, $mailbcc); if ($sent == 1) { $couponItems = JTable::getInstance('coupon_detail', 'Table'); $couponItems->coupon_code = $token; $couponItems->percent_or_total = DISCOUPON_PERCENT_OR_TOTAL; $couponItems->coupon_value = DISCOUPON_VALUE; $couponItems->start_date = $start_date; $couponItems->end_date = $end_date; $couponItems->coupon_type = 1; $couponItems->userid = $mail_detail->user_id; $couponItems->coupon_left = 1; $couponItems->published = 1; $couponItems->order_id = $order_id; $couponItems->store(); $q_update = "UPDATE #__redshop_orders SET mail1_status = 1 WHERE order_id = " . $order_id; $db->setQuery($q_update); $db->query(); } } } elseif ($mail_detail->mail2_status == 0 && (DAYS_MAIL2 != 0 || DAYS_MAIL2 != '') && $total != 0) { $send_date = date("Y-m-d", $mail_detail->cdate + DAYS_MAIL2 * (59 * 59 * 23)); $secmail_data = $redshopMail->getMailtemplate(0, "second_mail_after_order_purchased"); if (count($secmail_data) > 0) { $bodytmp = $secmail_data[0]->mail_body; $subject = $secmail_data[0]->mail_subject; if (trim($secmail_data[0]->mail_bcc) != "") { $mailbcc = explode(",", $secmail_data[0]->mail_bcc); } } $days = $stockroomhelper->getdatediff($cend_date, $start_date); $jpathurl = '<a href="' . JURI::root() . '">' . JURI::root() . '</a>'; $body = str_replace("{name}", $name, $bodytmp); $body = str_replace("{url}", $jpathurl, $body); $body = str_replace("{coupon_amount}", $discoupon_value, $body); if ($days && $fdate == $send_date) { $valid_end_date = $redconfig->convertDateFormat($cend_date); $body = str_replace("{coupon_code}", $coupon_code, $body); $body = str_replace("{coupon_duration}", $valid_end_date, $body); $sent = JUtility::sendMail($from, $fromname, $recipient, $subject, $body, $mode = 1, null, $mailbcc); $q_update = "UPDATE #__redshop_orders SET mail2_status = 1 WHERE order_id = " . $order_id; $db->setQuery($q_update); $db->query(); } } elseif ($mail_detail->mail3_status == 0 && (DAYS_MAIL3 != 0 || DAYS_MAIL3 != '') && $total != 0) { // Coupon reminder $thrdmail_data = $redshopMail->getMailtemplate(0, "third_mail_after_order_purchased"); if (count($thrdmail_data) > 0) { $bodytmp = $thrdmail_data[0]->mail_body; $subject = $thrdmail_data[0]->mail_subject; if (trim($thrdmail_data[0]->mail_bcc) != "") { $mailbcc = explode(",", $thrdmail_data[0]->mail_bcc); } } $send_date = date("Y-m-d", $mail_detail->cdate + DAYS_MAIL3 * (60 * 60 * 24)); $days = $stockroomhelper->getdatediff($cend_date, $start_date); $jpathurl = '<a href="' . JURI::root() . '">' . JURI::root() . '</a>'; $body = str_replace("{name}", $name, $bodytmp); $body = str_replace("{url}", $jpathurl, $body); $body = str_replace("{coupon_amount}", $discoupon_value, $body); if ($days && $fdate == $send_date) { $valid_end_date = $redconfig->convertDateFormat($cend_date); $body = str_replace("{coupon_code}", $coupon_code, $body); $body = str_replace("{coupon_duration}", $valid_end_date, $body); $sent = JUtility::sendMail($from, $fromname, $recipient, $subject, $body, $mode = 1, null, $mailbcc); $q_update = "UPDATE #__redshop_orders SET mail3_status = 1 WHERE order_id = " . $order_id; $db->setQuery($q_update); $db->query(); } } } }
$product_data = str_replace("{product_title}", $this->detail[$i]->product_name, $product_data); if (strstr($product_data, "{review_loop_start}") && strstr($product_data, "{review_loop_end}")) { $review_start = explode("{review_loop_start}", $product_data); $review_end = explode("{review_loop_end}", $review_start[1]); $review_template = $review_end[0]; $review_data = ""; $reviews = $model->getProductreviews($this->detail[$i]->product_id); if (count($reviews) > 0) { for ($j = 0; $j < $mainblock && $j < count($reviews); $j++) { $review_data .= $review_template; $fullname = $reviews[$j]->firstname . " " . $reviews[$j]->lastname; $starimage = '<img src="' . REDSHOP_ADMIN_IMAGES_ABSPATH . 'star_rating/' . $reviews[$j]->user_rating . '.gif">'; $review_data = str_replace("{fullname}", $fullname, $review_data); $review_data = str_replace("{title}", $reviews[$j]->title, $review_data); $review_data = str_replace("{comment}", $reviews[$j]->comment, $review_data); $review_data = str_replace("{reviewdate}", $redconfig->convertDateFormat($reviews[$j]->time), $review_data); $review_data = str_replace("{stars}", $starimage, $review_data); } if ($mainblock < count($reviews)) { $review_data .= '<div style="clear:both;" class="show_reviews"><a href="javascript:showallreviews(' . $this->detail[$i]->product_id . ');"> <img src="' . REDSHOP_FRONT_IMAGES_ABSPATH . 'reviewarrow.gif"> ' . JText::_('COM_REDSHOP_SHOW_ALL_REVIEWS') . '</a></div>'; } $review_data .= '<div style="display:none;" id="showreviews' . $this->detail[$i]->product_id . '" name="showreviews' . $this->detail[$i]->product_id . '">'; for ($k = $mainblock; $k < count($reviews); $k++) { $review_data .= $review_template; $fullname2 = $reviews[$k]->firstname . " " . $reviews[$k]->lastname; $starimage2 = '<img src="' . REDSHOP_ADMIN_IMAGES_ABSPATH . 'star_rating/' . $reviews[$k]->user_rating . '.gif">'; $review_data = str_replace("{fullname}", $fullname2, $review_data); $review_data = str_replace("{title}", $reviews[$k]->title, $review_data); $review_data = str_replace("{comment}", $reviews[$k]->comment, $review_data); $review_data = str_replace("{reviewdate}", $redconfig->convertDateFormat($reviews[$k]->time), $review_data); $review_data = str_replace("{stars}", $starimage2, $review_data);
<tr> <td> <table border="0" cellspacing="0" cellpadding="0" class="adminlist"> <tr style="background-color: #cccccc"> <th colspan="2" align="left"><?php echo JText::_('COM_REDSHOP_ORDER_INFORMATION'); ?> </th> </tr> <tr> <td><?php echo JText::_('COM_REDSHOP_ORDER_DATE'); ?> </td> <td><?php echo $redconfig->convertDateFormat(time()); ?> </td> </tr> <tr> <td><?php echo JText::_('COM_REDSHOP_CUSTOMER_IP_ADDRESS'); ?> </td> <td><?php echo $ip; ?> </td> </tr> <tr> <td><?php
$expand = "<a href='javascript:void(0)' onClick='expand_collapse(this," . $product->product_id . ")' style='font-size:18px;text-decoration:none;' >-</a>"; if ($i != $compare['idx'] - 1) { $template = str_replace('{expand_collapse}', $expand . $td_end . '<td align="center">' . "{expand_collapse}", $template); } else { $template = str_replace('{expand_collapse}', $expand . $td_end . $td_start . "{expand_collapse}", $template); } $template = str_replace('{product_name}', $exp_div . $product->product_name . $div_end . $td_end . $td_start . "{product_name}", $template); $template = str_replace('{product_image}', $exp_div . $img . $div_end . $td_end . $td_start . "{product_image}", $template); if (strstr($template, "{manufacturer_name}")) { $manufacturer = $producthelper->getSection('manufacturer', $product->manufacturer_id); $template = str_replace('{manufacturer_name}', $exp_div . $manufacturer->manufacturer_name . $div_end . $td_end . $td_start . "{manufacturer_name}", $template); } if (strstr($template, "{discount_start_date}")) { $disc_start_date = ""; if ($product->discount_stratdate) { $disc_start_date = $config->convertDateFormat($product->discount_stratdate); } $template = str_replace('{discount_start_date}', $exp_div . $disc_start_date . $div_end . $td_end . $td_start . "{discount_start_date}", $template); } if (strstr($template, "{discount_end_date}")) { $disc_end_date = ""; if ($product->discount_enddate) { $disc_end_date = $config->convertDateFormat($product->discount_enddate); } $template = str_replace('{discount_end_date}', $exp_div . $disc_end_date . $div_end . $td_end . $td_start . "{discount_end_date}", $template); } $template = str_replace('{product_s_desc}', $exp_div . $product->product_s_desc . $div_end . $td_end . $td_start . "{product_s_desc}", $template); $template = str_replace('{product_desc}', $exp_div . $product->product_desc . $div_end . $td_end . $td_start . "{product_desc}", $template); $product_number_output = '<span id="product_number_variable' . $product->product_id . '">' . $product->product_number . '</span>'; $template = str_replace('{product_number}', $exp_div . $product->product_number . $div_end . $td_end . $td_start . "{product_number}", $template); $product_weight_unit = '<span class="product_unit_variable">' . DEFAULT_WEIGHT_UNIT . '</span>';
?> </td> <td align="center"><?php echo JHTML::_('grid.id', $i, $row->id); ?> </td> <td><?php echo $row->name; ?> </td> <td><?php echo $row->email; ?> </td> <td align="center"><?php echo $config->convertDateFormat($row->registerdate); ?> </td> <td align="center"><a class="modal" href="index.php?tmpl=component&option=<?php echo $option; ?> &view=sample_catalog&cid[]=<?php echo $row->request_id; ?> &showbuttons=1" rel="{handler: 'iframe', size: {x: 400, y: 400}}" title=""> <?php echo JText::_('COM_REDSHOP_DETAIL'); ?> </a>
<td><?php echo JText::_('COM_REDSHOP_ORDER_NUMBER'); ?> :</td> <td><?php echo $this->detail->order_number; ?> </td> </tr> <tr> <td><?php echo JText::_('COM_REDSHOP_ORDER_DATE'); ?> :</td> <td><?php echo $config->convertDateFormat($this->detail->cdate); ?> </td> </tr> <tr> <td><?php echo JText::_('COM_REDSHOP_ORDER_PAYMENT_METHOD'); ?> :</td> <td><?php echo JText::_($this->payment_detail->order_payment_name); ?> <?php if (count($model->getccdetail($order_id)) > 0) { ?> <a href="<?php
public function sendEconomicBookInvoiceMail($order_id = 0, $bookinvoicepdf = "") { if ($order_id == 0) { return false; } $redconfig = new Redconfiguration(); $config = JFactory::getConfig(); $from = $config->getValue('mailfrom'); $fromname = $config->getValue('fromname'); $mailinfo = $this->getMailtemplate(0, "economic_inoice"); $data_add = "economic inoice"; $subject = "economic_inoice"; $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); } } $orderdetail = $this->_order_functions->getOrderDetails($order_id); $user_billinginfo = $this->_order_functions->getOrderBillingUserInfo($order_id); $search[] = "{name}"; $search[] = "{order_number}"; $search[] = "{order_comment}"; $search[] = "{order_id}"; $search[] = "{order_date}"; if ($user_billinginfo->is_company == 1 && $user_billinginfo->company_name != '') { $replace[] = $user_billinginfo->company_name; } else { $replace[] = $user_billinginfo->firstname . " " . $user_billinginfo->lastname; } $replace[] = $orderdetail->order_number; $replace[] = $orderdetail->customer_note; $replace[] = $orderdetail->order_id; $replace[] = $redconfig->convertDateFormat($orderdetail->cdate); $data_add = str_replace($search, $replace, $data_add); $attachment[] = $bookinvoicepdf; if ($user_billinginfo->user_email != "") { JUtility::sendMail($from, $fromname, $user_billinginfo->user_email, $subject, $data_add, 1, null, $mailbcc, $attachment); } if (ADMINISTRATOR_EMAIL != '') { $sendto = explode(",", trim(ADMINISTRATOR_EMAIL)); JUtility::sendMail($from, $fromname, $sendto, $subject, $data_add, 1, null, $mailbcc, $attachment); } return true; }
<a href="<?php echo $link; ?> " title="<?php echo JText::_('COM_REDSHOP_EDIT_NEWSLETTER_SUBSCR'); ?> "><?php $row->user_id == 0 ? $name = $row->name : ($name = $order_function->getUserFullname($row->user_id)); echo $name; ?> </a> </td> <td align="center" width="15%"> <?php echo $config->convertDateFormat($row->date); ?> </td> <td width="15%"> <?php echo $row->n_name; ?> </td> <td align="center" width="8%"> <?php echo $published; ?> </td> <td align="center" width="5%"> <?php echo $row->subscription_id;
$paymentmethod = $paymentmethod[0]; $order_print_template = $redTemplate->getTemplate("order_print"); if (count($order_print_template) > 0 && $order_print_template[0]->template_desc != "") { $ordersprint_template = $order_print_template[0]->template_desc; } else { $ordersprint_template = '<table style="width: 100%;" border="0" cellpadding="5" cellspacing="0"><tbody><tr><td colspan="2"><table style="width: 100%;" border="0" cellpadding="2" cellspacing="0"><tbody><tr style="background-color: #cccccc;"><th align="left">{order_information_lbl}{print}</th></tr><tr></tr><tr><td>{order_id_lbl} : {order_id}</td></tr><tr><td>{order_number_lbl} : {order_number}</td></tr><tr><td>{order_date_lbl} : {order_date}</td></tr><tr><td>{order_status_lbl} : {order_status}</td></tr><tr><td>{shipping_method_lbl} : {shipping_method} : {shipping_rate_name}</td></tr><tr><td>{payment_lbl} : {payment_method}</td></tr></tbody></table></td></tr><tr><td colspan="2"><table style="width: 100%;" border="0" cellpadding="2" cellspacing="0"><tbody><tr style="background-color: #cccccc;"><th align="left">{billing_address_information_lbl}</th></tr><tr></tr><tr><td>{billing_address}</td></tr></tbody></table></td></tr><tr><td colspan="2"><table style="width: 100%;" border="0" cellpadding="2" cellspacing="0"><tbody><tr style="background-color: #cccccc;"><th align="left">{shipping_address_info_lbl}</th></tr><tr></tr><tr><td>{shipping_address}</td></tr></tbody></table></td></tr><tr><td colspan="2"><table style="width: 100%;" border="0" cellpadding="2" cellspacing="0"><tbody><tr style="background-color: #cccccc;"><th align="left">{order_detail_lbl}</th></tr><tr></tr><tr><td><table style="width: 100%;" border="0" cellpadding="2" cellspacing="2"><tbody><tr><td>{product_name_lbl}</td><td>{note_lbl}</td><td>{price_lbl}</td><td>{quantity_lbl}</td><td align="right">Total Price</td></tr>{product_loop_start}<tr><td><p>{product_name}<br />{product_attribute}{product_accessory}{product_userfields}</p></td><td>{product_note}{product_thumb_image}</td><td>{product_price}</td><td>{product_quantity}</td><td align="right">{product_total_price}</td></tr>{product_loop_end}</tbody></table></td></tr><tr><td></td></tr><tr><td><table style="width: 100%;" border="0" cellpadding="2" cellspacing="2"><tbody><tr align="left"><td align="left"><strong>{order_subtotal_lbl} : </strong></td><td align="right">{order_subtotal}</td></tr>{if vat}<tr align="left"><td align="left"><strong>{vat_lbl} : </strong></td><td align="right">{order_tax}</td></tr>{vat end if}{if discount}<tr align="left"><td align="left"><strong>{discount_lbl} : </strong></td><td align="right">{order_discount}</td></tr>{discount end if}<tr align="left"><td align="left"><strong>{shipping_lbl} : </strong></td><td align="right">{order_shipping}</td></tr><tr align="left"><td colspan="2" align="left"><hr /></td></tr><tr align="left"><td align="left"><strong>{total_lbl} :</strong></td><td align="right">{order_total}</td></tr><tr align="left"><td colspan="2" align="left"><hr /><br /> <hr /></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table>'; } $print_tag = "<a onclick='window.print();' title='" . JText::_('COM_REDSHOP_PRINT') . "'>" . "<img src=" . JSYSTEM_IMAGES_PATH . "printButton.png alt='" . JText::_('COM_REDSHOP_PRINT') . "' title='" . JText::_('COM_REDSHOP_PRINT') . "' /></a>"; $search[] = "{print}"; $replace[] = $print_tag; $search[] = "{order_id}"; $replace[] = $OrdersDetail[0]->order_id; $search[] = "{order_number}"; $replace[] = $OrdersDetail[0]->order_number; $search[] = "{order_date}"; $replace[] = $config->convertDateFormat($OrdersDetail[0]->cdate); $search[] = "{customer_note}"; $replace[] = $OrdersDetail[0]->customer_note; // set order paymethod name $search[] = "{payment_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_PAYMENT_METHOD'); $search[] = "{payment_method}"; $replace[] = $paymentmethod->order_payment_name; $statustext = $order_functions->getOrderStatusTitle($OrdersDetail[0]->order_status); $issplit = $OrdersDetail[0]->split_payment; $search[] = "{order_status}"; if (trim($OrdersDetail[0]->order_payment_status) == 'Paid') { $orderPaymentStatus = JText::_('PAYMENT_STA_PAID'); } else { if (trim($OrdersDetail[0]->order_payment_status) == 'Unpaid') { $orderPaymentStatus = JText::_('PAYMENT_STA_UNPAID');
public function replaceProductStockdata($product_id, $property_id, $subproperty_id, $data_add, $stockStatusArray) { if (strstr($data_add, "{stock_status")) { $stocktag = strstr($data_add, "{stock_status"); $newstocktag = explode("}", $stocktag); $realstocktag = $newstocktag[0] . "}"; $stock_tag = substr($newstocktag[0], 1); $sts_array = explode(":", $stock_tag); $avail_class = "available_stock_cls"; if (isset($sts_array[1]) && $sts_array[1] != "") { $avail_class = $sts_array[1]; } $out_stock_class = "out_stock_cls"; if (isset($sts_array[2]) && $sts_array[2] != "") { $out_stock_class = $sts_array[2]; } $pre_order_class = "pre_order_cls"; if (isset($sts_array[3]) && $sts_array[3] != "") { $pre_order_class = $sts_array[3]; } if (!$stockStatusArray['regular_stock']) { if ($stockStatusArray['preorder'] && !$stockStatusArray['preorder_stock'] || !$stockStatusArray['preorder']) { $stock_status = "<span id='stock_status_div" . $product_id . "'><div id='" . $out_stock_class . "' class='" . $out_stock_class . "'>" . JText::_('COM_REDSHOP_OUT_OF_STOCK') . "</div></span>"; } else { $stock_status = "<span id='stock_status_div" . $product_id . "'><div id='" . $pre_order_class . "' class='" . $pre_order_class . "'>" . JText::_('COM_REDSHOP_PRE_ORDER') . "</div></span>"; } } else { $stock_status = "<span id='stock_status_div" . $product_id . "'><div id='" . $avail_class . "' class='" . $avail_class . "'>" . JText::_('COM_REDSHOP_AVAILABLE_STOCK') . "</div></span>"; } $data_add = str_replace($realstocktag, $stock_status, $data_add); } if (strstr($data_add, "{stock_notify_flag}")) { $userArr = $this->_session->get('rs_user'); $user_id = $userArr['rs_userid']; $is_login = $userArr['rs_is_user_login']; $users_info_id = $userArr['rs_user_info_id']; $is_notified = $this->isAlreadyNotifiedUser($user_id, $product_id, $property_id, $subproperty_id); if (!$stockStatusArray['regular_stock'] && $is_login && $users_info_id && $user_id) { if ($stockStatusArray['preorder'] && !$stockStatusArray['preorder_stock'] || !$stockStatusArray['preorder']) { if ($is_notified) { $data_add = str_replace("{stock_notify_flag}", "<div id='notify_stock" . $product_id . "'>" . JText::_('COM_REDSHOP_ALREADY_REQUESTED_FOR_NOTIFICATION') . "</div>", $data_add); } else { $data_add = str_replace("{stock_notify_flag}", '<div id="notify_stock' . $product_id . '"><span >' . JText::_('COM_REDSHOP_NOTIFY_STOCK_LBL') . '</span><input type="button" name="" value="' . JText::_('COM_REDSHOP_NOTIFY_STOCK') . '" class="notifystockbtn" title="' . JText::_('COM_REDSHOP_NOTIFY_STOCK_LBL') . '" onclick="getStocknotify(\'' . $product_id . '\',\'' . $property_id . '\', \'' . $subproperty_id . '\');"></div>', $data_add); } } else { $data_add = str_replace("{stock_notify_flag}", "<div id='notify_stock" . $product_id . "'></div>", $data_add); } } else { $data_add = str_replace("{stock_notify_flag}", "<div id='notify_stock" . $product_id . "'></div>", $data_add); } } if (strstr($data_add, "{product_availability_date}")) { $redshopconfig = new Redconfiguration(); $product = $this->getProductById($product_id); if (!$stockStatusArray['regular_stock'] && $stockStatusArray['preorder']) { if ($product->product_availability_date) { $data_add = str_replace("{product_availability_date_lbl}", "<span id='stock_availability_date_lbl" . $product_id . "'>" . JText::_('COM_REDSHOP_PRODUCT_AVAILABILITY_DATE_LBL') . ": </span>", $data_add); $data_add = str_replace("{product_availability_date}", "<span id='stock_availability_date" . $product_id . "'>" . $redshopconfig->convertDateFormat($product->product_availability_date) . "</span>", $data_add); } else { $data_add = str_replace("{product_availability_date_lbl}", "<span id='stock_availability_date_lbl" . $product_id . "'></span>", $data_add); $data_add = str_replace("{product_availability_date}", "<span id='stock_availability_date" . $product_id . "'></span>", $data_add); } } else { $data_add = str_replace("{product_availability_date_lbl}", "<span id='stock_availability_date_lbl" . $product_id . "'></span>", $data_add); $data_add = str_replace("{product_availability_date}", "<span id='stock_availability_date" . $product_id . "'></span>", $data_add); } } return $data_add; }
?> </td> <td align="center"><?php echo JHTML::_('grid.id', $i, $row->id); ?> </td> <td><?php echo $row->name; ?> </td> <td><?php echo $row->email; ?> </td> <td align="center"><?php echo $Redconfiguration->convertDateFormat($row->registerDate); ?> </td> <td align="center"><?php echo $reminder1; ?> </td> <td align="center"><?php echo $reminder2; ?> </td> <td align="center"><?php echo $reminder3; ?> </td> <td align="center"><?php