public function display($tpl = null) { $producthelper = new producthelper(); $option = JRequest::getVar('option'); $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_REDSHOP_ANSWER')); $uri = JFactory::getURI(); $lists = array(); $model = $this->getModel(); $detail = $this->get('data'); $qdetail = $producthelper->getQuestionAnswer($detail->parent_id); if (count($qdetail) > 0) { $qdetail = $qdetail[0]; } $isNew = $detail->question_id < 1; $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT'); JToolBarHelper::title(JText::_('COM_REDSHOP_ANSWER_DETAIL') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_question48'); JToolBarHelper::save(); JToolBarHelper::custom('send', 'send.png', 'send.png', JText::_('COM_REDSHOP_SEND'), false); if ($isNew) { JToolBarHelper::cancel(); } else { JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE')); } $option = $model->getProduct(); $optionsection = array(); $optionsection[0]->product_id = 0; $optionsection[0]->product_name = JText::_('COM_REDSHOP_SELECT'); if (count($option) > 0) { $optionsection = @array_merge($optionsection, $option); } $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published); $lists['product_id'] = JHTML::_('select.genericlist', $optionsection, 'product_id', 'class="inputbox" size="1" ', 'product_id', 'product_name', $detail->product_id); $this->assignRef('lists', $lists); $this->assignRef('detail', $detail); $this->assignRef('qdetail', $qdetail); $this->assignRef('request_url', $uri->toString()); parent::display($tpl); }
</th> <th width="5%"> <?php echo JHTML::_('grid.sort', 'COM_REDSHOP_ID', 'question_id', $this->lists['order_Dir'], $this->lists['order']); ?> </th> </tr> </thead> <?php $k = 0; for ($i = 0, $n = count($this->question); $i < $n; $i++) { $row =& $this->question[$i]; $row->id = $row->question_id; $link = JRoute::_('index.php?option=com_redshop&view=question_detail&task=edit&cid[]=' . $row->id); $anslink = JRoute::_('index.php?option=com_redshop&view=question_detail&task=edit&cid[]=' . $row->id . '#answerlists'); $answer = $producthelper->getQuestionAnswer($row->id, 0, 1); $answer = count($answer); $published = JHtml::_('jgrid.published', $row->published, $i, '', 1); ?> <tr class="<?php echo "row{$k}"; ?> "> <td align="center"><?php echo $this->pagination->getRowOffset($i); ?> </td> <td align="center"><?php echo JHTML::_('grid.id', $i, $row->id); ?> </td>
public function sendAskQuestionMail($ansid) { $producthelper = new producthelper(); $uri = JURI::getInstance(); $url = $uri->root(); $option = JRequest::getVar('option'); $subject = ""; $data_add = ""; $mailbcc = null; $mailinfo = $this->getMailtemplate(0, "ask_question_mail"); $ans = $producthelper->getQuestionAnswer($ansid); if (count($mailinfo) > 0) { $data_add = $mailinfo[0]->mail_body; $subject = $mailinfo[0]->mail_subject; $mailbcc = explode(",", $mailinfo[0]->mail_bcc); } if (count($ans) > 0) { $ans = $ans[0]; $fromname = $ans->user_name; $from = $ans->user_email; $email = explode(",", trim(ADMINISTRATOR_EMAIL)); $question = $ans->question; $answer = ""; $telephone = ""; $address = ""; $product_id = $ans->product_id; if ($ans->parent_id) { $answer = $ans->question; $qdetail = $producthelper->getQuestionAnswer($ans->parent_id); if (count($qdetail) > 0) { $config = JFactory::getConfig(); $from = $config->getValue('mailfrom'); $fromname = $config->getValue('fromname'); $qdetail = $qdetail[0]; $question = $qdetail->question; $email = $qdetail->user_email; $product_id = $qdetail->product_id; $address = $qdetail->address; $telephone = $qdetail->telephone; } } $product = $producthelper->getProductById($product_id); $link = JRoute::_($url . "index.php?option=" . $option . "&view=product&pid=" . $product_id); $data_add = str_replace("{product_name}", $product->product_name, $data_add); $data_add = str_replace("{product_desc}", $product->product_desc, $data_add); $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}", $question, $data_add); $data_add = str_replace("{answer}", $answer, $data_add); $data_add = str_replace("{user_address}", $address, $data_add); $data_add = str_replace("{user_telephone}", $telephone, $data_add); $subject = str_replace("{user_question}", $question, $subject); $subject = str_replace("{shopname}", SHOP_NAME, $subject); $subject = str_replace("{product_name}", $product->product_name, $subject); if ($email) { if (JUtility::sendMail($from, $fromname, $email, $subject, $data_add, $mode = 1, null, $mailbcc)) { return true; } } } return false; }
// Product subscription type ene here // PRODUCT QUESTION START if (strstr($template_desc, "{question_loop_start}") && strstr($template_desc, "{question_loop_end}")) { $qstart = $template_desc; $qmiddle = ""; $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];