Exemple #1
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redshop.cfg.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/configuration.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/template.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/stockroom.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/economic.php';
     require_once JPATH_SITE . '/components/com_redshop/helpers/product.php';
     $Redconfiguration = new Redconfiguration();
     $data = array();
     $where = array();
     $category = array_map('intval', explode('||', $this->_data->get('redshopproductssourcecategory', '')));
     if (!in_array(0, $category) && count($category) > 0) {
         $where[] = 'pr_cat.category_id IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('redshopproductssourcepublished', 1)) {
         $where[] = ' pr.published = 1 ';
     }
     if ($this->_data->get('redshopproductssourcespecial', 0)) {
         $where[] = ' (pr.product_special =  1) ';
     }
     if ($this->_data->get('redshopproductssourceonsale', 0)) {
         $where[] = ' (pr.product_on_sale =  1) ';
     }
     $o = '';
     $order = NextendParse::parse($this->_data->get('redshopproductsorder1', 'pr.product_name|*|asc'));
     if ($order[0]) {
         $o .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('redshopproductsorder2', 'pr.product_name|*|asc'));
         if ($order[0]) {
             $o .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query = "SELECT \r\n                        pr.product_id, \r\n                        pr.published, \r\n                        pr_cat.ordering, \r\n                        pr.product_name as name, \r\n                        pr.product_s_desc as short_description, \r\n                        pr.product_desc as description, \r\n                        man.manufacturer_name as man_name,\r\n                        pr.product_full_image as image, \r\n                        pr.product_thumb_image as image_thumbnail, \r\n                        pr.product_price,\r\n                        cat.category_id,\r\n                        cat.category_name, \r\n                        cat.category_short_description , \r\n                        cat.category_description\r\n                    FROM `#__redshop_product` AS pr\r\n                    LEFT JOIN `#__redshop_product_category_xref` AS pr_cat USING (product_id)\r\n                    LEFT JOIN `#__redshop_category` AS cat USING (category_id)\r\n                    LEFT JOIN `#__redshop_manufacturer` AS man USING(manufacturer_id)\r\n                    WHERE pr.product_parent_id=0 " . (count($where) ? ' AND ' . implode(' AND ', $where) : '') . " " . $o . " LIMIT 0, " . $number;
     $db->setQuery($query);
     $result = $db->loadAssocList();
     $uri = str_replace(array('http://', 'https://'), '//', NextendUri::getBaseUri());
     for ($i = 0; $i < count($result); $i++) {
         $product = new producthelper();
         $result[$i]['title'] = $result[$i]['name'];
         $result[$i]['price'] = $product->getProductFormattedPrice($product->getProductPrice($result[$i]['product_id']));
         $result[$i]['addtocart'] = $result[$i]['url'] = 'index.php?option=com_redshop&view=product&pid=' . $result[$i]['product_id'] . '&cid=' . $result[$i]['category_id'];
         $result[$i]['addtocart_label'] = 'View product';
         $result[$i]['category_url'] = 'index.php?option=com_redshop&view=category&cid=' . $result[$i]['category_id'] . '&layout=detail';
         $result[$i]['thumbnail'] = $result[$i]['image_thumbnail'] = $uri . REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . $result[$i]['image_thumbnail'];
         $result[$i]['image'] = $uri . REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . $result[$i]['image'];
     }
     return $result;
 }
 /**
  * Check for the product ID
  */
 public function check()
 {
     $producthelper = new producthelper();
     $unit = $producthelper->getUnitConversation("m", $discount_calc_unit[$c]);
     $converted_area_start = $this->area_start * $unit * $unit;
     $converted_area_end = $this->area_end * $unit * $unit;
     $query = "SELECT *\n\t\t\t\t\tFROM `" . $this->_table_prefix . "product_discount_calc`\n\t\t\t\t\tWHERE product_id = " . (int) $this->product_id . " AND (" . (int) $converted_area_start . "\n\t\t\t\t\tBETWEEN `area_start_converted`\n\t\t\t\t\tAND `area_end_converted` || " . (int) $converted_area_end . "\n\t\t\t\t\tBETWEEN `area_start_converted`\n\t\t\t\t\tAND `area_end_converted` )";
     $this->_db->setQuery($query);
     $xid = intval($this->_db->loadResult());
     if ($xid) {
         $this->_error = JText::_('COM_REDSHOP_SAME_RANGE');
         return false;
     }
     return true;
 }
Exemple #3
0
    function display($tpl = null)
    {
        $app = JFactory::getApplication();
        $producthelper = new producthelper();
        $pathway = $app->getPathway();
        $document = JFactory::getDocument();
        $user = JFactory::getUser();
        // Preform security checks
        if ($user->id == 0) {
            echo JText::_('COM_REDSHOP_ALERTNOTAUTH_REVIEW');
            return;
        }
        $model = $this->getModel('product_rating');
        $userinfo = $model->getuserfullname($user->id);
        $params = $app->getParams('com_redshop');
        $Itemid = JRequest::getInt('Itemid');
        $product_id = JRequest::getInt('product_id');
        $category_id = JRequest::getInt('category_id');
        $user = JFactory::getUser();
        $model = $this->getModel('product_rating');
        $rate = JRequest::getInt('rate');
        $already_rated = $model->checkRatedProduct($product_id, $user->id);
        if ($already_rated == 1) {
            if ($rate == 1) {
                $msg = JText::_('COM_REDSHOP_YOU_CAN_NOT_REVIEW_SAME_PRODUCT_AGAIN');
                $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $product_id . '&cid=' . $category_id . '&Itemid=' . $Itemid);
                $app->redirect($link, $msg);
            } else {
                echo JText::_('COM_REDSHOP_YOU_CAN_NOT_REVIEW_SAME_PRODUCT_AGAIN');
                ?>
			<span id="closewindow"><input type="button" value="Close Window" onclick="window.parent.redBOX.close();"/></span>
			<script>
				setTimeout("window.parent.redBOX.close();", 2000);
			</script>
			<?php 
                return;
            }
        }
        $productinfo = $producthelper->getProductById($product_id);
        $this->user = $user;
        $this->userinfo = $userinfo;
        $this->product_id = $product_id;
        $this->rate = $rate;
        $this->category_id = $category_id;
        $this->productinfo = $productinfo;
        $this->params = $params;
        parent::display($tpl);
    }
Exemple #4
0
    function display($tpl = null)
    {
        $app = JFactory::getApplication();
        $order_functions = new order_functions();
        $print = JRequest::getInt('print');
        if ($print) {
            ?>
		<script type="text/javascript" language="javascript">
			window.print();
		</script>
	<?php 
        }
        $params = $app->getParams('com_redshop');
        $prodhelperobj = new producthelper();
        $prodhelperobj->generateBreadcrumb();
        $user = JFactory::getUser();
        $session = JFactory::getSession();
        $order_id = $session->get('order_id');
        $oid = JRequest::getInt('oid', $order_id);
        $encr = JRequest::getString('encr');
        $layout = JRequest::getCmd('layout');
        $model = $this->getModel('order_detail');
        $OrdersDetail = $order_functions->getOrderDetails($oid);
        if ($user->id) {
            if ($OrdersDetail->user_id != $user->id) {
                $app->Redirect('index.php?option=com_redshop&view=login&Itemid=' . JRequest::getInt('Itemid'));
                return;
            }
        } else {
            if (isset($encr)) {
                $authorization = $model->checkauthorization($oid, $encr);
                if (!$authorization) {
                    JError::raiseWarning(404, JText::_('COM_REDSHOP_ORDER_ENCKEY_FAILURE'));
                    echo JText::_('COM_REDSHOP_ORDER_ENCKEY_FAILURE');
                    return false;
                }
            } elseif (!$user->id) {
                $app->Redirect('index.php?option=com_redshop&view=login&Itemid=' . JRequest::getInt('Itemid'));
                return;
            }
        }
        $this->OrdersDetail = $OrdersDetail;
        $this->user = $user;
        $this->params = $params;
        parent::display($tpl);
    }
Exemple #5
0
 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;
         }
     }
 }
Exemple #6
0
 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;
 }
 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);
 }
Exemple #8
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     // Preform security checks
     if ($user->id == 0) {
         $app->Redirect('index.php?option=com_redshop&view=login&Itemid=' . JRequest::getInt('Itemid'));
         exit;
     }
     $layout = JRequest::getCmd('layout', 'default');
     $this->setLayout($layout);
     $params = $app->getParams('com_redshop');
     $prodhelperobj = new producthelper();
     $prodhelperobj->generateBreadcrumb();
     // Request variables
     $limit = $app->getUserStateFromRequest('com_redshop' . 'limit', 'limit', 10, 'int');
     $limitstart = JRequest::getInt('limitstart', 0, '', 'int');
     $detail = $this->get('data');
     $this->pagination = $this->get('Pagination');
     $this->detail = $detail;
     $this->params = $params;
     parent::display($tpl);
 }
Exemple #9
0
 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;
         }
     }
 }
Exemple #10
0
 private static function getProductDetail($id)
 {
     $component = JComponentHelper::getComponent("com_redshop");
     if (!isset($component->id)) {
         JError::raiseError('500', 'redShop Component is not installed');
     }
     if (!defined('TABLE_PREFIX')) {
         require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redshop.cfg.php';
     }
     require_once JPATH_SITE . '/components/com_redshop/helpers/helper.php';
     $objhelper = new redhelper();
     $producthelper = new producthelper();
     $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $id);
     if (count($ItemData) > 0) {
         $pItemid = $ItemData->id;
     } else {
         $pItemid = $objhelper->getItemid($id);
     }
     $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $id . '&Itemid=' . $pItemid);
     $product = $producthelper->getProductById($id);
     $product->product_price = $producthelper->getProductPrice($id);
     $product->link = $link;
     return $product;
 }
Exemple #11
0
function display_products($rows)
{
    $url = JURI::base();
    $extra_data = new producthelper();
    $producthelper = new producthelper();
    for ($i = 0; $i < count($rows); $i++) {
        $row = $rows[$i];
        $Itemid = $this->redHelper->getItemid($row->product_id);
        $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&Itemid=' . $Itemid);
        $product_price = $producthelper->getProductPrice($row->product_id);
        $productArr = $producthelper->getProductNetPrice($row->product_id);
        $product_price_discount = $productArr['productPrice'] + $productArr['productVat'];
        if ($row->product_full_image) {
            echo $thum_image = "<div class='mod_wishlist_product_image' >" . ($thum_image = $producthelper->getProductImage($row->product_id, $link, "100", "100") . "\n\t\t\t</div>");
        }
        echo "<a href='" . $link . "'>" . $row->product_name . "</a><br>";
        if ($row->product_on_sale && $product_price_discount > 0) {
            if ($product_price > $product_price_discount) {
                $s_price = $product_price - $product_price_discount;
                if ($this->show_discountpricelayout) {
                    echo "<div id='mod_redoldprice' class='mod_redoldprice'><span style='text-decoration:line-through;'>" . $producthelper->getProductFormattedPrice($product_price) . "</span></div>";
                    $product_price = $product_price_discount;
                    echo "<div id='mod_redmainprice' class='mod_redmainprice'>" . $producthelper->getProductFormattedPrice($product_price_discount) . "</div>";
                    echo "<div id='mod_redsavedprice' class='mod_redsavedprice'>" . JText::_('COM_REDSHOP_PRODCUT_PRICE_YOU_SAVED') . ' ' . $producthelper->getProductFormattedPrice($s_price) . "</div>";
                } else {
                    $product_price = $product_price_discount;
                    echo "<div class='mod_redproducts_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>";
                }
            } else {
                echo "<div class='mod_redproducts_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>";
            }
        } else {
            echo "<div class='mod_redproducts_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>";
        }
        echo "<br><a href='" . $link . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>&nbsp;";
        echo $addtocartdata = $producthelper->replaceCartTemplate($row->product_id);
        echo "<div>" . $addtocartdata . "</div>";
    }
}
Exemple #12
0
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
require_once JPATH_ROOT . '/administrator/components/com_redshop/helpers/images.php';
JHTML::_('behavior.tooltip');
$editor = JFactory::getEditor();
JHTMLBehavior::modal();
$uri = JURI::getInstance();
$url = $uri->root();
JHTML::_('behavior.calendar');
jimport('joomla.html.pane');
$objhelper = new redhelper();
$producthelper = new producthelper();
?>
<script language="javascript" type="text/javascript">
	Joomla.submitbutton = function (pressbutton) {
		submitbutton(pressbutton);
	}

	submitbutton = function (pressbutton) {
		var form = document.adminForm;
		if (pressbutton == 'cancel') {
			submitform(pressbutton);
			return;
		}
		if (form.category_name.value == "") {
			alert("<?php 
echo JText::_('COM_REDSHOP_CATEGORY_ITEM_MUST_HAVE_A_NAME', true);
Exemple #13
0
 /**
  * Generate product search output
  */
 public function onRSProductSearch()
 {
     if (count($this->search) > 0) {
         $app = JFactory::getApplication();
         require_once JPATH_COMPONENT . '/helpers/product.php';
         require_once JPATH_COMPONENT . '/helpers/pagination.php';
         require_once JPATH_COMPONENT . '/helpers/extra_field.php';
         require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/text_library.php';
         $dispatcher = JDispatcher::getInstance();
         $redTemplate = new Redtemplate();
         $Redconfiguration = new Redconfiguration();
         $producthelper = new producthelper();
         $extraField = new extraField();
         $texts = new text_library();
         $stockroomhelper = new rsstockroomhelper();
         $Itemid = JRequest::getInt('Itemid');
         $search_type = JRequest::getCmd('search_type');
         $cid = JRequest::getInt('category_id');
         $manisrch = $this->search;
         $manufacture_id = $manisrch[0]->manufacturer_id;
         $templateid = JRequest::getInt('templateid');
         // Cmd removes space between to words
         $keyword = JRequest::getWord('keyword');
         $layout = JRequest::getCmd('layout', 'default');
         $db = JFactory::getDbo();
         $query = 'SELECT category_name' . ' FROM #__redshop_category  ' . 'WHERE category_id=' . JRequest::getInt('cid');
         $db->setQuery($query);
         $cat_name = null;
         if ($catname_array = $db->loadObjectList()) {
             $cat_name = $catname_array[0]->category_name;
         }
         $session = JFactory::getSession();
         $model = $this->getModel('search');
         $limit = $this->limit;
         $limitstart = JRequest::getInt('limitstart', 0);
         $total = $model->_total;
         JHTML::_('behavior.tooltip');
         JHTMLBehavior::modal();
         $url = JURI::base();
         if ($this->params->get('page_title') != "") {
             $pagetitle = $this->params->get('page_title');
         } else {
             $pagetitle = JText::_('COM_REDSHOP_SEARCH');
         }
         if ($this->params->get('show_page_heading', 1)) {
             echo '<h1 class="componentheading' . $this->escape($this->params->get('pageclass_sfx')) . '">';
             echo $pagetitle;
             echo '</h1>';
         }
         echo '<div style="clear:both"></div>';
         $category_tmpl = "";
         if (count($this->templatedata) > 0 && $this->templatedata[0]->template_desc != "") {
             $template_desc = $this->templatedata[0]->template_desc;
         } else {
             $template_desc = "<div class=\"category_print\">{print}</div>\r\n<div style=\"clear: both;\"></div>\r\n<div class=\"category_main_description\">{category_main_description}</div>\r\n<p>{if subcats} {category_loop_start}</p>\r\n<div id=\"categories\">\r\n<div style=\"float: left; width: 200px;\">\r\n<div class=\"category_image\">{category_thumb_image}</div>\r\n<div class=\"category_description\">\r\n<h2 class=\"category_title\">{category_name}</h2>\r\n{category_description}</div>\r\n</div>\r\n</div>\r\n<p>{category_loop_end} {subcats end if}</p>\r\n<div style=\"clear: both;\"></div>\r\n<div id=\"category_header\">\r\n<div class=\"category_order_by\">{order_by}</div>\r\n</div>\r\n<div class=\"category_box_wrapper\">{product_loop_start}\r\n<div class=\"category_box_outside\">\r\n<div class=\"category_box_inside\">\r\n<div class=\"category_product_image\">{product_thumb_image}</div>\r\n<div class=\"category_product_title\">\r\n<h3>{product_name}</h3>\r\n</div>\r\n<div class=\"category_product_price\">{product_price}</div>\r\n<div class=\"category_product_readmore\">{read_more}</div>\r\n<div>{product_rating_summary}</div>\r\n<div class=\"category_product_addtocart\">{form_addtocart:add_to_cart1}</div>\r\n</div>\r\n</div>\r\n{product_loop_end}\r\n<div class=\"category_product_bottom\" style=\"clear: both;\"></div>\r\n</div>\r\n<div class=\"category_pagination\">{pagination}</div>";
         }
         if (strstr($template_desc, "{product_display_limit}")) {
             $endlimit = $model->getProductPerPage();
             $limit = JRequest::getInt('limit', $endlimit, '', 'int');
         }
         $template_org = $template_desc;
         $template_d1 = explode("{category_loop_start}", $template_org);
         if (count($template_d1) > 1) {
             $template_d2 = explode("{category_loop_end}", $template_d1[1]);
             if (count($template_d2) > 0) {
                 $category_tmpl = $template_d2[0];
             }
         }
         $template_org = str_replace($category_tmpl, "", $template_org);
         $template_org = str_replace("{category_loop_start}", "", $template_org);
         $template_org = str_replace("{category_loop_end}", "", $template_org);
         $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?option=com_redshop&view=search&print=1&tmpl=component";
             $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>";
         }
         $template_org = str_replace("{total_product}", count($this->search), $template_org);
         $template_org = str_replace("{total_product_lbl}", JText::_('COM_REDSHOP_TOTAL_PRODUCT'), $template_org);
         if (strstr($template_org, "{compare_product_div}")) {
             $compare_product_div = "";
             if (PRODUCT_COMPARISON_TYPE != "") {
                 $comparediv = $producthelper->makeCompareProductDiv();
                 $compareUrl = JRoute::_('index.php?option=com_redshop&view=product&layout=compare&Itemid=' . $Itemid);
                 $compare_product_div = "<form name='frmCompare' method='post' action='" . $compareUrl . "' >";
                 $compare_product_div .= "<a href='javascript:compare();' >" . JText::_('COM_REDSHOP_COMPARE') . "</a>";
                 $compare_product_div .= "<div id='divCompareProduct'>" . $comparediv . "</div>";
                 $compare_product_div .= "</form>";
             }
             $template_org = str_replace("{compare_product_div}", $compare_product_div, $template_org);
         }
         // Skip html if nosubcategory
         if (strstr($template_org, "{if subcats}")) {
             $template_d1 = explode("{if subcats}", $template_org);
             $template_d2 = explode("{subcats end if}", $template_d1[1]);
             $template_org = $template_d1[0] . $template_d2[1];
         }
         // End skip html if nosubcategory
         $template_org = str_replace("{print}", $print_tag, $template_org);
         $template_org = str_replace("{product_price_slider}", '', $template_org);
         $template_org = str_replace("{filter_by}", '', $template_org);
         $template_org = str_replace("{template_selector_category_lbl}", '', $template_org);
         $template_org = str_replace("{template_selector_category}", '', $template_org);
         $template_org = str_replace("{category_main_description}", '', $template_org);
         $template_org = str_replace("{category_main_name}", $cat_name, $template_org);
         $template_org = str_replace("{category_description}", '', $template_org);
         $template_org = str_replace("{category_short_desc}", '', $template_org);
         $template_org = str_replace("{category_name}", '', $template_org);
         $template_org = str_replace("{if subcats}", '', $template_org);
         $template_org = str_replace("{subcats end if}", '', $template_org);
         $template_org = str_replace("{category_main_thumb_image_3}", '', $template_org);
         $template_org = str_replace("{category_main_short_desc}", '', $template_org);
         $template_org = str_replace("{category_main_thumb_image_2}", '', $template_org);
         $template_org = str_replace("{category_main_thumb_image_1}", '', $template_org);
         $template_org = str_replace("{category_main_thumb_image}", '', $template_org);
         $template_org = str_replace("{attribute_price_without_vat}", '', $template_org);
         $template_org = str_replace("{redproductfinderfilter_formstart}", '', $template_org);
         $template_org = str_replace("{redproductfinderfilter:rp_myfilter}", '', $template_org);
         $template_org = str_replace("{redproductfinderfilter_formend}", '', $template_org);
         // Replace redproductfilder filter tag
         if (strstr($template_org, "{redproductfinderfilter:")) {
             $redProductFinerHelper = JPATH_SITE . "/components/com_redproductfinder/helpers/redproductfinder_helper.php";
             if (file_exists($redProductFinerHelper)) {
                 include_once $redProductFinerHelper;
                 $redproductfinder_helper = new redproductfinder_helper();
                 $hdnFields = array('texpricemin' => '0', 'texpricemax' => '0', 'manufacturer_id' => $filter_by, 'category_template' => $templateid);
                 $hide_filter_flag = false;
                 if ($this->_id) {
                     $prodctofcat = $producthelper->getProductCategory($this->_id);
                     if (empty($prodctofcat)) {
                         $hide_filter_flag = true;
                     }
                 }
                 $template_org = $redproductfinder_helper->replaceProductfinder_tag($template_org, $hdnFields, $hide_filter_flag);
             }
         }
         // Replace redproductfilder filter tag end here
         $template_d1 = explode("{product_loop_start}", $template_org);
         $template_d2 = explode("{product_loop_end}", $template_d1[1]);
         $template_tmp_desc = $template_d2[0];
         $template_desc = $template_d2[0];
         // Order By
         $order_by = "";
         $orderby_form = "<form name='orderby_form' action='' method='post' >";
         $orderby_form .= $this->lists['order_select'];
         $orderby_form .= "<input type='hidden' name='view' value='search'>\n\t\t\t<input type='hidden' name='layout' value='{$layout}'>\n\t\t\t<input type='hidden' name='keyword' value='{$keyword}'>\n\t\t\t<input type='hidden' name='category_id' value='{$cid}'>\n\t\t\t<input type='hidden' name='manufacture_id' value='{$manufacture_id}'>\n\t\t\t<input type='hidden' name='templateid' value='{$templateid}'></form>";
         if (strstr($template_desc, '{order_by}')) {
             $order_by = $orderby_form;
         }
         $extraFieldName = $extraField->getSectionFieldNameArray(1, 1, 1);
         $attribute_template = $producthelper->getAttributeTemplate($template_desc);
         $total_product = $model->_total;
         $endlimit = $this->limit;
         $start = JRequest::getInt('limitstart', 0, '', 'int');
         if (strstr($template_org, "{pagination}")) {
             if (strstr($template_org, "{product_display_limit}")) {
                 $endlimit = JRequest::getInt('limit', $endlimit, '', 'int');
             }
         } else {
             $endlimit = $model->getData();
         }
         if ($endlimit == 0) {
             $final_endlimit = $total_product;
         } else {
             $final_endlimit = $endlimit;
         }
         $tagarray = $texts->getTextLibraryTagArray();
         $data = "";
         $count_no_user_field = 0;
         for ($i = 0; $i < count($this->search); $i++) {
             $data_add = "";
             $thum_image = "";
             $pname = $Redconfiguration->maxchar($this->search[$i]->product_name, CATEGORY_PRODUCT_TITLE_MAX_CHARS, CATEGORY_PRODUCT_TITLE_END_SUFFIX);
             if ($search_type == 'product_number') {
                 $product_number = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $this->search[$i]->product_number);
                 $pro_s_desc = $this->search[$i]->product_s_desc;
                 $pro_desc = $this->search[$i]->product_desc;
             } else {
                 $product_number = $this->search[$i]->product_number;
                 $pro_s_desc = $this->search[$i]->product_s_desc;
                 $pro_desc = $this->search[$i]->product_desc;
                 if (!in_array($keyword, $tagarray)) {
                     $pname = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $pname);
                     $pro_s_desc = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $pro_s_desc);
                     $pro_desc = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $pro_desc);
                 }
             }
             $pro_s_desc = $Redconfiguration->maxchar($pro_s_desc, CATEGORY_PRODUCT_DESC_MAX_CHARS, CATEGORY_PRODUCT_DESC_END_SUFFIX);
             $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $this->search[$i]->product_id . '&Itemid=' . $Itemid);
             if (strstr($template_desc, '{product_name}')) {
                 $pname = "<a href='" . $link . "'>" . $pname . "</a>";
                 $data_add = str_replace("{product_name}", $pname, $template_desc);
             }
             if (strstr($template_desc, '{product_name_nolink}')) {
                 $data_add = str_replace("{product_name_nolink}", $pname, $template_desc);
             }
             $readmore = "<a href='" . $link . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>";
             $data_add = str_replace("{read_more}", $readmore, $data_add);
             $data_add = str_replace("{read_more_link}", $link, $data_add);
             // RedSHOP Product Plugin
             JPluginHelper::importPlugin('redshop_product');
             $results = $dispatcher->trigger('onPrepareProduct', array(&$data_add, &$params, $this->search[$i]));
             // End
             if (strstr($data_add, "{product_delivery_time}")) {
                 $product_delivery_time = $producthelper->getProductMinDeliveryTime($this->search[$i]->product_id);
                 if ($product_delivery_time != "") {
                     $data_add = str_replace("{delivery_time_lbl}", JText::_('DELIVERY_TIME'), $data_add);
                     $data_add = str_replace("{product_delivery_time}", $product_delivery_time, $data_add);
                 } else {
                     $data_add = str_replace("{delivery_time_lbl}", "", $data_add);
                     $data_add = str_replace("{product_delivery_time}", "", $data_add);
                 }
             }
             // Product Review/Rating
             // Fetching reviews
             $final_avgreview_data = $producthelper->getProductRating($this->search[$i]->product_id);
             // Attribute ajax chage
             $data_add = str_replace("{product_rating_summary}", $final_avgreview_data, $data_add);
             $data_add = $producthelper->getJcommentEditor($this->search[$i], $data_add);
             $data_add = $producthelper->getExtraSectionTag($extraFieldName, $this->search[$i]->product_id, "1", $data_add, 1);
             $data_add = str_replace("{product_s_desc}", $pro_s_desc, $data_add);
             $data_add = str_replace("{product_desc}", $pro_desc, $data_add);
             $data_add = str_replace("{product_id_lbl}", JText::_('COM_REDSHOP_PRODUCT_ID_LBL'), $data_add);
             $data_add = str_replace("{product_id}", $this->search[$i]->product_id, $data_add);
             $data_add = str_replace("{product_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER_LBL'), $data_add);
             $data_add = str_replace("{product_number}", $product_number, $data_add);
             /**
              * related Product List in Lightbox
              * Tag Format = {related_product_lightbox:<related_product_name>[:width][:height]}
              */
             if (strstr($data_add, '{related_product_lightbox:')) {
                 $related_product = $producthelper->getRelatedProduct($this->search[$i]->product_id);
                 $rtlnone = explode("{related_product_lightbox:", $data_add);
                 $rtlntwo = explode("}", $rtlnone[1]);
                 $rtlnthree = explode(":", $rtlntwo[0]);
                 $rtln = $rtlnthree[0];
                 $rtlnfwidth = isset($rtlnthree[1]) ? $rtlnthree[1] : "900";
                 $rtlnwidthtag = isset($rtlnthree[1]) ? ":" . $rtlnthree[1] : "";
                 $rtlnfheight = isset($rtlnthree[2]) ? $rtlnthree[2] : "600";
                 $rtlnheighttag = isset($rtlnthree[2]) ? ":" . $rtlnthree[2] : "";
                 $rtlntag = "{related_product_lightbox:{$rtln}{$rtlnwidthtag}{$rtlnheighttag}}";
                 if (count($related_product) > 0) {
                     $linktortln = JUri::root() . "index.php?option=com_redshop&view=product&pid=" . $this->search[$i]->product_id . "&tmpl=component&template=" . $rtln . "&for=rtln";
                     $rtlna = '<a class="modal" href="' . $linktortln . '" rel="{handler:\'iframe\',size:{x:' . $rtlnfwidth . ',y:' . $rtlnfheight . '}}" >' . JText::_('COM_REDSHOP_RELATED_PRODUCT_LIST_IN_LIGHTBOX') . '</a>';
                 } else {
                     $rtlna = "";
                 }
                 $data_add = str_replace($rtlntag, $rtlna, $data_add);
             }
             $data_add = $producthelper->replaceVatinfo($data_add);
             /************************************
              *  Conditional tag
              *  if product on discount : Yes
              *  {if product_on_sale} This product is on sale {product_on_sale end if} // OUTPUT : This product is on sale
              *  NO : // OUTPUT : Display blank
              ************************************/
             $data_add = $producthelper->getProductOnSaleComment($this->search[$i], $data_add);
             $data_add = $stockroomhelper->replaceStockroomAmountDetail($data_add, $this->search[$i]->product_id);
             if (strstr($data_add, "{product_thumb_image_3}")) {
                 $cimg_tag = '{product_thumb_image_3}';
                 $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT_3;
                 $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH_3;
             } elseif (strstr($data_add, "{product_thumb_image_2}")) {
                 $cimg_tag = '{product_thumb_image_2}';
                 $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT_2;
                 $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH_2;
             } elseif (strstr($data_add, "{product_thumb_image_1}")) {
                 $cimg_tag = '{product_thumb_image_1}';
                 $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT;
                 $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH;
             } else {
                 $cimg_tag = '{product_thumb_image}';
                 $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT;
                 $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH;
             }
             $hidden_thumb_image = "<input type='hidden' name='prd_main_imgwidth' id='prd_main_imgwidth' value='" . $cw_thumb . "'><input type='hidden' name='prd_main_imgheight' id='prd_main_imgheight' value='" . $ch_thumb . "'>";
             $thum_image = $producthelper->getProductImage($this->search[$i]->product_id, $link, $cw_thumb, $ch_thumb);
             $data_add = str_replace($cimg_tag, $thum_image . $hidden_thumb_image, $data_add);
             // More documents
             if (strstr($data_add, "{more_documents}")) {
                 $media_documents = $producthelper->getAdditionMediaImage($this->search[$i]->product_id, "product", "document");
                 $more_doc = '';
                 for ($m = 0; $m < count($media_documents); $m++) {
                     $alttext = $producthelper->getAltText("product", $media_documents[$m]->section_id, "", $media_documents[$m]->media_id, "document");
                     if (!$alttext) {
                         $alttext = $media_documents[$m]->media_name;
                     }
                     if (is_file(REDSHOP_FRONT_DOCUMENT_RELPATH . "product/" . $media_documents[$m]->media_name)) {
                         $downlink = JUri::root() . 'index.php?tmpl=component&option=com_redshop&view=product&pid=' . $this->search[$i]->product_id . '&task=downloadDocument&fname=' . $media_documents[$m]->media_name . '&Itemid=' . $Itemid;
                         $more_doc .= "<div><a href='" . $downlink . "' title='" . $alttext . "'>";
                         $more_doc .= $alttext;
                         $more_doc .= "</a></div>";
                     }
                 }
                 $data_add = str_replace("{more_documents}", "<span id='additional_docs" . $this->search[$i]->product_id . "'>" . $more_doc . "</span>", $data_add);
             }
             // More documents end
             /************************************************ user fields*******************************************************/
             $hidden_userfield = "";
             $returnArr = $producthelper->getProductUserfieldFromTemplate($data_add);
             $template_userfield = $returnArr[0];
             $userfieldArr = $returnArr[1];
             $count_no_user_field = 0;
             if ($template_userfield != "") {
                 $ufield = "";
                 for ($ui = 0; $ui < count($userfieldArr); $ui++) {
                     $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', '', 0, $this->search[$i]->product_id);
                     $ufield .= $product_userfileds[1];
                     if ($product_userfileds[1] != "") {
                         $count_no_user_field++;
                     }
                     $data_add = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $data_add);
                     $data_add = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $data_add);
                 }
                 $product_userfileds_form = "<form method='post' action='' id='user_fields_form_" . $this->search[$i]->product_id . "' name='user_fields_form_" . $this->search[$i]->product_id . "'>";
                 if ($ufield != "") {
                     $data_add = str_replace("{if product_userfield}", $product_userfileds_form, $data_add);
                     $data_add = str_replace("{product_userfield end if}", "</form>", $data_add);
                 } else {
                     $data_add = str_replace("{if product_userfield}", "", $data_add);
                     $data_add = str_replace("{product_userfield end if}", "", $data_add);
                 }
             } elseif (AJAX_CART_BOX) {
                 $ajax_detail_template_desc = "";
                 $ajax_detail_template = $producthelper->getAjaxDetailboxTemplate($this->search[$i]);
                 if (count($ajax_detail_template) > 0) {
                     $ajax_detail_template_desc = $ajax_detail_template->template_desc;
                 }
                 $returnArr = $producthelper->getProductUserfieldFromTemplate($ajax_detail_template_desc);
                 $template_userfield = $returnArr[0];
                 $userfieldArr = $returnArr[1];
                 if ($template_userfield != "") {
                     $ufield = "";
                     for ($ui = 0; $ui < count($userfieldArr); $ui++) {
                         $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', '', 0, $this->search[$i]->product_id);
                         $ufield .= $product_userfileds[1];
                         if ($product_userfileds[1] != "") {
                             $count_no_user_field++;
                         }
                         $template_userfield = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $template_userfield);
                         $template_userfield = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $template_userfield);
                     }
                     if ($ufield != "") {
                         $hidden_userfield = "<div style='display:none;'><form method='post' action='' id='user_fields_form_" . $this->search[$i]->product_id . "' name='user_fields_form_" . $this->search[$i]->product_id . "'>" . $template_userfield . "</form></div>";
                     }
                 }
             }
             $data_add = $data_add . $hidden_userfield;
             /*************** end user fields ***************/
             // ProductFinderDatepicker Extra Field Start
             $fieldArray = $extraField->getSectionFieldList(17, 0, 0);
             $data_add = $producthelper->getProductFinderDatepickerValue($data_add, $this->search[$i]->product_id, $fieldArray);
             // ProductFinderDatepicker Extra Field End
             /*
              * manufacturer data
              */
             $manufacturer_id = $this->search[$i]->manufacturer_id;
             if ($manufacturer_id != 0) {
                 $manufacturer_data = $producthelper->getSection("manufacturer", $manufacturer_id);
                 $manufacturer_link_href = JRoute::_('index.php?option=com_redshop&view=manufacturers&layout=detail&mid=' . $manufacturer_id . '&Itemid=' . $Itemid);
                 $manufacturer_name = "";
                 if (count($manufacturer_data) > 0) {
                     $manufacturer_name = $manufacturer_data->manufacturer_name;
                 }
                 $manufacturer_link = '<a href="' . $manufacturer_link_href . '" title="' . $manufacturer_name . '">' . $manufacturer_name . '</a>';
                 if (strstr($data_add, "{manufacturer_link}")) {
                     $data_add = str_replace("{manufacturer_name}", "", $data_add);
                 } else {
                     $data_add = str_replace("{manufacturer_name}", $manufacturer_name, $data_add);
                 }
                 $data_add = str_replace("{manufacturer_link}", $manufacturer_link, $data_add);
             } else {
                 $data_add = str_replace("{manufacturer_link}", "", $data_add);
                 $data_add = str_replace("{manufacturer_name}", "", $data_add);
             }
             // End
             // Replace wishlistbutton
             $data_add = $producthelper->replaceWishlistButton($this->search[$i]->product_id, $data_add);
             // Replace compare product button
             $data_add = $producthelper->replaceCompareProductsButton($this->search[$i]->product_id, 0, $data_add);
             // Checking for child products
             $childproduct = $producthelper->getChildProduct($this->search[$i]->product_id);
             if (count($childproduct) > 0) {
                 $isChilds = true;
                 $attributes = array();
             } else {
                 $isChilds = false;
                 // Get attributes
                 $attributes_set = array();
                 if ($this->search[$i]->attribute_set_id > 0) {
                     $attributes_set = $producthelper->getProductAttribute(0, $this->search[$i]->attribute_set_id, 0, 1);
                 }
                 $attributes = $producthelper->getProductAttribute($this->search[$i]->product_id);
                 $attributes = array_merge($attributes, $attributes_set);
             }
             // Product attribute  Start
             $totalatt = count($attributes);
             // Check product for not for sale
             $data_add = $producthelper->getProductNotForSaleComment($this->search[$i], $data_add, $attributes);
             $data_add = $producthelper->replaceProductInStock($this->search[$i]->product_id, $data_add, $attributes, $attribute_template);
             $data_add = $producthelper->replaceAttributeData($this->search[$i]->product_id, 0, 0, $attributes, $data_add, $attribute_template, $isChilds);
             // Cart Template
             $data_add = $producthelper->replaceCartTemplate($this->search[$i]->product_id, 0, 0, 0, $data_add, $isChilds, $userfieldArr, $totalatt, 0, $count_no_user_field, "");
             $data .= $data_add;
         }
         $app = JFactory::getApplication();
         $router = $app->getRouter();
         $getorderby = JRequest::getVar('order_by', DEFAULT_PRODUCT_ORDERING_METHOD);
         $vars = array('option' => 'com_redshop', 'view' => 'search', 'layout' => $layout, 'keyword' => $keyword, 'manufacture_id' => $manufacture_id, 'order_by' => $getorderby, 'category_id' => $cid, 'Itemid' => $Itemid, 'limit' => $limit);
         $router->setVars($vars);
         unset($vars);
         if (strstr($template_org, "{pagination}")) {
             $pagination = new redPagination($total_product, $start, $endlimit);
             $slidertag = $pagination->getPagesLinks();
             if (strstr($template_org, "{product_display_limit}")) {
                 $slidertag = "<form action='' method='post'><input type='hidden' name='keyword' value='{$keyword}'>\n\t\t\t<input type='hidden' name='category_id' value='{$cid}'>\n\t\t\t<input type='hidden' name='manufacture_id' value='{$manufacture_id}'>\n\t\t\t<input type='hidden' name='templateid' value='{$templateid}'> " . $pagination->getListFooter() . "</form>";
                 $template_org = str_replace("{product_display_limit}", $slidertag, $template_org);
                 $template_org = str_replace("{pagination}", '', $template_org);
             }
             $template_org = str_replace("{pagination}", $slidertag, $template_org);
         }
         $template_org = str_replace("{product_display_limit}", "", $template_org);
         if (strstr($template_org, "perpagelimit:")) {
             $perpage = explode('{perpagelimit:', $template_org);
             $perpage = explode('}', $perpage[1]);
             $template_org = str_replace("{perpagelimit:" . intval($perpage[0]) . "}", "", $template_org);
         }
         $template_org = str_replace("{order_by}", $orderby_form, $template_org);
         $template_org = str_replace("{order_by_lbl}", JText::_('COM_REDSHOP_SELECT_ORDER_BY'), $template_org);
         $template_org = str_replace("{filter_by_lbl}", JText::_('COM_REDSHOP_SELECT_FILTER_BY'), $template_org);
         $template_org = str_replace("{attribute_price_with_vat}", "", $template_org);
         $template_org = str_replace("{attribute_price_without_vat}", "", $template_org);
         $template_org = str_replace("{product_loop_start}", "", $template_org);
         $template_org = str_replace("{product_loop_end}", "", $template_org);
         $template_org = str_replace($template_tmp_desc, $data, $template_org);
         $template_org = str_replace("{with_vat}", "", $template_org);
         $template_org = str_replace("{without_vat}", "", $template_org);
         $template_org = $redTemplate->parseredSHOPplugin($template_org);
         $template_org = $texts->replace_texts($template_org);
         eval("?>" . $template_org . "<?php ");
     } else {
         echo "<br><h3>" . JText::_('COM_REDSHOP_MSG_SORRY_NO_RESULT_FOUND') . "</h3>";
     }
 }
 public function store($postdata)
 {
     $redshopMail = new redshopMail();
     $order_functions = new order_functions();
     $helper = new redhelper();
     $producthelper = new producthelper();
     $rsCarthelper = new rsCarthelper();
     $shippinghelper = new shipping();
     $adminproducthelper = new adminproducthelper();
     $stockroomhelper = new rsstockroomhelper();
     // For barcode generation
     $barcode_code = $order_functions->barcode_randon_number(12, 0);
     $postdata['barcode'] = $barcode_code;
     $row = $this->getTable('order_detail');
     if (!$row->bind($postdata)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $iscrm = $helper->isredCRM();
     if ($iscrm) {
         $postdata['order_id'] = $row->order_id;
         $postdata['debitor_id'] = $postdata['user_info_id'];
         JTable::addIncludePath(REDCRM_ADMIN . '/tables');
         $crmorder =& $this->getTable('crm_order');
         if (!$crmorder->bind($postdata)) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         if (!$crmorder->store()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         // Update rma table entry
         if (ENABLE_RMA && isset($postdata['rmanotes'])) {
             $rmaInfo = $this->getTable('rma_orders');
             $rmaInfo->rma_number = $postdata['rma_number'];
             $rmaInfo->original_order_id = $postdata['main_order_id'];
             $rmaInfo->credit_note_order_id = $row->order_id;
             $rmaInfo->rma_note = $postdata['rmanotes'];
             $rmaInfo->store();
         }
         JTable::addIncludePath(REDSHOP_ADMIN . '/tables');
     }
     $order_shipping = explode("|", $shippinghelper->decryptShipping(str_replace(" ", "+", $row->ship_method_id)));
     $rowOrderStatus =& $this->getTable('order_status_log');
     $rowOrderStatus->order_id = $row->order_id;
     $rowOrderStatus->order_status = $row->order_status;
     $rowOrderStatus->date_changed = time();
     $rowOrderStatus->customer_note = $row->customer_note;
     $rowOrderStatus->store();
     $billingaddresses = $order_functions->getBillingAddress($row->user_id);
     if (isset($postdata['billisship']) && $postdata['billisship'] == 1) {
         $shippingaddresses = $billingaddresses;
     } else {
         $key = 0;
         $shippingaddresses = $order_functions->getShippingAddress($row->user_id);
         $shipp_users_info_id = isset($postdata['shipp_users_info_id']) && $postdata['shipp_users_info_id'] != 0 ? $postdata['shipp_users_info_id'] : 0;
         if ($shipp_users_info_id != 0) {
             for ($o = 0; $o < count($shippingaddresses); $o++) {
                 if ($shippingaddresses[$o]->users_info_id == $shipp_users_info_id) {
                     $key = $o;
                     break;
                 }
             }
         }
         $shippingaddresses = $shippingaddresses[$key];
     }
     // ORDER DELIVERY TIME IS REMAINING
     $user_id = $row->user_id;
     $item = $postdata['order_item'];
     for ($i = 0; $i < count($item); $i++) {
         $product_id = $item[$i]->product_id;
         $quantity = $item[$i]->quantity;
         $product_excl_price = $item[$i]->prdexclprice;
         $product_price = $item[$i]->productprice;
         // Attribute price added
         $generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id);
         $retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity);
         $product_attribute = $retAttArr[0];
         // Accessory price
         $generateAccessoryCart = $rsCarthelper->generateAccessoryArray((array) $item[$i], $user_id);
         $retAccArr = $producthelper->makeAccessoryCart($generateAccessoryCart, $product_id, $user_id);
         $product_accessory = $retAccArr[0];
         $accessory_total_price = $retAccArr[1];
         $accessory_vat_price = $retAccArr[2];
         $wrapper_price = 0;
         $wrapper_vat = 0;
         if ($item[$i]->wrapper_data != 0 && $item[$i]->wrapper_data != '') {
             $wrapper = $producthelper->getWrapper($product_id, $item[$i]->wrapper_data);
             if (count($wrapper) > 0) {
                 if ($wrapper[0]->wrapper_price > 0) {
                     $wrapper_vat = $producthelper->getProducttax($product_id, $wrapper[0]->wrapper_price, $user_id);
                 }
                 $wrapper_price = $wrapper[0]->wrapper_price + $wrapper_vat;
             }
         }
         $product = $producthelper->getProductById($product_id);
         $rowitem =& $this->getTable('order_item_detail');
         if (!$rowitem->bind($postdata)) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         // STOCKROOM update
         $updatestock = $stockroomhelper->updateStockroomQuantity($product_id, $quantity);
         $stockroom_id_list = $updatestock['stockroom_list'];
         $stockroom_quantity_list = $updatestock['stockroom_quantity_list'];
         $rowitem->stockroom_id = $stockroom_id_list;
         $rowitem->stockroom_quantity = $stockroom_quantity_list;
         $rowitem->order_item_id = 0;
         $rowitem->order_id = $row->order_id;
         $rowitem->user_info_id = $row->user_info_id;
         $rowitem->supplier_id = $product->manufacturer_id;
         $rowitem->product_id = $product_id;
         $rowitem->order_item_sku = $product->product_number;
         $rowitem->order_item_name = $product->product_name;
         $rowitem->product_quantity = $quantity;
         $rowitem->product_item_price = $product_price;
         $rowitem->product_item_price_excl_vat = $product_excl_price;
         $rowitem->product_final_price = $product_price * $quantity;
         $rowitem->order_item_currency = REDCURRENCY_SYMBOL;
         $rowitem->order_status = $row->order_status;
         $rowitem->cdate = $row->cdate;
         $rowitem->mdate = $row->cdate;
         $rowitem->product_attribute = $product_attribute;
         $rowitem->product_accessory = $product_accessory;
         $rowitem->wrapper_id = $item[$i]->wrapper_data;
         $rowitem->wrapper_price = $wrapper_price;
         $rowitem->is_giftcard = 0;
         // RedCRM product purchase price
         if ($iscrm) {
             $crmProductHelper = new crmProductHelper();
             $crmproduct = $crmProductHelper->getProductById($product_id);
             $rowitem->product_purchase_price = $crmproduct->product_purchase_price > 0 ? $crmproduct->product_purchase_price : $crmproduct->product_price;
         }
         if ($producthelper->checkProductDownload($product_id)) {
             $medianame = $producthelper->getProductMediaName($product_id);
             for ($j = 0; $j < count($medianame); $j++) {
                 $product_serial_number = $producthelper->getProdcutSerialNumber($product_id);
                 $producthelper->insertProductDownload($product_id, $user_id, $rowitem->order_id, $medianame[$j]->media_name, $product_serial_number->serial_number);
             }
         }
         if (!$rowitem->store()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         /** my accessory save in table start */
         if (count($generateAccessoryCart) > 0) {
             $attArr = $generateAccessoryCart;
             for ($a = 0; $a < count($attArr); $a++) {
                 $accessory_vat_price = 0;
                 $accessory_attribute = "";
                 $accessory_id = $attArr[$a]['accessory_id'];
                 $accessory_name = $attArr[$a]['accessory_name'];
                 $accessory_price = $attArr[$a]['accessory_price'];
                 $accessory_org_price = $accessory_price;
                 if ($accessory_price > 0) {
                     $accessory_vat_price = $producthelper->getProductTax($product_id, $accessory_price, $user_id);
                 }
                 $attchildArr = $attArr[$a]['accessory_childs'];
                 for ($j = 0; $j < count($attchildArr); $j++) {
                     $attribute_id = $attchildArr[$j]['attribute_id'];
                     $accessory_attribute .= urldecode($attchildArr[$j]['attribute_name']) . ":<br/>";
                     $rowattitem =& $this->getTable('order_attribute_item');
                     $rowattitem->order_att_item_id = 0;
                     $rowattitem->order_item_id = $rowitem->order_item_id;
                     $rowattitem->section_id = $attribute_id;
                     $rowattitem->section = "attribute";
                     $rowattitem->parent_section_id = $accessory_id;
                     $rowattitem->section_name = $attchildArr[$j]['attribute_name'];
                     $rowattitem->is_accessory_att = 1;
                     if ($attribute_id > 0) {
                         if (!$rowattitem->store()) {
                             $this->setError($this->_db->getErrorMsg());
                             return false;
                         }
                     }
                     $propArr = $attchildArr[$j]['attribute_childs'];
                     for ($k = 0; $k < count($propArr); $k++) {
                         $section_vat = 0;
                         if ($propArr[$k]['property_price'] > 0) {
                             $section_vat = $producthelper->getProducttax($product_id, $propArr[$k]['property_price'], $user_id);
                         }
                         $property_id = $propArr[$k]['property_id'];
                         $accessory_attribute .= urldecode($propArr[$k]['property_name']) . " (" . $propArr[$k]['property_oprand'] . $producthelper->getProductFormattedPrice($propArr[$k]['property_price'] + $section_vat) . ")<br/>";
                         $subpropArr = $propArr[$k]['property_childs'];
                         $rowattitem =& $this->getTable('order_attribute_item');
                         $rowattitem->order_att_item_id = 0;
                         $rowattitem->order_item_id = $rowitem->order_item_id;
                         $rowattitem->section_id = $property_id;
                         $rowattitem->section = "property";
                         $rowattitem->parent_section_id = $attribute_id;
                         $rowattitem->section_name = $propArr[$k]['property_name'];
                         $rowattitem->section_price = $propArr[$k]['property_price'];
                         $rowattitem->section_vat = $section_vat;
                         $rowattitem->section_oprand = $propArr[$k]['property_oprand'];
                         $rowattitem->is_accessory_att = 1;
                         if ($property_id > 0) {
                             if (!$rowattitem->store()) {
                                 $this->setError($this->_db->getErrorMsg());
                                 return false;
                             }
                         }
                         for ($l = 0; $l < count($subpropArr); $l++) {
                             $section_vat = 0;
                             if ($subpropArr[$l]['subproperty_price'] > 0) {
                                 $section_vat = $producthelper->getProducttax($rowitem->product_id, $subpropArr[$l]['subproperty_price'], $user_id);
                             }
                             $subproperty_id = $subpropArr[$l]['subproperty_id'];
                             $accessory_attribute .= urldecode($subpropArr[$l]['subproperty_name']) . " (" . $subpropArr[$l]['subproperty_oprand'] . $producthelper->getProductFormattedPrice($subpropArr[$l]['subproperty_price'] + $section_vat) . ")<br/>";
                             $rowattitem =& $this->getTable('order_attribute_item');
                             $rowattitem->order_att_item_id = 0;
                             $rowattitem->order_item_id = $rowitem->order_item_id;
                             $rowattitem->section_id = $subproperty_id;
                             $rowattitem->section = "subproperty";
                             $rowattitem->parent_section_id = $property_id;
                             $rowattitem->section_name = $subpropArr[$l]['subproperty_name'];
                             $rowattitem->section_price = $subpropArr[$l]['subproperty_price'];
                             $rowattitem->section_vat = $section_vat;
                             $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand'];
                             $rowattitem->is_accessory_att = 1;
                             if ($subproperty_id > 0) {
                                 if (!$rowattitem->store()) {
                                     $this->setError($this->_db->getErrorMsg());
                                     return false;
                                 }
                             }
                         }
                     }
                 }
                 $accdata =& $this->getTable('accessory_detail');
                 if ($accessory_id > 0) {
                     $accdata->load($accessory_id);
                 }
                 $accProductinfo = $producthelper->getProductById($accdata->child_product_id);
                 $rowaccitem =& $this->getTable('order_acc_item');
                 $rowaccitem->order_item_acc_id = 0;
                 $rowaccitem->order_item_id = $rowitem->order_item_id;
                 $rowaccitem->product_id = $accessory_id;
                 $rowaccitem->order_acc_item_sku = $accProductinfo->product_number;
                 $rowaccitem->order_acc_item_name = $accessory_name;
                 $rowaccitem->order_acc_price = $accessory_org_price;
                 $rowaccitem->order_acc_vat = $accessory_vat_price;
                 $rowaccitem->product_quantity = $quantity;
                 $rowaccitem->product_acc_item_price = $accessory_price;
                 $rowaccitem->product_acc_final_price = $accessory_price * $quantity;
                 $rowaccitem->product_attribute = $accessory_attribute;
                 if ($accessory_id > 0) {
                     if (!$rowaccitem->store()) {
                         $this->setError($this->_db->getErrorMsg());
                         return false;
                     }
                 }
             }
         }
         /** my attribute save in table start */
         if (count($generateAttributeCart) > 0) {
             $attArr = $generateAttributeCart;
             for ($j = 0; $j < count($attArr); $j++) {
                 $attribute_id = $attArr[$j]['attribute_id'];
                 $rowattitem =& $this->getTable('order_attribute_item');
                 $rowattitem->order_att_item_id = 0;
                 $rowattitem->order_item_id = $rowitem->order_item_id;
                 $rowattitem->section_id = $attribute_id;
                 $rowattitem->section = "attribute";
                 $rowattitem->parent_section_id = $rowitem->product_id;
                 $rowattitem->section_name = $attArr[$j]['attribute_name'];
                 $rowattitem->is_accessory_att = 0;
                 if ($attribute_id > 0) {
                     if (!$rowattitem->store()) {
                         $this->setError($this->_db->getErrorMsg());
                         return false;
                     }
                 }
                 $propArr = $attArr[$j]['attribute_childs'];
                 for ($k = 0; $k < count($propArr); $k++) {
                     $section_vat = 0;
                     if ($propArr[$k]['property_price'] > 0) {
                         $section_vat = $producthelper->getProducttax($rowitem->product_id, $propArr[$k]['property_price'], $user_id);
                     }
                     $property_id = $propArr[$k]['property_id'];
                     /** product property STOCKROOM update start */
                     $updatestock = $stockroomhelper->updateStockroomQuantity($property_id, $quantity, "property");
                     $rowattitem =& $this->getTable('order_attribute_item');
                     $rowattitem->order_att_item_id = 0;
                     $rowattitem->order_item_id = $rowitem->order_item_id;
                     $rowattitem->section_id = $property_id;
                     $rowattitem->section = "property";
                     $rowattitem->parent_section_id = $attribute_id;
                     $rowattitem->section_name = $propArr[$k]['property_name'];
                     $rowattitem->section_price = $propArr[$k]['property_price'];
                     $rowattitem->section_vat = $section_vat;
                     $rowattitem->section_oprand = $propArr[$k]['property_oprand'];
                     $rowattitem->is_accessory_att = 0;
                     if ($property_id > 0) {
                         if (!$rowattitem->store()) {
                             $this->setError($this->_db->getErrorMsg());
                             return false;
                         }
                     }
                     $subpropArr = $propArr[$k]['property_childs'];
                     for ($l = 0; $l < count($subpropArr); $l++) {
                         $section_vat = 0;
                         if ($subpropArr[$l]['subproperty_price'] > 0) {
                             $section_vat = $producthelper->getProducttax($product_id, $subpropArr[$l]['subproperty_price'], $user_id);
                         }
                         $subproperty_id = $subpropArr[$l]['subproperty_id'];
                         /** product subproperty STOCKROOM update start */
                         $updatestock = $stockroomhelper->updateStockroomQuantity($subproperty_id, $quantity, "subproperty");
                         $rowattitem =& $this->getTable('order_attribute_item');
                         $rowattitem->order_att_item_id = 0;
                         $rowattitem->order_item_id = $rowitem->order_item_id;
                         $rowattitem->section_id = $subproperty_id;
                         $rowattitem->section = "subproperty";
                         $rowattitem->parent_section_id = $property_id;
                         $rowattitem->section_name = $subpropArr[$l]['subproperty_name'];
                         $rowattitem->section_price = $subpropArr[$l]['subproperty_price'];
                         $rowattitem->section_vat = $section_vat;
                         $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand'];
                         $rowattitem->is_accessory_att = 0;
                         if ($subproperty_id > 0) {
                             if (!$rowattitem->store()) {
                                 $this->setError($this->_db->getErrorMsg());
                                 return false;
                             }
                         }
                     }
                 }
             }
         }
         //			$producthelper->insertProdcutUserfield($i,$item,$rowitem->order_item_id,12);
         if (USE_CONTAINER) {
             $producthelper->updateContainerStock($product_id, $quantity, $rowitem->container_id);
         }
         // Store userfields
         $userfields = $item[$i]->extrafieldname;
         $userfields_id = $item[$i]->extrafieldId;
         for ($ui = 0; $ui < count($userfields); $ui++) {
             $adminproducthelper->admin_insertProdcutUserfield($userfields_id[$ui], $rowitem->order_item_id, 12, $userfields[$ui]);
         }
         // redCRM RMA Transaction Entry
         if ($iscrm) {
             if (ENABLE_RMA && $rowitem->product_final_price < 0) {
                 // RMA transation log
                 if (isset($item[$i]->reason)) {
                     $rmaTrans =& $this->getTable('rma_transaction');
                     $rmaTrans->rma_transaction_id = 0;
                     $rmaTrans->rma_number = $postdata['rma_number'];
                     $rmaTrans->order_item_return_id = $rowitem->order_item_id;
                     $rmaTrans->order_item_return_reason = $item[$i]->reason;
                     $rmaTrans->order_item_return_status = $item[$i]->deposition;
                     $rmaTrans->order_item_return_action = $item[$i]->action;
                     $rmaTrans->cdate = time();
                     $rmaTrans->store();
                     if (ENABLE_ITEM_TRACKING_SYSTEM) {
                         // Manage supplier order stock
                         $crmSupplierOrderHelper = new crmSupplierOrderHelper();
                         $senddata['main_order_number'] = $postdata['main_order_number'];
                         $senddata['order_status'] = $row->order_status;
                         $senddata['product_id'] = $rowitem->product_id;
                         $senddata['property_id'] = $property_id;
                         $senddata['subproperty_id'] = $subproperty_id;
                         $senddata['deposition'] = $item[$i]->deposition;
                         $itemqty = $rowitem->product_quantity;
                         for ($r = 0; $r < $itemqty; $r++) {
                             $crmSupplierOrderHelper->manageStockAffectedRMA($senddata);
                         }
                     }
                 }
             }
         }
     }
     $rowpayment =& $this->getTable('order_payment');
     if (!$rowpayment->bind($postdata)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $rowpayment->order_id = $row->order_id;
     $rowpayment->payment_method_id = $postdata['payment_method_class'];
     $rowpayment->order_payment_amount = $row->order_total;
     $rowpayment->order_payment_name = $postdata['order_payment_name'];
     $rowpayment->payment_method_class = $postdata['payment_method_class'];
     if (!$rowpayment->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // Add billing Info
     $userrow =& $this->getTable('user_detail');
     $userrow->load($billingaddresses->users_info_id);
     $orderuserrow =& $this->getTable('order_user_detail');
     if (!$orderuserrow->bind($userrow)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $orderuserrow->order_id = $row->order_id;
     $orderuserrow->address_type = 'BT';
     if (!$orderuserrow->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // Add shipping Info
     $userrow =& $this->getTable('user_detail');
     if (isset($shippingaddresses->users_info_id)) {
         $userrow->load($shippingaddresses->users_info_id);
     }
     $orderuserrow =& $this->getTable('order_user_detail');
     if (!$orderuserrow->bind($userrow)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $orderuserrow->order_id = $row->order_id;
     $orderuserrow->address_type = 'ST';
     if (!$orderuserrow->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if ($row->order_status == CLICKATELL_ORDER_STATUS) {
         $helper->clickatellSMS($row->order_id);
     }
     // Maintan supplier order stck when item tracking system is enabled
     if ($helper->isredCRM()) {
         if (ENABLE_ITEM_TRACKING_SYSTEM) {
             // Supplier order helper object
             $crmSupplierOrderHelper = new crmSupplierOrderHelper();
             $getStatus = array();
             $getStatus['orderstatus'] = $row->order_status;
             $getStatus['paymentstatus'] = $row->order_payment_status;
             $crmSupplierOrderHelper->redSHOPOrderUpdate($row->order_id, $getStatus);
             unset($getStatus);
         }
     }
     $checkOrderStatus = 1;
     if ($postdata['payment_method_class'] == "rs_payment_banktransfer" || $postdata['payment_method_class'] == "rs_payment_banktransfer_discount" || $postdata['payment_method_class'] == "rs_payment_banktransfer2" || $postdata['payment_method_class'] == "rs_payment_banktransfer3" || $postdata['payment_method_class'] == "rs_payment_banktransfer4" || $postdata['payment_method_class'] == "rs_payment_banktransfer5") {
         $checkOrderStatus = 0;
     }
     // Economic Integration start for invoice generate and book current invoice
     if (ECONOMIC_INTEGRATION == 1 && ECONOMIC_INVOICE_DRAFT != 2) {
         $issplit = 0;
         $economic = new economic();
         if (isset($postdata['issplit']) && $postdata['issplit'] == 1) {
             $issplit = 1;
         }
         $economicdata['split_payment'] = $issplit;
         $economicdata['economic_payment_terms_id'] = $postdata['economic_payment_terms_id'];
         $economicdata['economic_design_layout'] = $postdata['economic_design_layout'];
         $economicdata['economic_is_creditcard'] = $postdata['economic_is_creditcard'];
         $payment_name = $postdata['payment_method_class'];
         $paymentArr = explode("rs_payment_", $postdata['payment_method_class']);
         if (count($paymentArr) > 0) {
             $payment_name = $paymentArr[1];
         }
         $economicdata['economic_payment_method'] = $payment_name;
         $invoiceHandle = $economic->createInvoiceInEconomic($row->order_id, $economicdata);
         if (ECONOMIC_INVOICE_DRAFT == 0) {
             $bookinvoicepdf = $economic->bookInvoiceInEconomic($row->order_id, $checkOrderStatus);
             if (is_file($bookinvoicepdf)) {
                 $ret = $redshopMail->sendEconomicBookInvoiceMail($row->order_id, $bookinvoicepdf);
             }
         }
     }
     // ORDER MAIL SEND
     if ($postdata['task'] != "save_without_sendmail") {
         $redshopMail->sendOrderMail($row->order_id);
     }
     return $row;
 }
Exemple #15
0
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
$uri = JURI::getInstance();
$url = JURI::base();
$redconfig = new Redconfiguration();
$extra_field = new extra_field();
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/shipping.php';
require_once JPATH_COMPONENT . '/helpers/product.php';
require_once JPATH_COMPONENT . '/helpers/helper.php';
require_once JPATH_COMPONENT . '/helpers/cart.php';
$producthelper = new producthelper();
$redhelper = new redhelper();
$order_functions = new order_functions();
$redTemplate = new Redtemplate();
$shippinghelper = new shipping();
$carthelper = new rsCarthelper();
$Itemid = JRequest::getInt('Itemid');
$oid = JRequest::getInt('oid');
$print = JRequest::getInt('print');
$getshm = $uri->getScheme();
$config = JFactory::getConfig();
$force_ssl = $config->getValue('force_ssl');
if ($getshm == 'https' && $force_ssl > 2) {
    $uri->setScheme('http');
}
?>
Exemple #16
0
    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;
    }
Exemple #17
0
 public function _buildQuery($manudata = 0)
 {
     $app = JFactory::getApplication();
     $context = 'search';
     $db = JFactory::getDbo();
     $keyword = $app->getUserStateFromRequest($context . 'keyword', 'keyword', '');
     $defaultSearchType = '';
     if (!empty($manudata['search_type'])) {
         $defaultSearchType = $manudata['search_type'];
         $defaultSearchType_tmp = $manudata['search_type'];
     }
     if ($defaultSearchType == "") {
         $defaultSearchType = 'product_name';
     }
     if ($defaultSearchType == "name_number") {
         $defaultSearchField = "name_number";
         $defaultSearchType = '(p.product_name LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_number LIKE ' . $db->quote('%' . $keyword . '%') . ')';
     } elseif ($defaultSearchType == "name_desc") {
         $defaultSearchField = "name_desc";
         $defaultSearchType = '(p.product_name LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_desc LIKE ' . $db->quote('%' . $keyword . '%') . ' OR  p.product_s_desc LIKE ' . $db->quote('%' . $keyword . '%') . ')';
     } elseif ($defaultSearchType == "virtual_product_num") {
         $defaultSearchField = "virtual_product_num";
         $defaultSearchType = '(pa.property_number LIKE ' . $db->quote('%' . $keyword . '%') . ' OR  ps.subattribute_color_number LIKE ' . $db->quote('%' . $keyword . '%') . ')';
     } elseif ($defaultSearchType == "name_number_desc") {
         $defaultSearchType = '(p.product_name LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_number LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_desc LIKE ' . $db->quote('%' . $keyword . '%') . ' OR  p.product_s_desc LIKE ' . $db->quote('%' . $keyword . '%') . ' OR  pa.property_number LIKE ' . $db->quote('%' . $keyword . '%') . ' OR  ps.subattribute_color_number LIKE ' . $db->quote('%' . $keyword . '%') . ')';
     } elseif ($defaultSearchType == "product_desc") {
         $defaultSearchField = $defaultSearchType;
         $defaultSearchType = '(p.' . $defaultSearchType . ' LIKE ' . $db->quote('%' . $keyword . '%') . ' OR  p.product_s_desc LIKE ' . $db->quote('%' . $keyword . '%') . ' )';
     } elseif ($defaultSearchType == "product_name") {
         $main_sp_name = explode(" ", $keyword);
         $defaultSearchField = $defaultSearchType;
         for ($f = 0; $f < count($main_sp_name); $f++) {
             $defaultSearchType1[] = " p.product_name LIKE " . $db->quote('%' . $main_sp_name[$f] . '%');
         }
         $defaultSearchType = "(" . implode("AND", $defaultSearchType1) . ")";
     } elseif ($defaultSearchType == "product_number") {
         $defaultSearchField = $defaultSearchType;
         $defaultSearchType = '(p.product_number LIKE ' . $db->quote('%' . $keyword . '%') . ')';
     }
     $redconfig = $app->getParams();
     $getorderby = urldecode(JRequest::getCmd('order_by', ''));
     if (in_array($getorderby, $this->filter_fields)) {
         $order_by = $getorderby;
     } else {
         $order_by = $redconfig->get('order_by', DEFAULT_PRODUCT_ORDERING_METHOD);
     }
     if ($order_by == 'pc.ordering ASC' || $order_by == 'c.ordering ASC') {
         $order_by = 'p.product_id DESC';
     }
     $layout = JRequest::getVar('layout', 'default');
     $category_helper = new product_category();
     $producthelper = new producthelper();
     $manufacture_id = JRequest::getInt('manufacture_id', 0);
     $category_id = JRequest::getInt('category_id', 0);
     $cat = $category_helper->getCategoryListArray(0, $category_id);
     $cat_group = array();
     for ($j = 0; $j < count($cat); $j++) {
         $cat_group[$j] = $cat[$j]->category_id;
         if ($j == count($cat) - 1) {
             $cat_group[$j + 1] = $category_id;
         }
     }
     JArrayHelper::toInteger($cat_group);
     if ($cat_group) {
         $cat_group = join(',', $cat_group);
     } else {
         $cat_group = $category_id;
     }
     $params = JComponentHelper::getParams('com_redshop');
     $menu = $app->getMenu();
     $item = $menu->getActive();
     $days = 0;
     $days = isset($item->query['newproduct']) ? $item->query['newproduct'] : 0;
     $today = date('Y-m-d H:i:s', time());
     $days_before = date('Y-m-d H:i:s', time() - $days * 60 * 60 * 24);
     $aclProducts = $producthelper->loadAclProducts();
     $whereaclProduct = "";
     // Shopper group - choose from manufactures Start
     $rsUserhelper = new rsUserhelper();
     $shopper_group_manufactures = $rsUserhelper->getShopperGroupManufacturers();
     if ($shopper_group_manufactures != "") {
         // Sanitize ids
         $manufacturerIds = explode(',', $shopper_group_manufactures);
         JArrayHelper::toInteger($manufacturerIds);
         $whereaclProduct .= " AND p.manufacturer_id IN (" . implode(',', $manufacturerIds) . ") ";
     }
     // Shopper group - choose from manufactures End
     if ($aclProducts != "") {
         // Sanitize ids
         $productIds = explode(',', $aclProducts);
         JArrayHelper::toInteger($productIds);
         $whereaclProduct .= " AND p.product_id IN (" . implode(',', $productIds) . ")  ";
     }
     if ($layout == 'productonsale') {
         $categoryid = $item->params->get('categorytemplate');
         $cat_array = "";
         $left_join = "";
         if ($categoryid) {
             $cat_main = $category_helper->getCategoryTree($categoryid);
             $cat_group_main = array();
             for ($j = 0; $j < count($cat_main); $j++) {
                 $cat_group_main[$j] = $cat_main[$j]->category_id;
             }
             $cat_group_main[] = $categoryid;
             JArrayHelper::toInteger($cat_group_main);
             $cat_array = " AND pcx.category_id IN (" . implode(',', $cat_group_main) . ") AND pcx.product_id=p.product_id ";
             $left_join = " LEFT JOIN " . $this->_table_prefix . "product_category_xref pcx ON pcx.product_id=p.product_id ";
         }
         $query = " SELECT * FROM " . $this->_table_prefix . "product AS p " . $left_join . "WHERE p.published = 1 " . "AND p.product_on_sale=1 " . "AND p.expired=0 " . "AND p.product_parent_id=0 " . $whereaclProduct . $cat_array . " ORDER BY " . $db->escape($order_by);
     } elseif ($layout == 'featuredproduct') {
         $query = " SELECT * FROM " . $this->_table_prefix . "product AS p " . "WHERE p.published = 1 " . "AND p.product_special=1 " . $whereaclProduct . " ORDER BY " . $db->escape($order_by);
     } elseif ($layout == 'newproduct') {
         $catid = $item->query['categorytemplate'];
         $cat_main = $category_helper->getCategoryTree($catid);
         $cat_group_main = array();
         for ($j = 0; $j < count($cat_main); $j++) {
             $cat_group_main[$j] = $cat_main[$j]->category_id;
         }
         $cat_group_main[] = $catid;
         JArrayHelper::toInteger($cat_group_main);
         $extracond = "";
         if ($catid) {
             $extracond = " AND pcx.category_id in (" . implode(',', $cat_group_main) . ") AND pcx.product_id=p.product_id ";
         }
         $query = " SELECT distinct p.* " . " FROM " . $this->_table_prefix . "product p " . "LEFT JOIN " . $this->_table_prefix . "product_category_xref pcx ON pcx.product_id = p.product_id " . "WHERE p.published = 1  " . "and  p.publish_date BETWEEN " . $db->quote($days_before) . " AND " . $db->quote($today) . " AND p.expired = 0  AND p.product_parent_id = 0 " . $whereaclProduct . $extracond . " ORDER BY " . $db->escape($order_by);
     } elseif ($layout == 'redfilter') {
         // Get products for filtering
         $products = $this->getRedFilterProduct();
         $query = " SELECT * " . " FROM " . $this->_table_prefix . "product as p " . "WHERE p.published = 1 AND p.expired = 0 " . $whereaclProduct;
         if ($products != "") {
             // Sanitize ids
             $productIds = explode(',', $products);
             JArrayHelper::toInteger($productIds);
             $query .= "AND p.product_id IN ( " . implode(',', $productIds) . " )  ";
         }
         $query .= " ORDER BY " . $db->escape($order_by);
     } else {
         if ($manufacture_id == 0) {
             if (!empty($manudata['manufacturer_id'])) {
                 $manufacture_id = $manudata['manufacturer_id'];
             }
         }
         $query = "SELECT distinct p.* " . " FROM  " . $this->_table_prefix . "product as p  ";
         if ($category_id != 0) {
             $query .= " LEFT JOIN  " . $this->_table_prefix . "product_category_xref as pcx on p.product_id = pcx.product_id ";
         }
         if ($defaultSearchType_tmp == "name_number_desc" || $defaultSearchType_tmp == "virtual_product_num") {
             $query .= "LEFT JOIN " . $this->_table_prefix . "product_attribute AS a ON a.product_id = p.product_id " . "LEFT JOIN " . $this->_table_prefix . "product_attribute_property AS pa ON pa.attribute_id = a.attribute_id " . "LEFT JOIN " . $this->_table_prefix . "product_subattribute_color AS ps ON ps.subattribute_id = pa.property_id ";
         }
         $query .= " WHERE 1=1 AND p.expired = 0  " . $whereaclProduct;
         if ($category_id != 0) {
             // Sanitize ids
             $catIds = explode(',', $cat_group);
             JArrayHelper::toInteger($catIds);
             $query .= " AND pcx.category_id in (" . $cat_group . ")";
         }
         if ($manufacture_id != 0) {
             $query .= " AND p.manufacturer_id =" . (int) $manufacture_id;
         }
         $query .= " AND " . $defaultSearchType . " AND p.published = 1" . " ORDER BY " . $db->escape($order_by);
     }
     return $query;
 }
Exemple #18
0
 /**
  * Load the fields for export
  *
  * @return  void
  */
 private function loadFields()
 {
     $extra_field = new extra_field();
     $producthelper = new producthelper();
     $db = JFactory::getDbo();
     $query = "SELECT * FROM `#__redshop_fields` ORDER BY field_id asc ";
     $this->_db->setQuery($query);
     $cur = $this->_db->loadObjectList();
     $ret = null;
     for ($i = 0; $i < count($cur); $i++) {
         if ($i == 0) {
             echo "field_id,field_title,field_name_field,field_type,field_desc,field_class,field_section,field_maxlength,field_cols,field_rows,field_size,field_show_in_front,required,published,data_id,data_txt,itemid,section,value_id,field_value,field_name,data_number";
             echo "\r\n";
         }
         $query = 'SELECT data_id,`data_txt`,`itemid`,`section` FROM `#__redshop_fields_data` WHERE `fieldid` = ' . $cur[$i]->field_id . ' and section!=""';
         $this->_db->setQuery($query);
         $data = $this->_db->loadObjectList();
         $attr = array();
         $datavalue = $extra_field->getFieldValue($cur[$i]->field_id);
         $attrvalue = array();
         echo $cur[$i]->field_id . "," . $cur[$i]->field_title . "," . $cur[$i]->field_name . "," . $cur[$i]->field_type . "," . $cur[$i]->field_desc . "," . $cur[$i]->field_class . "," . $cur[$i]->field_section . "," . $cur[$i]->field_maxlength . "," . $cur[$i]->field_cols . "," . $cur[$i]->field_rows . "," . $cur[$i]->field_size . "," . $cur[$i]->field_show_in_front . "," . $cur[$i]->required . "," . $cur[$i]->published . "\n";
         for ($att = 0; $att < count($data); $att++) {
             $product_details = $producthelper->getProductById($data[$att]->itemid);
             echo $cur[$i]->field_id . ",,,,,,,,,,,,,," . $data[$att]->data_id . ",\"" . $data[$att]->data_txt . "\"," . $data[$att]->itemid . "," . $data[$att]->section . ",,,," . $product_details->product_number . ",\n";
         }
         for ($attrvalue = 0; $attrvalue < count($datavalue); $attrvalue++) {
             echo $cur[$i]->field_id . ",,,,,,,,,,,,,,,,,," . $datavalue[$attrvalue]->value_id . "," . $datavalue[$attrvalue]->field_value . "," . $datavalue[$attrvalue]->field_name . ",\n";
         }
     }
 }
Exemple #19
0
 public function addtocart($data = array())
 {
     $app = JFactory::getApplication();
     $Itemid = JRequest::getVar("Itemid");
     $session = JFactory::getSession();
     $db = JFactory::getDbo();
     $carthelper = new rsCarthelper();
     $producthelper = new producthelper();
     $quotationHelper = new quotationHelper();
     $cart = $session->get('cart');
     $idx = (int) $cart['idx'];
     $row_data = $quotationHelper->getQuotationUserfield($data->quotation_item_id);
     $quotation_acc_data = $quotationHelper->getQuotationItemAccessoryDetail($data->quotation_item_id);
     $quotation_att_data = $quotationHelper->getQuotationItemAttributeDetail($data->quotation_item_id, 0, "attribute", $data->product_id);
     // Set session for giftcard
     if ($data->is_giftcard == 1) {
         if ($carthelper->rs_recursiveArraySearch($cart, $data->product_id)) {
             $cart[$idx]['quantity'] += 1;
             $session->set('cart', $cart);
             return;
         } else {
             $cart[$idx]['quantity'] = 1;
         }
         $cart[$idx]['quantity'] = $data->product_quantity;
         $cart[$idx]['giftcard_id'] = $data->product_id;
         $cart[$idx]['product_price'] = $data->product_price;
         $cart[$idx]['product_vat'] = 0;
         $cart[$idx]['product_id'] = '';
         $cart['discount_type'] = 0;
         $cart['discount'] = 0;
         $cart['discount2'] = 0;
         $cart['reciver_email'] = '';
         $cart['reciver_name'] = '';
         for ($i = 0; $i < count($row_data); $i++) {
             $field_name = $row_data[$i]->field_name;
             $cart[$idx][$field_name] = $row_data[$i]->data_txt;
         }
         $cart['idx'] = $idx + 1;
         $session->set('cart', $cart);
         return;
     }
     $cart[$idx]['product_id'] = $data->product_id;
     $cart[$idx]['product_price'] = $data->product_price;
     $cart[$idx]['quantity'] = $data->product_quantity;
     if ($data->product_excl_price) {
         $getprotax = $producthelper->getProductTax($cart[$idx]['product_id'], $data->product_excl_price);
         $cart[$idx]['product_price'] = $data->product_excl_price + $getprotax;
         $cart[$idx]['product_price'] += $data->wrapper_price;
         $cart[$idx]['product_subtotal'] = $cart[$idx]['quantity'] * $cart[$idx]['product_price'];
     }
     $generateAccessoryCart = array();
     for ($i = 0; $i < count($quotation_acc_data); $i++) {
         $generateAccessoryCart[$i]['accessory_id'] = $quotation_acc_data[$i]->accessory_id;
         $generateAccessoryCart[$i]['accessory_name'] = $quotation_acc_data[$i]->accessory_item_name;
         $generateAccessoryCart[$i]['accessory_oprand'] = "+";
         $generateAccessoryCart[$i]['accessory_price'] = $quotation_acc_data[$i]->accessory_price;
         $acc_att_data = $quotationHelper->getQuotationItemAttributeDetail($data->quotation_item_id, 1, "attribute", $quotation_acc_data[$i]->accessory_id);
         $accAttributeCart = array();
         for ($ia = 0; $ia < count($acc_att_data); $ia++) {
             $accPropertyCart = array();
             $accAttributeCart[$ia]['attribute_id'] = $acc_att_data[$ia]->section_id;
             $accAttributeCart[$ia]['attribute_name'] = $acc_att_data[$ia]->section_name;
             $acc_prop_data = $quotationHelper->getQuotationItemAttributeDetail($data->quotation_item_id, 1, "property", $acc_att_data[$ia]->section_id);
             for ($ip = 0; $ip < count($acc_prop_data); $ip++) {
                 $accSubpropertyCart = array();
                 $accPropertyCart[$ip]['property_id'] = $acc_prop_data[$ip]->section_id;
                 $accPropertyCart[$ip]['property_name'] = $acc_prop_data[$ip]->section_name;
                 $accPropertyCart[$ip]['property_oprand'] = $acc_prop_data[$ip]->section_oprand;
                 $acc_subpro_data = $quotationHelper->getQuotationItemAttributeDetail($data->quotation_item_id, 1, "subproperty", $acc_prop_data[$ip]->section_id);
                 for ($isp = 0; $isp < count($acc_subpro_data); $isp++) {
                     $accSubpropertyCart[$isp]['subproperty_id'] = $acc_subpro_data[$isp]->section_id;
                     $accSubpropertyCart[$isp]['subproperty_name'] = $acc_subpro_data[$isp]->section_name;
                     $accSubpropertyCart[$isp]['subproperty_oprand'] = $acc_subpro_data[$isp]->section_oprand;
                 }
                 $accPropertyCart[$ip]['property_childs'] = $accSubpropertyCart;
             }
             $accAttributeCart[$ia]['attribute_childs'] = $accPropertyCart;
         }
         $generateAccessoryCart[$i]['accessory_childs'] = $accAttributeCart;
     }
     $generateAttributeCart = array();
     for ($ia = 0; $ia < count($quotation_att_data); $ia++) {
         $accPropertyCart = array();
         $generateAttributeCart[$ia]['attribute_id'] = $quotation_att_data[$ia]->section_id;
         $generateAttributeCart[$ia]['attribute_name'] = $quotation_att_data[$ia]->section_name;
         $acc_prop_data = $quotationHelper->getQuotationItemAttributeDetail($data->quotation_item_id, 0, "property", $quotation_att_data[$ia]->section_id);
         for ($ip = 0; $ip < count($acc_prop_data); $ip++) {
             $accSubpropertyCart = array();
             $accPropertyCart[$ip]['property_id'] = $acc_prop_data[$ip]->section_id;
             $accPropertyCart[$ip]['property_name'] = $acc_prop_data[$ip]->section_name;
             $accPropertyCart[$ip]['property_oprand'] = $acc_prop_data[$ip]->section_oprand;
             $acc_subpro_data = $quotationHelper->getQuotationItemAttributeDetail($data->quotation_item_id, 0, "subproperty", $acc_prop_data[$ip]->section_id);
             for ($isp = 0; $isp < count($acc_subpro_data); $isp++) {
                 $accSubpropertyCart[$isp]['subproperty_id'] = $acc_subpro_data[$isp]->section_id;
                 $accSubpropertyCart[$isp]['subproperty_name'] = $acc_subpro_data[$isp]->section_name;
                 $accSubpropertyCart[$isp]['subproperty_oprand'] = $acc_subpro_data[$isp]->section_oprand;
             }
             $accPropertyCart[$ip]['property_childs'] = $accSubpropertyCart;
         }
         $generateAttributeCart[$ia]['attribute_childs'] = $accPropertyCart;
     }
     $cart[$idx]['cart_attribute'] = $generateAttributeCart;
     $cart[$idx]['cart_accessory'] = $generateAccessoryCart;
     $cart[$idx]['wrapper_id'] = $data->product_wrapperid;
     $cart[$idx]['wrapper_price'] = $data->wrapper_price;
     $cart[$idx]['product_price_excl_vat'] = $data->product_excl_price;
     $cart['idx'] = $idx + 1;
     for ($i = 0; $i < count($row_data); $i++) {
         $field_name = $row_data[$i]->field_name;
         $cart[$idx][$field_name] = $row_data[$i]->data_txt;
     }
     $session->set('cart', $cart);
 }
Exemple #20
0
/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
$url = JURI::base();
include_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/quotation.php';
include_once JPATH_COMPONENT . '/helpers/product.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/extra_field.php';
require_once JPATH_COMPONENT . '/helpers/extra_field.php';
$producthelper = new producthelper();
$quotationHelper = new quotationHelper();
$order_functions = new order_functions();
$configobj = new Redconfiguration();
$redTemplate = new Redtemplate();
$extra_field = new extra_field();
$extraField = new extraField();
$carthelper = new rsCarthelper();
$user = JFactory::getUser();
$Itemid = JRequest::getInt('Itemid');
$app = JFactory::getApplication();
$params = $app->getParams('com_redshop');
$returnitemid = $params->get('logout', $Itemid);
$accountbillto_link = JRoute::_("index.php?option=com_redshop&view=account_billto&Itemid=" . $Itemid);
$accountshipto_link = JRoute::_("index.php?option=com_redshop&view=account_shipto&Itemid=" . $Itemid);
$logout_link = JRoute::_("index.php?option=com_redshop&view=login&task=logout&logout=" . $returnitemid . "&Itemid=" . $Itemid);
Exemple #21
0
 public function replaceUserfield($product_id = 0, $template_id = 0, $unique_id = "")
 {
     $producthelper = new producthelper();
     $redTemplate = new Redtemplate();
     $extraField = new extra_field();
     $template_desc = $redTemplate->getTemplate("product", $template_id);
     $returnArr = $producthelper->getProductUserfieldFromTemplate($template_desc[0]->template_desc);
     $commonid = $product_id . $unique_id;
     $product_userfileds = "<table>";
     for ($ui = 0; $ui < count($returnArr[1]); $ui++) {
         $result_arr = $extraField->list_all_user_fields($returnArr[1][$ui], 12, "", $commonid);
         $hidden_arr = $extraField->list_all_user_fields($returnArr[1][$ui], 12, "hidden", $commonid);
         if ($result_arr[0] != "") {
             $product_userfileds .= "<tr><td>" . $result_arr[0] . "</td><td>" . $result_arr[1] . $hidden_arr[1] . "</td></tr>";
         }
     }
     $product_userfileds .= "</table>";
     return $product_userfileds;
 }
Exemple #22
0
<?php

/**
 * @package     RedSHOP.Backend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die('restricted access');
require_once JPATH_COMPONENT_SITE . '/helpers/product.php';
$producthelper = new producthelper();
$user = JFactory::getUser();
$option = JRequest::getVar('option');
$start = $this->pagination->limitstart;
$end = $this->pagination->limit;
?>
<form action="<?php 
echo 'index.php?option=' . $option;
?>
" method="post" name="adminForm" id="adminForm">
	<div id="editcell">
		<table width="100%">
			<tr>
				<td><?php 
echo JText::_('COM_REDSHOP_FILTER') . ": " . $this->lists['filteroption'];
?>
</td>
			</tr>
			<?php 
/*<tr><td><?php echo JText::_('COM_REDSHOP_STARTDATE');?></td>
Exemple #23
0
<?php

/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
JHTMLBehavior::modal();
$url = JURI::base();
$extraField = new extraField();
$extra_field = new extra_field();
$producthelper = new producthelper();
$redTemplate = new Redtemplate();
$redhelper = new redhelper();
$Itemid = JRequest::getInt('Itemid');
$model = $this->getModel('manufacturers');
// Page Title Start
$pagetitle = JText::_('COM_REDSHOP_MANUFACTURER_DETAIL');
if ($this->pageheadingtag != '') {
    $pagetitle = $this->pageheadingtag;
}
if ($this->params->get('show_page_heading', 1)) {
    ?>
	<h1 class="componentheading<?php 
    echo $this->escape($this->params->get('pageclass_sfx'));
    ?>
">
Exemple #24
0
<?php

/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
/*
 * Include required files
 */
include_once JPATH_COMPONENT . '/helpers/product.php';
include_once JPATH_COMPONENT . '/helpers/cart.php';
$producthelper = new producthelper();
$carthelper = new rsCarthelper();
$redTemplate = new Redtemplate();
$cart = $this->cart;
$idx = $cart['idx'];
$Itemid = JRequest::getInt('Itemid');
$cart_index = JRequest::getInt('cart_index');
$product_id = JRequest::getInt('pid');
$model = $this->getModel('cart');
$session = JFactory::getSession();
$user = JFactory::getUser();
$document = JFactory::getDocument();
JHTML::Script('attribute.js', 'components/com_redshop/assets/js/', false);
JHTML::Script('common.js', 'components/com_redshop/assets/js/', false);
?>
	<script type="text/javascript">
 public function replaceSubPropertyData($product_id = 0, $accessory_id = 0, $attribute_id = 0, $property_id = 0, $user_id, $uniqueid = "")
 {
     $producthelper = new producthelper();
     $subproperty = array();
     if ($property_id != 0 && $attribute_id != 0) {
         $attributes = $producthelper->getProductAttribute(0, 0, $attribute_id);
         $attributes = $attributes[0];
         $subproperty = $producthelper->getAttibuteSubProperty(0, $property_id);
     }
     if ($accessory_id != 0) {
         $prefix = $uniqueid . "acc_";
     } else {
         $prefix = $uniqueid . "prd_";
     }
     $attributelist = "";
     if (count($subproperty) > 0) {
         $commonid = $prefix . $product_id . '_' . $accessory_id . '_' . $attribute_id . '_' . $property_id;
         $subpropertyid = 'subproperty_id_' . $commonid;
         for ($i = 0; $i < count($subproperty); $i++) {
             $attributes_subproperty_vat = 0;
             if ($subproperty[$i]->subattribute_color_price > 0) {
                 $attributes_subproperty_vat = $producthelper->getProducttax($product_id, $subproperty[$i]->subattribute_color_price);
                 $subproperty[$i]->subattribute_color_price += $attributes_subproperty_vat;
                 $subproperty[$i]->text = urldecode($subproperty[$i]->subattribute_color_name) . " (" . $subproperty[$i]->oprand . $producthelper->getProductFormattedPrice($subproperty[$i]->subattribute_color_price) . ")";
             } else {
                 $subproperty[$i]->text = urldecode($subproperty[$i]->subattribute_color_name);
             }
             $attributelist .= '<input type="hidden" id="' . $subpropertyid . '_oprand' . $subproperty[$i]->value . '" value="' . $subproperty[$i]->oprand . '" />';
             $attributelist .= '<input type="hidden" id="' . $subpropertyid . '_protax' . $subproperty[$i]->value . '" value="' . $attributes_subproperty_vat . '" />';
             $attributelist .= '<input type="hidden" id="' . $subpropertyid . '_proprice' . $subproperty[$i]->value . '" value="' . $subproperty[$i]->subattribute_color_price . '" />';
         }
         $tmp_array = array();
         $tmp_array[0]->value = 0;
         $tmp_array[0]->text = JText::_('COM_REDSHOP_SELECT') . "&nbsp;" . urldecode($subproperty[0]->property_name);
         $new_subproperty = array_merge($tmp_array, $subproperty);
         $chklist = "";
         if ($attributes->allow_multiple_selection) {
             for ($chk = 0; $chk < count($subproperty); $chk++) {
                 $chklist .= "<br /><input type='checkbox' value='" . $subproperty[$chk]->value . "' name='" . $subpropertyid . "[]'  id='" . $subpropertyid . "' class='inputbox' onchange='javascript:calculateOfflineTotalPrice(\"" . $uniqueid . "\");' />&nbsp;" . $subproperty[$chk]->text;
             }
         } else {
             $chklist = JHTML::_('select.genericlist', $new_subproperty, $subpropertyid . '[]', ' id="' . $subpropertyid . '" class="inputbox" size="1" onchange="javascript:calculateOfflineTotalPrice(\'' . $uniqueid . '\');" ', 'value', 'text', '');
         }
         $lists['subproperty_id'] = $chklist;
         $attributelist .= "<tr><td>" . urldecode($subproperty[0]->property_name) . " : " . $lists['subproperty_id'];
     }
     return $attributelist;
 }
Exemple #26
0
<?php

/**
 * @package     RedSHOP.Backend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
require_once JPATH_COMPONENT_SITE . '/helpers/product.php';
$producthelper = new producthelper();
$option = JRequest::getVar('option', '', 'request', 'string');
?>
<script language="javascript" type="text/javascript">

	Joomla.submitbutton = function (pressbutton) {
		submitbutton(pressbutton);
	}
	submitbutton = function (pressbutton) {
		var form = document.adminForm;
		if (pressbutton) {
			form.task.value = pressbutton;
		}

		if ((pressbutton == 'add') || (pressbutton == 'edit') || (pressbutton == 'publish') || (pressbutton == 'unpublish')
			|| (pressbutton == 'remove')) {
			form.view.value = "discount_detail";
		}
		try {
			form.onsubmit();
Exemple #27
0
 function renderLayout()
 {
     if ($this->config['module_mode'] !== 'normal') {
         $this->render_portal_mode($this->config['module_mode']);
     } else {
         $renderer = new NSP_GK4_Layout_Parts();
         // detecting mode - com_content or K2
         $k2_mode = false;
         $rs_mode = false;
         $vm_mode = false;
         $producthelper = '';
         $redhelper = '';
         //check the source
         if ($this->config["data_source"] == 'k2_categories' || $this->config["data_source"] == 'k2_articles' || $this->config["data_source"] == 'all_k2_articles' || $this->config["data_source"] == 'k2_tags') {
             if ($this->config['k2_categories'] != -1) {
                 $k2_mode = true;
             } else {
                 // exception when K2 is not installed
                 $this->content = array("ID" => array(), "alias" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "author" => array(), "cat_name" => array(), "cat_alias" => array(), "hits" => array(), "news_amount" => 0, "rating_sum" => 0, "rating_count" => 0, "plugins" => '');
             }
         } else {
             if ($this->config["data_source"] == 'redshop_categories' || $this->config["data_source"] == 'redshop_products' || $this->config["data_source"] == 'all_redshop_products') {
                 if ($this->config['redshop_categories'] != -1 && file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_redshop')) {
                     $rs_mode = true;
                     $producthelper = new producthelper();
                     $redhelper = new redhelper();
                 } else {
                     // exception when RedSHOP is not installed
                     $this->content = array("ID" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "price" => array(), "discount_price" => array(), "discount_start" => array(), "discount_end" => array(), "tax" => array(), "cat_name" => array(), "manufacturer" => array(), "manufacturer_id" => array(), "product_image" => array(), "news_amount" => array());
                 }
             } elseif ($this->config["data_source"] == 'vm_categories' || $this->config["data_source"] == 'vm_products') {
                 if ($this->config['vm_categories'] != -1) {
                     $vm_mode = true;
                 } else {
                     // exception when VirtueMart is not installed
                     $this->content = array("ID" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "price" => array(), "price_currency" => array(), "discount_amount" => array(), "discount_is_percent" => array(), "discount_start" => array(), "discount_end" => array(), "tax" => array(), "cat_name" => array(), "manufacturer" => array(), "manufacturer_id" => array(), "product_image" => array(), "news_amount" => 0);
                 }
             }
         }
         // tables which will be used in generated content
         $news_list_tab = array();
         $news_html_tab = array();
         // Generating content
         $uri =& JURI::getInstance();
         $li_counter = 0;
         $news_k2_store = '';
         $news_header = '';
         $news_image = '';
         $news_readmore = '';
         $news_textt = '';
         $news_infoo = '';
         $news_infoo2 = '';
         //
         for ($i = 0; $i < count($this->content["ID"]); $i++) {
             if ($i < $this->config['news_column'] * $this->config['news_rows'] * $this->config['news_full_pages']) {
                 // GENERATING NEWS CONTENT
                 if ($k2_mode == FALSE && $rs_mode == FALSE && $vm_mode == FALSE) {
                     // GENERATING HEADER
                     if ($this->config['news_header_enabled'] == 1) {
                         $news_header = $renderer->header($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i]);
                     }
                     // GENERATING IMAGE
                     if ($this->config['news_image_enabled'] == 1) {
                         $news_image = $renderer->image($this->config, $uri, $this->content['ID'][$i], $this->content['IID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $this->content['title'][$i], $this->content['images'][$i]);
                     }
                     // GENERATING READMORE
                     if ($this->config['news_readmore_enabled'] == 1) {
                         $news_readmore = $renderer->readMore($this->config, $this->content['ID'][$i], $this->content['CID'][$i]);
                     }
                     // GENERATING TEXT
                     if ($this->config['news_text_enabled'] == 1) {
                         $news_textt = $renderer->text($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $news_readmore);
                     }
                     // GENERATE NEWS INFO
                     if ($this->config['news_info_enabled'] == 1) {
                         $news_infoo = $renderer->info($this->config, $this->content['catname'][$i], $this->content['CID'][$i], $this->content['author'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['rating_count'][$i], $this->content['rating_sum'][$i]);
                     }
                     // GENERATE NEWS INFO2
                     if ($this->config['news_info2_enabled'] == 1) {
                         $news_infoo2 = $renderer->info($this->config, $this->content['catname'][$i], $this->content['CID'][$i], $this->content['author'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['rating_count'][$i], $this->content['rating_sum'][$i], 2);
                     }
                 } else {
                     if ($rs_mode == FALSE && $vm_mode == FALSE && $k2_mode == TRUE) {
                         // GENERATING HEADER
                         if ($this->config['news_header_enabled'] == 1) {
                             $news_header = $renderer->header_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['title'][$i]);
                         }
                         // GENERATING IMAGE
                         if ($this->config['news_image_enabled'] == 1) {
                             $news_image = $renderer->image_k2($this->config, $uri, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['text'][$i], $this->content['title'][$i]);
                         }
                         // GENERATING READMORE
                         if ($this->config['news_readmore_enabled'] == 1) {
                             $news_readmore = $renderer->readMore_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i]);
                         }
                         // GENERATING TEXT
                         if ($this->config['news_text_enabled'] == 1) {
                             $news_textt = $renderer->text_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['text'][$i], $news_readmore);
                         }
                         // GENERATE NEWS INFO
                         if ($this->config['news_info_enabled'] == 1) {
                             $news_infoo = $renderer->info_k2($this->config, $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['author'][$i], $this->content['author_id'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['alias'][$i], $this->content['comments'], $this->content['rating_count'][$i], $this->content['rating_sum'][$i]);
                         }
                         // GENERATE NEWS INFO2
                         if ($this->config['news_info2_enabled'] == 1) {
                             $news_infoo2 = $renderer->info_k2($this->config, $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['author'][$i], $this->content['author_id'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['alias'][$i], $this->content['comments'], $this->content['rating_count'][$i], $this->content['rating_sum'][$i], 2);
                         }
                         // GENERATE STORE BLOCK
                         $news_k2_store = $renderer->store_k2($this->config, $this->content['ID'][$i], $this->content['plugins'][$i], $this->k2store_params);
                     } else {
                         if ($rs_mode == TRUE && $vm_mode == FALSE && $k2_mode == FALSE) {
                             $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $this->content['ID'][$i]);
                             $id = $this->content['ID'][$i];
                             $cid = $producthelper->getCategoryProduct($this->content['ID'][$i]);
                             $Itemid = $redhelper->getItemid($this->content['ID'][$i]);
                             $product = $producthelper->getProductById($this->content['ID'][$i]);
                             // GENERATING HEADER
                             if ($this->config['news_header_enabled'] == 1) {
                                 $news_header = $renderer->header_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i], $Itemid);
                             }
                             // GENERATING IMAGE
                             if ($this->config['news_image_enabled'] == 1) {
                                 $news_image = $renderer->image_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['product_image'][$i], $this->content['title'][$i], $Itemid);
                             }
                             // GENERATING READMORE
                             if ($this->config['news_readmore_enabled'] == 1) {
                                 $news_readmore = $renderer->readMore_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $Itemid);
                             }
                             // GENERATING TEXT
                             if ($this->config['news_text_enabled'] == 1) {
                                 $news_textt = $renderer->text_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $news_readmore, $Itemid);
                             }
                             // GENERATE NEWS INFO
                             if ($this->config['news_info_enabled'] == 1) {
                                 $news_infoo = $renderer->info_rs($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $Itemid, $this->content['manufacturer_id'][$i], 1);
                             }
                             // GENERATE NEWS INFO2
                             if ($this->config['news_info2_enabled'] == 1) {
                                 $news_infoo2 = $renderer->info_rs($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $Itemid, $this->content['manufacturer_id'][$i], 2);
                             }
                             // COMPUTE PRICE DEPENDS OF USER ID
                             $user =& JFactory::getUser();
                             $price = $producthelper->getProductPrice($this->content['ID'][$i], $this->config['rs_price_with_vat'], $user->id);
                             $price = $producthelper->getProductFormattedPrice($price, true);
                             if ($this->config['rs_add_to_cart'] == 1) {
                                 $addToCart = $producthelper->replaceCartTemplate($this->content['ID'][$i], 0, 0, 0, "", false, array(), 0, 0, 0);
                                 $addToCart = str_replace('&', '&amp;', $addToCart);
                                 if ($this->config['rs_show_default_cart_button'] == 0) {
                                     $btnCode = '<a class=\'nspAddToCart\' onclick="if(displayAddtocartForm(\'addtocart_prd_' . $this->content['ID'][$i];
                                     $btnCode .= '\',\'' . $id . '\',\'0\',\'0\', \'user_fields_form\'))';
                                     $btnCode .= '{checkAddtocartValidation(\'addtocart_prd_' . $id . '\',\'' . $id . '\',\'0\',\'0\', \'user_fields_form\',\'0\',\'0\',\'0\');}"><span style=\'cursor: pointer;\' id=\'pdaddtocartprd' . $id . '\' title=\'\' class=\'\'>' . JText::_('MOD_NEWS_PRO_GK4_ADD_TO_CART') . '</span></a>';
                                     $addToCart = preg_replace('/\\<img.*?\\>/i', $btnCode, $addToCart);
                                 }
                             }
                             // GET THE CURRENCY
                             $bool = preg_match('/[^0-9]/u', $price, $currency);
                             $currency = $currency[0];
                             $bool = preg_match('/[0-9]+/u', $price, $price);
                             $price = $price[0];
                             // GENERATE RedSHOP STORE INFO
                             $news_rs_store = $renderer->store_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $price, $this->content['discount_start'][$i], $this->content['discount_end'][$i], $this->content['tax'][$i], $this->content['discount_price'][$i], $currency, $Itemid, $addToCart);
                         } else {
                             if ($vm_mode == TRUE) {
                                 // GENERATING HEADER
                                 if ($this->config['news_header_enabled'] == 1) {
                                     $news_header = $renderer->header_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i]);
                                 }
                                 // GENERATING IMAGE
                                 if ($this->config['news_image_enabled'] == 1) {
                                     $news_image = $renderer->image_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['product_image'][$i], $this->content['title'][$i]);
                                 }
                                 // GENERATING READMORE
                                 if ($this->config['news_readmore_enabled'] == 1) {
                                     $news_readmore = $renderer->readMore_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i]);
                                 }
                                 // GENERATING TEXT
                                 if ($this->config['news_text_enabled'] == 1) {
                                     $news_textt = $renderer->text_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $news_readmore);
                                 }
                                 // GENERATE NEWS INFO
                                 if ($this->config['news_info_enabled'] == 1) {
                                     $news_infoo = $renderer->info_vm($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['comments']);
                                 }
                                 // GENERATE NEWS INFO2
                                 if ($this->config['news_info2_enabled'] == 1) {
                                     $news_infoo2 = $renderer->info_vm($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['comments'], 2);
                                 }
                                 $news_vm_store = $renderer->store_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['price'][$i], $this->content['price_currency'][$i], $this->content['discount_amount'][$i], true, $this->content['discount_start'][$i], $this->content['discount_end'][$i], $this->content['tax'][$i], $this->content['manufacturer_id'][$i]);
                             }
                         }
                     }
                 }
                 // PARSING PLUGINS
                 if ($this->config['parse_plugins'] == TRUE) {
                     $news_textt = JHtml::_('content.prepare', $news_textt);
                 }
                 // CLEANING PLUGINS
                 if ($this->config['clean_plugins'] == TRUE) {
                     $news_textt = preg_replace("/(\\{.+?\\}.+?\\{.+?})|(\\{.+?\\})/", "", $news_textt);
                 }
                 // GENERATE CONTENT FOR TAB
                 $news_generated_content = '';
                 // initialize variable
                 //
                 for ($j = 1; $j < 7; $j++) {
                     if ($this->config['wrapContent'] == 1 && $this->config['news_image_order'] == 1) {
                         if ($j == 2) {
                             $news_generated_content .= '<div class="gkArtContentWrap">';
                         }
                     }
                     if ($this->config['news_header_order'] == $j) {
                         $news_generated_content .= $news_header;
                     }
                     if ($this->config['news_image_order'] == $j) {
                         $news_generated_content .= $news_image;
                     }
                     if ($this->config['news_text_order'] == $j) {
                         $news_generated_content .= $news_textt;
                     }
                     if ($this->config['news_info_order'] == $j) {
                         $news_generated_content .= $news_infoo;
                     }
                     if ($this->config['news_info2_order'] == $j) {
                         $news_generated_content .= $news_infoo2;
                     }
                     if ($this->config['news_rs_store_enabled'] != 'disabled') {
                         if ($rs_mode != FALSE && $this->config['news_rs_store_order'] == $j) {
                             $news_generated_content .= $news_rs_store;
                         }
                         if ($vm_mode != FALSE && $this->config['news_rs_store_order'] == $j) {
                             $news_generated_content .= $news_vm_store;
                         }
                         if ($k2_mode != FALSE && $this->config['news_rs_store_order'] == $j) {
                             $news_generated_content .= $news_k2_store;
                         }
                     }
                 }
                 //
                 if ($this->config['news_content_readmore_pos'] != 'after') {
                     $news_generated_content .= $news_readmore;
                 }
                 if ($this->config['wrapContent'] == 1 && $this->config['news_image_order'] == 1) {
                     $news_generated_content .= '</div>';
                 }
                 // creating table with news content
                 array_push($news_html_tab, $news_generated_content);
             } else {
                 if ($k2_mode == FALSE && $vm_mode == FALSE) {
                     array_push($news_list_tab, $renderer->lists($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i], $this->content['text'][$i], $li_counter % 2, $li_counter));
                 } elseif ($k2_mode == TRUE) {
                     array_push($news_list_tab, $renderer->lists_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['title'][$i], $this->content['text'][$i], $li_counter % 2, $li_counter));
                 } else {
                     array_push($news_list_tab, $renderer->lists_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i], $this->content['text'][$i], $li_counter % 2, $li_counter));
                 }
                 //
                 $li_counter++;
             }
         }
         /** GENERATING FINAL XHTML CODE START **/
         // create instances of basic Joomla! classes
         $document = JFactory::getDocument();
         $uri = JURI::getInstance();
         // add stylesheets to document header
         if ($this->config["useCSS"] == 1) {
             $document->addStyleSheet($uri->root() . 'modules/mod_news_pro_gk4/interface/css/style.css', 'text/css');
         }
         // add script to the document header
         if ($this->config['useScript'] == 1) {
             $document->addScript($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.js');
         }
         // init $headData variable
         $headData = false;
         // add scripts with automatic mode to document header
         if ($this->config['useScript'] == 2) {
             // getting module head section datas
             unset($headData);
             $headData = $document->getHeadData();
             // generate keys of script section
             $headData_keys = array_keys($headData["scripts"]);
             // set variable for false
             $engine_founded = false;
             // searching phrase mootools in scripts paths
             if (array_search($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.js', $headData_keys) > 0) {
                 $engine_founded = true;
             }
             // if engine doesn't exists in the head section
             if (!$engine_founded) {
                 // add new script tag connected with mootools from module
                 $document->addScript($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.js');
             }
         }
         //
         require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'content');
         require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'default');
     }
 }
Exemple #28
0
<?php

/**
 * @package     RedSHOP.Backend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
JHTML::_('behavior.tooltip');
//$editor =& JFactory::getEditor();
//JHTMLBehavior::modal();
//$uri =& JURI::getInstance();
//$url= $uri->root();
//jimport('joomla.html.pane');
$producthelper = new producthelper();
?>
<script language="javascript" type="text/javascript">
	Joomla.submitbutton = function (pressbutton) {
		submitbutton(pressbutton);
	}

	submitbutton = function (pressbutton) {
		var form = document.adminForm;
		if (pressbutton == 'cancel') {
			submitform(pressbutton);
			return;
		}
		if (form.product_price.value == "" || isNaN(form.product_price.value) || form.product_price.value == 0) {
			alert("Product Price must have valid value");
			form.product_price.focus();
Exemple #29
0
 public function displayQuotationUserfield($quotation_item_id = 0, $section_id = 12)
 {
     $redTemplate = new Redtemplate();
     $producthelper = new producthelper();
     $resultArr = array();
     $db = JFactory::getDbo();
     $sql = "SELECT fd.*,f.field_title,f.field_type,f.field_name " . "FROM " . $this->_table_prefix . "quotation_fields_data AS fd " . "LEFT JOIN " . $this->_table_prefix . "fields AS f ON f.field_id=fd.fieldid " . "WHERE fd.quotation_item_id= " . (int) $quotation_item_id . " AND fd.section = " . $db->quote($section_id);
     $db->setQuery($sql);
     $userfield = $db->loadObjectlist();
     if (count($userfield) > 0) {
         $quotationItem = $this->getQuotationProduct(0, $quotation_item_id);
         $product_id = $quotationItem[0]->product_id;
         $productdetail = $producthelper->getProductById($product_id);
         $productTemplate = $redTemplate->getTemplate("product", $productdetail->product_template);
         $returnArr = $producthelper->getProductUserfieldFromTemplate($productTemplate[0]->template_desc);
         $userFieldTag = $returnArr[1];
         for ($i = 0; $i < count($userFieldTag); $i++) {
             for ($j = 0; $j < count($userfield); $j++) {
                 if ($userfield[$j]->field_name == $userFieldTag[$i]) {
                     if ($userfield[$j]->field_type == 10) {
                         $files = explode(",", $userfield[$j]->data_txt);
                         $data_txt = "";
                         for ($f = 0; $f < count($files); $f++) {
                             $u_link = REDSHOP_FRONT_DOCUMENT_ABSPATH . "product/" . $files[$f];
                             $data_txt .= "<a href='" . $u_link . "'>" . $files[$f] . "</a> ";
                         }
                         $resultArr[] = $userfield[$j]->field_title . " : " . $data_txt;
                     } else {
                         $resultArr[] = $userfield[$j]->field_title . " : " . $userfield[$j]->data_txt;
                     }
                 }
             }
         }
     }
     $resultstr = "";
     if (count($resultArr) > 0) {
         $resultstr .= "<br/>" . implode("<br/>", $resultArr);
     }
     return $resultstr;
 }
Exemple #30
0
<?php

/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
JHTMLBehavior::modal();
$objhelper = new redhelper();
$config = new Redconfiguration();
$producthelper = new producthelper();
$extraField = new extraField();
$redTemplate = new Redtemplate();
$stockroomhelper = new rsstockroomhelper();
$url = JURI::base();
$model = $this->getModel('category');
$loadCategorytemplate = $redTemplate->getTemplate('categoryproduct');
if (count($loadCategorytemplate) > 0 && $loadCategorytemplate[0]->template_desc != "") {
    $template_desc = $loadCategorytemplate[0]->template_desc;
} else {
    $template_desc = "<div><div>{print}</div>";
    $template_desc .= "<div>{filter_by_lbl}{filter_by}</div>";
    $template_desc .= "<div>{order_by_lbl}{order_by}</div>";
    $template_desc .= "<p>{category_loop_start}</p>";
    $template_desc .= "<div style='border: 1px solid;'><div id='categories'><div style='width: 200px;'>";
    $template_desc .= "<div class='category_image'>{category_thumb_image}</div><div class='category_description'>";
    $template_desc .= "<h4 class='category_title'>{category_name}</h4>{category_description}</div></div></div>";