Exemplo n.º 1
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $Itemid = JRequest::getInt('Itemid');
     $user = JFactory::getUser();
     $session = JFactory::getSession();
     $auth = $session->get('auth');
     if ($user->id || isset($auth['users_info_id']) && $auth['users_info_id'] > 0) {
         $app->Redirect('index.php?option=com_redshop&view=account&Itemid=' . $Itemid);
     }
     $params = $app->getParams('com_redshop');
     JHTML::Script('joomla.javascript.js', 'includes/js/', false);
     JHTML::Script('jquery-1.4.2.min.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('jquery.validate.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('common.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('jquery.metadata.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('registration.js', 'components/com_redshop/assets/js/', false);
     JHTML::Stylesheet('validation.css', 'components/com_redshop/assets/css/');
     $field = new extraField();
     // Field_section 7 : Customer Registration
     $lists['extra_field_user'] = $field->list_all_field(7);
     // Field_section 8 : Company Address
     $lists['extra_field_company'] = $field->list_all_field(8);
     $this->lists = $lists;
     $this->params = $params;
     parent::display($tpl);
 }
Exemplo n.º 2
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $order_functions = new order_functions();
     // Extra_field;
     $extra_field = new extraField();
     $task = JRequest::getCmd('task');
     $user = JFactory::getUser();
     $uri = JFactory::getURI();
     // Preform security checks
     $session = JFactory::getSession();
     $auth = $session->get('auth');
     $params = $app->getParams('com_redshop');
     $lists = array();
     if ($user->id) {
         $billingaddresses = $order_functions->getBillingAddress($user->id);
     } elseif (isset($auth['users_info_id']) && $auth['users_info_id']) {
         $model = $this->getModel('account_shipto');
         $billingaddresses = $model->_loadData($auth['users_info_id']);
     } else {
         $app->Redirect('index.php?option=com_redshop&view=login&Itemid=' . JRequest::getInt('Itemid'));
         exit;
     }
     if ($task == 'addshipping') {
         JHTML::Script('jquery-1.4.2.min.js', 'components/com_redshop/assets/js/', false);
         JHTML::Script('jquery.validate.js', 'components/com_redshop/assets/js/', false);
         JHTML::Script('common.js', 'components/com_redshop/assets/js/', false);
         JHTML::Script('registration.js', 'components/com_redshop/assets/js/', false);
         JHTML::Stylesheet('validation.css', 'components/com_redshop/assets/css/');
         $shippingaddresses = $this->get('Data');
         if ($shippingaddresses->users_info_id > 0 && $shippingaddresses->user_id != $billingaddresses->user_id) {
             echo JText::_('COM_REDSHOP_ALERTNOTAUTH');
             return;
         }
         $lists['shipping_customer_field'] = $extra_field->list_all_field(14, $shippingaddresses->users_info_id);
         $lists['shipping_company_field'] = $extra_field->list_all_field(15, $shippingaddresses->users_info_id);
         $this->setLayout('form');
     } else {
         $shippingaddresses = $order_functions->getShippingAddress($user->id);
     }
     $this->lists = $lists;
     $this->shippingaddresses = $shippingaddresses;
     $this->billingaddresses = $billingaddresses;
     $this->request_url = $uri->toString();
     $this->params = $params;
     parent::display($tpl);
 }
Exemplo n.º 3
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a JError object.
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $extra_field = new extraField();
     $params = $app->getParams('com_redshop');
     $billingaddresses = $GLOBALS['billingaddresses'];
     if (count($billingaddresses) <= 0) {
         $model = $this->getModel('account_billto');
         $billingaddresses = $model->_initData();
     }
     $user = JFactory::getUser();
     $uri = JFactory::getURI();
     $session = JFactory::getSession();
     $auth = $session->get('auth');
     if (!is_array($auth)) {
         $auth['users_info_id'] = 0;
         $session->set('auth', $auth);
         $auth = $session->get('auth');
     }
     JHTML::Script('jquery-1.4.2.min.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('jquery.validate.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('common.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('registration.js', 'components/com_redshop/assets/js/', false);
     JHTML::Stylesheet('validation.css', 'components/com_redshop/assets/css/');
     // Preform security checks
     if ($user->id == 0 && $auth['users_info_id'] == 0) {
         $app->Redirect('index.php?option=com_redshop&view=login&Itemid=' . JRequest::getInt('Itemid'));
         exit;
     }
     $lists['requesting_tax_exempt'] = JHTML::_('select.booleanlist', 'requesting_tax_exempt', 'class="inputbox"', @$billingaddresses->requesting_tax_exempt);
     // Field_section 7 :Customer Address
     $lists['extra_field_user'] = $extra_field->list_all_field(7, @$billingaddresses->users_info_id);
     $lists['extra_field_company'] = $extra_field->list_all_field(8, @$billingaddresses->users_info_id);
     $this->lists = $lists;
     $this->billingaddresses = $billingaddresses;
     $this->request_url = $uri->toString();
     $this->params = $params;
     parent::display($tpl);
 }
Exemplo n.º 4
0
 /**
  * Display shipping extra field
  *
  * @return void
  */
 public function displayshippingextrafield()
 {
     ob_clean();
     $shipping_rate_id = JRequest::getCmd('shipping_rate_id', '');
     $shippingmethod = $this->_order_functions->getShippingMethodInfo($shipping_rate_id);
     $shippingparams = new JRegistry($shippingmethod[0]->params);
     $extrafield_shipping = $shippingparams->get('extrafield_shipping', '');
     $extraField = new extraField();
     $extrafield_total = "";
     if (count($extrafield_shipping) > 0) {
         for ($ui = 0; $ui < count($extrafield_shipping); $ui++) {
             if ($extrafield_shipping[$ui] != "") {
                 $product_userfileds = $extraField->list_all_user_fields($extrafield_shipping[$ui], 19, '', 0, 0, 0);
                 $extrafield_total .= $product_userfileds[0] . " " . $product_userfileds[1] . "<br>";
                 $extrafield_hidden .= "<input type='hidden' name='extrafields[]' value='" . $extrafield_shipping[$ui] . "'>";
             }
         }
         echo $extrafield_total . $extrafield_hidden;
         die;
     }
 }
Exemplo n.º 5
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;
JHtml::_('behavior.tooltip');
JHtmlBehavior::modal();
$url = JURI::base();
$u = JURI::getInstance();
$Scheme = $u->getScheme();
$print = $this->input->getBool('print', false);
$user = JFactory::getUser();
$extraField = new extraField();
$producthelper = new producthelper();
$redshopconfig = new Redconfiguration();
$stockroomhelper = new rsstockroomhelper();
$config = new Redconfiguration();
$template = $this->template;
if (count($template) > 0 && $template->template_desc != "") {
    $template_desc = $template->template_desc;
} else {
    $template_desc = "<div id=\"produkt\">\r\n<div class=\"produkt_spacer\"></div>\r\n<div class=\"produkt_anmeldelser_opsummering\">";
    $template_desc .= "{product_rating_summary}</div>\r\n<div id=\"opsummering_wrapper\">\r\n<div id=\"opsummering_skubber\"></div>\r\n";
    $template_desc .= "<div id=\"opsummering_link\">{product_rating_summary}</div>\r\n</div>\r\n<div id=\"produkt_kasse\">\r\n";
    $template_desc .= "<div class=\"produkt_kasse_venstre\">\r\n<div class=\"produkt_kasse_billed\">{product_thumb_image}</div>\r\n";
    $template_desc .= "<div class=\"produkt_kasse_billed_flere\">{more_images}</div>\r\n<div id=\"produkt_kasse_venstre_tekst\">";
    $template_desc .= "{view_full_size_image_lbl}</div>\r\n</div>\r\n<div class=\"produkt_kasse_hoejre\">\r\n{attribute_template:attributes}";
    $template_desc .= "<div class=\"produkt_kasse_hoejre_accessory\">{accessory_template:accessory}</div>\r\n";
Exemplo n.º 6
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'));
    ?>
">
Exemplo n.º 7
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>";
Exemplo n.º 8
0
if (isset($compare['idx']) && $compare['idx'] == 1) {
    $template = JText::_('COM_REDSHOP_ADD_ONE_MORE_PRODUCT_TO_COMPARE');
} elseif (isset($compare['idx']) && $compare['idx'] > 1) {
    $returnlink = JRoute::_("index.php?option=com_redshop&view=category&cid=" . $compare[$compare['idx'] - 1]["category_id"] . "&Itemid=" . $this->itemId);
    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=product&layout=compare&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 = str_replace("{print}", $print_tag, $template);
    $template = str_replace('{compare_product_heading}', $pagetitle, $template);
    $template = str_replace('{returntocategory_name}', JText::_("COM_REDSHOP_GO_BACK"), $template);
    $template = str_replace('{returntocategory_link}', $returnlink, $template);
    // Make extrafield object..
    $field = new extraField();
    $product_tag = array();
    if (count($compare_template) > 0) {
        $product_tag = $producthelper->product_tag($compare_template[0]->template_id, "1", $template);
    }
    for ($i = 0; $i < $compare['idx']; $i++) {
        $product = $producthelper->getProductById($compare[$i]["product_id"]);
        if ($i == $compare['idx'] - 1) {
            $td_start = "";
            $td_end = "";
        } else {
            $td_start = "<td>";
            $td_end = "</td>";
        }
        $exp_div = "<div name='exp_" . $product->product_id . "'>";
        $div_end = "</div>";
Exemplo n.º 9
0
$user = JFactory::getUser();
$option = 'com_redshop';
$document = JFactory::getDocument();
$document->addStyleSheet('modules/mod_redshop_products/css/products.css');
// Include redshop js file.
require_once JPATH_SITE . '/components/com_redshop/helpers/redshop.js.php';
JLoader::import('images', JPATH_ADMINISTRATOR . '/components/com_redshop/helpers');
// Lightbox Javascript
JHTML::Script('attribute.js', 'components/com_redshop/assets/js/', false);
JHTML::Script('common.js', 'components/com_redshop/assets/js/', false);
JHTML::Script('redBOX.js', 'components/com_redshop/assets/js/', false);
JHTML::Stylesheet('fetchscript.css', 'components/com_redshop/assets/css/');
$producthelper = new producthelper();
$redhelper = new redhelper();
$redTemplate = new Redtemplate();
$extraField = new extraField();
$stockroomhelper = new rsstockroomhelper();
$config = new Redconfiguration();
$module_id = "mod_" . $module->id;
echo "<div id='" . $module_id . "' class='mod_redshop_products_wrapper'>";
for ($i = 0; $i < count($rows); $i++) {
    $row = $rows[$i];
    if ($show_stockroom_status == 1) {
        $isStockExists = $stockroomhelper->isStockExists($row->product_id);
        if (!$isStockExists) {
            $isPreorderStockExists = $stockroomhelper->isPreorderStockExists($row->product_id);
        }
        if (!$isStockExists) {
            $product_preorder = $row->preorder;
            if ($product_preorder == "global" && ALLOW_PRE_ORDER || $product_preorder == "yes" || $product_preorder == "" && ALLOW_PRE_ORDER) {
                if (!$isPreorderStockExists) {
Exemplo n.º 10
0
 public function sendQuotationMail($quotation_id, $status = 0)
 {
     $uri = JURI::getInstance();
     $url = $uri->root();
     $redconfig = new Redconfiguration();
     $producthelper = new producthelper();
     $extra_field = new extra_field();
     $quotationHelper = new quotationHelper();
     $config = JFactory::getConfig();
     $mailinfo = $this->getMailtemplate(0, "quotation_mail");
     $mailbcc = array();
     if (count($mailinfo) > 0) {
         $message = $mailinfo[0]->mail_body;
         $subject = $mailinfo[0]->mail_subject;
         if (trim($mailinfo[0]->mail_bcc) != "") {
             $mailbcc = explode(",", $mailinfo[0]->mail_bcc);
         }
     } else {
         return false;
     }
     $template_start = "";
     $template_end = "";
     $template_middle = "";
     $cart = '';
     $template_sdata = explode('{product_loop_start}', $message);
     $extraField = new extraField();
     $fieldArray = $extraField->getSectionFieldList(17, 0, 0);
     if (count($template_sdata) > 0) {
         $template_start = $template_sdata[0];
         if (count($template_sdata) > 1) {
             $template_edata = explode('{product_loop_end}', $template_sdata[1]);
             if (count($template_edata) > 1) {
                 $template_end = $template_edata[1];
             }
             if (count($template_edata) > 0) {
                 $template_middle = $template_edata[0];
             }
         }
     }
     $row = $quotationHelper->getQuotationDetail($quotation_id);
     if (count($row) <= 0) {
         return false;
     }
     $rowitem = $quotationHelper->getQuotationProduct($quotation_id);
     for ($i = 0; $i < count($rowitem); $i++) {
         $product_id = $rowitem[$i]->product_id;
         $product = $producthelper->getProductById($product_id);
         $product_name = "<div class='product_name'>" . $rowitem[$i]->product_name . "</div>";
         $product_total_price = "<div class='product_price'>" . $producthelper->getProductFormattedPrice($rowitem[$i]->product_price * $rowitem[$i]->product_quantity) . "</div>";
         $product_price = "<div class='product_price'>" . $producthelper->getProductFormattedPrice($rowitem[$i]->product_price) . "</div>";
         $product_price_excl_vat = "<div class='product_price'>" . $producthelper->getProductFormattedPrice($rowitem[$i]->product_excl_price) . "</div>";
         $product_quantity = '<div class="update_cart">' . $rowitem[$i]->product_quantity . '</div>';
         $product_total_price_excl_vat = "<div class='product_price'>" . $producthelper->getProductFormattedPrice($rowitem[$i]->product_excl_price * $rowitem[$i]->product_quantity) . "</div>";
         $cart_mdata = $template_middle;
         $wrapper_name = "";
         if ($rowitem[$i]->product_wrapperid) {
             $wrapper = $producthelper->getWrapper($product_id, $rowitem[$i]->product_wrapperid);
             if (count($wrapper) > 0) {
                 $wrapper_name = $wrapper[0]->wrapper_name;
             }
             $wrapper_name = JText::_('COM_REDSHOP_WRAPPER') . ": " . $wrapper_name;
         }
         $product_image_path = '';
         if ($product->product_full_image) {
             if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . $product->product_full_image)) {
                 $product_image_path = $product->product_full_image;
             } else {
                 if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . PRODUCT_DEFAULT_IMAGE)) {
                     $product_image_path = PRODUCT_DEFAULT_IMAGE;
                 }
             }
         } else {
             if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . PRODUCT_DEFAULT_IMAGE)) {
                 $product_image_path = PRODUCT_DEFAULT_IMAGE;
             }
         }
         if ($product_image_path) {
             $thumbUrl = RedShopHelperImages::getImagePath($product_image_path, '', 'thumb', 'product', CART_THUMB_WIDTH, CART_THUMB_HEIGHT, USE_IMAGE_SIZE_SWAPPING);
             $product_image = "<div  class='product_image'><img src='" . $thumbUrl . "'></div>";
         } else {
             $product_image = "<div  class='product_image'></div>";
         }
         $cart_mdata = str_replace("{product_name}", $product_name, $cart_mdata);
         $cart_mdata = str_replace("{product_s_desc}", $product->product_s_desc, $cart_mdata);
         $cart_mdata = str_replace("{product_thumb_image}", $product_image, $cart_mdata);
         $product_note = "<div class='product_note'>" . $wrapper_name . "</div>";
         $cart_mdata = str_replace("{product_wrapper}", $product_note, $cart_mdata);
         $product_userfields = $quotationHelper->displayQuotationUserfield($rowitem[$i]->quotation_item_id, 12);
         $cart_mdata = str_replace("{product_userfields}", $product_userfields, $cart_mdata);
         $cart_mdata = str_replace("{product_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER'), $cart_mdata);
         $cart_mdata = str_replace("{product_number}", $product->product_number, $cart_mdata);
         $cart_mdata = str_replace("{product_attribute}", $producthelper->makeAttributeQuotation($rowitem[$i]->quotation_item_id, 0, $rowitem[$i]->product_id, $row->quotation_status), $cart_mdata);
         $cart_mdata = str_replace("{product_accessory}", $producthelper->makeAccessoryQuotation($rowitem[$i]->quotation_item_id, $row->quotation_status), $cart_mdata);
         // ProductFinderDatepicker Extra Field Start
         $cart_mdata = $producthelper->getProductFinderDatepickerValue($cart_mdata, $product_id, $fieldArray);
         // ProductFinderDatepicker Extra Field End
         if ($row->quotation_status == 1 && !SHOW_QUOTATION_PRICE) {
             $cart_mdata = str_replace("{product_price_excl_vat}", "", $cart_mdata);
             $cart_mdata = str_replace("{product_price}", " ", $cart_mdata);
             $cart_mdata = str_replace("{product_total_price}", " ", $cart_mdata);
             $cart_mdata = str_replace("{product_subtotal_excl_vat}", " ", $cart_mdata);
         } else {
             $cart_mdata = str_replace("{product_price_excl_vat}", $product_price_excl_vat, $cart_mdata);
             $cart_mdata = str_replace("{product_price}", $product_price, $cart_mdata);
             $cart_mdata = str_replace("{product_total_price}", $product_total_price, $cart_mdata);
             $cart_mdata = str_replace("{product_subtotal_excl_vat}", $product_total_price_excl_vat, $cart_mdata);
         }
         $cart_mdata = str_replace("{product_quantity}", $product_quantity, $cart_mdata);
         $cart .= $cart_mdata;
     }
     $message = $template_start . $cart . $template_end;
     $search[] = "{quotation_note}";
     $replace[] = $row->quotation_note;
     $search[] = "{shopname}";
     $replace[] = SHOP_NAME;
     $search[] = "{quotation_id}";
     $replace[] = $row->quotation_id;
     $search[] = "{quotation_number}";
     $replace[] = $row->quotation_number;
     $search[] = "{quotation_date}";
     $replace[] = $redconfig->convertDateFormat($row->quotation_cdate);
     $search[] = "{quotation_status}";
     $replace[] = $quotationHelper->getQuotationStatusName($row->quotation_status);
     $billadd = '';
     if ($row->user_id != 0) {
         $message = $this->_carthelper->replaceBillingAddress($message, $row);
     } else {
         if ($row->quotation_email != "") {
             $billadd .= JText::_("COM_REDSHOP_EMAIL") . ' : ' . $row->quotation_email . '<br />';
         }
         $message = str_replace("{billing_address_information_lbl}", JText::_('COM_REDSHOP_BILLING_ADDRESS_INFORMATION_LBL'), $message);
         if (strstr($message, "{quotation_custom_field_list}")) {
             $billadd .= $extra_field->list_all_field_display(16, $row->user_info_id, 1, $row->quotation_email);
             $message = str_replace("{quotation_custom_field_list}", "", $message);
         } else {
             $message = $extra_field->list_all_field_display(16, $row->user_info_id, 1, $row->quotation_email, $message);
         }
     }
     $search[] = "{billing_address}";
     $replace[] = $billadd;
     $total_lbl = '';
     $subtotal_lbl = '';
     $vat_lbl = '';
     if ($row->quotation_status != 1 || $row->quotation_status == 1 && SHOW_QUOTATION_PRICE) {
         $total_lbl = JText::_('COM_REDSHOP_TOTAL_LBL');
         $subtotal_lbl = JText::_('COM_REDSHOP_QUOTATION_SUBTOTAL');
         $vat_lbl = JText::_('COM_REDSHOP_QUOTATION_VAT');
     }
     $message = str_replace('{total_lbl}', $total_lbl, $message);
     $message = str_replace('{quotation_subtotal_lbl}', $subtotal_lbl, $message);
     $message = str_replace('{quotation_vat_lbl}', $vat_lbl, $message);
     $message = $this->_carthelper->replaceLabel($message);
     $search[] = "{quotation_note}";
     $replace[] = $row->quotation_note;
     if ($row->quotation_status == 1 && !SHOW_QUOTATION_PRICE) {
         $quotation_subtotal = " ";
         $quotation_total = " ";
         $quotation_discount = " ";
         $quotation_vat = " ";
         $quotation_subtotal_excl_vat = "";
     } else {
         $tax = $row->quotation_tax;
         if (VAT_RATE_AFTER_DISCOUNT) {
             $Discountvat = VAT_RATE_AFTER_DISCOUNT * $row->quotation_discount / (1 + VAT_RATE_AFTER_DISCOUNT);
             $row->quotation_discount = $row->quotation_discount - $Discountvat;
             $tax = $tax - $Discountvat;
         }
         if (VAT_RATE_AFTER_DISCOUNT) {
             $sp_discount = $row->quotation_special_discount * ($row->quotation_subtotal + $row->quotation_tax) / 100;
             $Discountspvat = $sp_discount * VAT_RATE_AFTER_DISCOUNT / (1 + VAT_RATE_AFTER_DISCOUNT);
             $DiscountspWithotVat = $sp_discount - $Discountspvat;
             $row->quotation_discount = $row->quotation_discount + $DiscountspWithotVat;
             $tax = $tax - $Discountspvat;
         }
         $quotation_subtotal_excl_vat = $producthelper->getProductFormattedPrice($row->quotation_subtotal);
         $quotation_subtotal_minus_discount = $producthelper->getProductFormattedPrice($row->quotation_subtotal - $row->quotation_discount);
         $quotation_subtotal = $producthelper->getProductFormattedPrice($row->quotation_subtotal);
         $quotation_total = $producthelper->getProductFormattedPrice($row->quotation_total);
         $quotation_discount = $producthelper->getProductFormattedPrice($row->quotation_discount);
         $quotation_vat = $producthelper->getProductFormattedPrice($row->quotation_tax);
     }
     $search[] = "{quotation_subtotal}";
     $replace[] = $quotation_subtotal;
     $search[] = "{quotation_total}";
     $replace[] = $quotation_total;
     $search[] = "{quotation_subtotal_minus_discount}";
     $replace[] = $quotation_subtotal_minus_discount;
     $search[] = "{quotation_subtotal_excl_vat}";
     $replace[] = $quotation_subtotal_excl_vat;
     $search[] = "{quotation_discount}";
     $replace[] = $quotation_discount;
     $search[] = "{quotation_vat}";
     $replace[] = $quotation_vat;
     $quotationdetailurl = JURI::root() . 'index.php?option=com_redshop&view=quotation_detail&quoid=' . $quotation_id . '&encr=' . $row->quotation_encrkey;
     $search[] = "{quotation_detail_link}";
     $replace[] = "<a href='" . $quotationdetailurl . "'>" . JText::_("COM_REDSHOP_QUOTATION_DETAILS") . "</a>";
     $message = str_replace($search, $replace, $message);
     $message = $this->imginmail($message);
     $email = $row->quotation_email;
     // Set the e-mail parameters
     $from = $config->getValue('mailfrom');
     $fromname = $config->getValue('fromname');
     $body = $message;
     $subject = str_replace($search, $replace, $subject);
     // Send the e-mail
     if ($email != "") {
         $bcc = null;
         if (trim(ADMINISTRATOR_EMAIL) != '') {
             $bcc = explode(",", trim(ADMINISTRATOR_EMAIL));
         }
         $bcc = array_merge($bcc, $mailbcc);
         if (!JUtility::sendMail($from, $fromname, $email, $subject, $body, 1, null, $bcc)) {
             $this->setError('ERROR_SENDING_QUOTATION_MAIL');
         }
     }
     if ($status != 0) {
         $quotationHelper->updateQuotationStatus($quotation_id, $status);
     }
     return true;
 }
Exemplo n.º 11
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();
require_once JPATH_COMPONENT . '/helpers/product.php';
$producthelper = new producthelper();
require_once JPATH_COMPONENT . '/helpers/extra_field.php';
$extraField = new extraField();
$url = JURI::base();
$layout = $this->input->getString('layout', '');
$relatedprd_id = $this->input->getInt('relatedprd_id', 0);
$ajaxdetal_template = $producthelper->getAjaxDetailboxTemplate($this->data);
?>
	<script type="text/javascript" language="javascript">//var J=jQuery.noConflict();</script>
	<div style="clear:both"></div>
<?php 
if (count($ajaxdetal_template) > 0) {
    $ajaxdetal_templatedata = $ajaxdetal_template->template_desc;
    $data_add = $ajaxdetal_templatedata;
    $data_add = str_replace('{product_name}', $this->data->product_name, $data_add);
    if ($this->data->product_price != 0) {
        $data_add = str_replace('{product_price}', $this->data->product_price, $data_add);
    } else {
Exemplo n.º 12
0
 /**
  * Add to wishlist function
  *
  * @access public
  * @return void
  */
 public function addtowishlist()
 {
     ob_clean();
     $app = JFactory::getApplication();
     $extraField = new extraField();
     $section = 12;
     $row_data = $extraField->getSectionFieldList($section);
     // GetVariables
     $producthelper = new producthelper();
     $cid = JRequest::getInt('cid');
     $user = JFactory::getUser();
     $Itemid = JRequest::getVar('Itemid');
     $option = JRequest::getVar('option');
     $ajaxvar = JRequest::getVar('ajaxon');
     $mywid = JRequest::getVar('wid');
     if ($ajaxvar == 1 && ($mywid == 1 || $mywid == 2)) {
         $post = JRequest::get('post');
         $post['product_id'] = JRequest::getVar('product_id');
         $proname = $producthelper->getProductById($post['product_id']);
         $post['view'] = JRequest::getVar('view');
         $post['task'] = JRequest::getVar('task');
         for ($i = 0; $i < count($row_data); $i++) {
             $field_name = $row_data[$i]->field_name;
             $type = $row_data[$i]->field_type;
             if (isset($post[$row_data[$i]->field_name])) {
                 $data_txt = $post[$row_data[$i]->field_name];
             } else {
                 $data_txt = '';
             }
             $tmpstr = strpbrk($data_txt, '`');
             if ($tmpstr) {
                 $tmparray = explode('`', $data_txt);
                 $tmp = new stdClass();
                 $tmp = @array_merge($tmp, $tmparray);
                 if (is_array($tmparray)) {
                     $data_txt = implode(",", $tmparray);
                 }
             }
             $post['productuserfield_' . $i] = $data_txt;
         }
     } else {
         $post = JRequest::get('post');
         $proname = $producthelper->getProductById($post['product_id']);
         for ($i = 0; $i < count($row_data); $i++) {
             $field_name = $row_data[$i]->field_name;
             $type = $row_data[$i]->field_type;
             if (isset($post[$row_data[$i]->field_name])) {
                 $data_txt = $post[$row_data[$i]->field_name];
             } else {
                 $data_txt = '';
             }
             $tmpstr = strpbrk($data_txt, '`');
             if ($tmpstr) {
                 $tmparray = explode('`', $data_txt);
                 $tmp = new stdClass();
                 $tmp = @array_merge($tmp, $tmparray);
                 if (is_array($tmparray)) {
                     $data_txt = implode(",", $tmparray);
                 }
             }
             $post['productuserfield_' . $i] = $data_txt;
         }
     }
     $rurl = "";
     if (isset($post['rurl'])) {
         $rurl = base64_decode($post['rurl']);
     }
     // Initiallize variable
     $post['user_id'] = $user->id;
     $post['cdate'] = time();
     $model = $this->getModel('product');
     if ($user->id && $ajaxvar != '1') {
         if ($model->checkWishlist($post['product_id']) == null) {
             if ($model->addToWishlist($post)) {
                 $app->enqueueMessage(JText::_('COM_REDSHOP_WISHLIST_SAVE_SUCCESSFULLY'));
             } else {
                 $app->enqueueMessage(JText::_('COM_REDSHOP_ERROR_SAVING_WISHLIST'));
             }
         } else {
             $app->enqueueMessage(JText::_('COM_REDSHOP_ALLREADY_ADDED_TO_WISHLIST'));
         }
     } else {
         // User can store wishlist in session
         if ($model->addtowishlist2session($post)) {
             $app->enqueueMessage(JText::_('COM_REDSHOP_WISHLIST_SAVE_SUCCESSFULLY'));
         } else {
             $app->enqueueMessage(JText::_('COM_REDSHOP_ALLREADY_ADDED_TO_WISHLIST'));
         }
     }
     if ($ajaxvar == 1) {
         sleep(2);
         $getproductimage = $producthelper->getProductById($post['product_id']);
         $finalproductimgname = $getproductimage->product_full_image;
         if ($finalproductimgname != '') {
             $mainimg = "product/" . $finalproductimgname;
         } else {
             $mainimg = 'noimage.jpg';
         }
         echo "<span id='basketWrap' ><a href='index.php?view=wishlist&task=viewwishlist&option=com_redshop&Itemid=" . JRequest::getVar('Itemid') . "&pid=" . $post['product_id'] . "'><img src='" . REDSHOP_FRONT_IMAGES_ABSPATH . $mainimg . "' height='30' width='30'/></a></span>:-:" . $proname->product_name . "";
         exit;
     } elseif ($mywid == 1) {
         $this->setRedirect('index.php?option=' . $option . 'wishlist=1&view=login&Itemid=' . $Itemid);
     }
     if ($rurl != "") {
         $this->setRedirect($rurl);
     } else {
         $this->setRedirect('index.php?option=' . $option . '&view=product&pid=' . $post['product_id'] . '&cid=' . $cid . '&Itemid=' . $Itemid);
     }
 }
Exemplo n.º 13
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();
JHTML::_('behavior.tooltip');
JHTMLBehavior::modal();
// Get product helper
require_once JPATH_ROOT . '/components/com_redshop/helpers/product.php';
$producthelper = new producthelper();
$configobj = new Redconfiguration();
$redTemplate = new Redtemplate();
$extraField = new extraField();
$session = JFactory::getSession();
$Itemid = JRequest::getInt('Itemid');
$wishlist_id = JRequest::getInt('wishlist_id');
$mail = JRequest::getInt('mail', 0);
$model = $this->getModel('account');
$user = JFactory::getUser();
$pagetitle = JText::_('COM_REDSHOP_MY_WISHLIST');
$window = JRequest::getInt('window');
if ($window == 1) {
    ?>
	<script type="text/javascript">window.parent.location.reload();</script>
	<?php 
    exit;
}
if ($this->params->get('show_page_heading', 1)) {
Exemplo n.º 14
0
function display_products($rows)
{
    $url = JURI::base();
    $extraField = new extraField();
    $session = JFactory::getSession();
    $producthelper = new producthelper();
    $redhelper = new redhelper();
    $config = new Redconfiguration();
    $redTemplate = new Redtemplate();
    $template = $redTemplate->getTemplate("wishlist_template");
    if (count($template) <= 0) {
        for ($i = 0; $i < count($rows); $i++) {
            $row = $rows[$i];
            $Itemid = $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);
            $product_price_discount = $producthelper->getProductNetPrice($row->product_id);
            echo "<div id='wishlist_box'>";
            if ($row->product_full_image) {
                echo $thum_image = "<div class='wishlist_left'><div class='mod_wishlist_product_image wishlist_image'>" . ($thum_image = $producthelper->getProductImage($row->product_id, $link, "85", "63") . "</div></div>");
            } else {
                $maindefaultpath = REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . PRODUCT_DEFAULT_IMAGE;
                echo $thum_image = "<div class='wishlist_left'><div class='mod_wishlist_product_image wishlist_image'><a href='" . $link . "'><img src='" . $maindefaultpath . "' height='85' width='63' /></a></div></div>";
            }
            echo "<div class='wishlist_center'><div class='wishlist_title'><a href='" . $link . "'>" . $row->product_name . "</a></div><br>";
            if (!$row->not_for_sale) {
                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 wishlist_price'>" . $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 wishlist_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>";
                        }
                    } else {
                        echo "<div class='mod_redproducts_price wishlist_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>";
                    }
                } else {
                    echo "<div class='mod_redproducts_price wishlist_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>";
                }
            }
            echo "<br><div class='wishlist_readmore'><a href='" . $link . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a></div>&nbsp;</div> ";
            $addtocartdata = $producthelper->replaceCartTemplate($row->product_id, 0, 0, $row->product_id);
            echo "<div class='wishlist_right'>" . $addtocartdata . "</div><br class='clear' /></div><br class='clear' />";
        }
    } else {
        $ph_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT;
        $pw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH;
        $wishlist_data1 = $template[0]->template_desc;
        $mlink = JURI::root() . "index.php?option=com_redshop&view=account&layout=mywishlist&mail=1&tmpl=component&wishlist_id=" . $wishlist_id;
        $mail_link = '<a class="redcolorproductimg" href="' . $mlink . '"  ><img src="' . REDSHOP_ADMIN_IMAGES_ABSPATH . 'mailcenter16.png" ></a>';
        $wishlist_data1 = str_replace('{mail_link}', $mail_link, $wishlist_data1);
        $template_d1 = explode("{product_loop_start}", $wishlist_data1);
        $template_d2 = explode("{product_loop_end}", $template_d1[1]);
        $temp_template = '';
        $extraFieldName = $extraField->getSectionFieldNameArray(1, 1, 1);
        for ($i = 0; $i < count($rows); $i++) {
            $row = $rows[$i];
            $wishlist_data = $template_d2[0];
            $Itemid = $redhelper->getItemid($rows[$i]->product_id);
            $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $rows[$i]->product_id . '&Itemid=' . $Itemid);
            $product_price = $producthelper->getProductPrice($row->product_id);
            $product_price_discount = $producthelper->getProductNetPrice($row->product_id);
            if ($row->product_full_image) {
                $thum_image = $producthelper->getProductImage($row->product_id, $link, $pw_thumb, $ph_thumb);
                $wishlist_data = str_replace('{product_thumb_image}', $thum_image, $wishlist_data);
            } else {
                $maindefaultpath = RedShopHelperImages::getImagePath(PRODUCT_DEFAULT_IMAGE, '', 'thumb', 'product', $pw_thumb, $ph_thumb, USE_IMAGE_SIZE_SWAPPING);
                $thum_image = "<a href='" . $link . "'><img src='" . $maindefaultpath . "'  /></a>";
                $wishlist_data = str_replace('{product_thumb_image}', $thum_image, $wishlist_data);
            }
            $pname = "<a href='" . $link . "'>" . $row->product_name . "</a>";
            $pnumber = $row->product_number;
            $pdesc = $row->product_s_desc;
            // Checking for child products start
            if (strstr($wishlist_data, "{child_products}")) {
                $parentproductid = $row->product_id;
                if ($this->data->product_parent_id != 0) {
                    $parentproductid = $producthelper->getMainParentProduct($row->product_id);
                }
                $frmChild = "";
                if ($parentproductid != 0) {
                    $productInfo = $producthelper->getProductById($parentproductid);
                    // Get child products
                    $childproducts = $model->getAllChildProductArrayList(0, $parentproductid);
                    if (count($childproducts) > 0) {
                        $childproducts = array_merge(array($productInfo), $childproducts);
                        $cld_name = array();
                        if (count($childproducts) > 0) {
                            $parentid = 0;
                            for ($c = 0; $c < count($childproducts); $c++) {
                                if ($childproducts[$c]->product_parent_id == 0) {
                                    $level = "";
                                } else {
                                    if ($parentid != $childproducts[$c]->product_parent_id) {
                                        $level = $level;
                                    }
                                }
                                $parentid = $childproducts[$c]->product_parent_id;
                                $childproducts[$c]->product_name = $level . $childproducts[$c]->product_name;
                            }
                            $cld_name = @array_merge($cld_name, $childproducts);
                        }
                        $selected = array($row->product_id);
                        $lists['product_child_id'] = JHTML::_('select.genericlist', $cld_name, 'pid', 'class="inputbox" size="1"  onchange="document.frmChild.submit();"', 'product_id', 'product_name', $selected);
                        $frmChild .= "<form name='frmChild' method='get'>";
                        $frmChild .= JText::_('COM_REDSHOP_CHILD_PRODUCTS') . $lists['product_child_id'];
                        $frmChild .= "<input type='hidden' name='Itemid' value='" . $Itemid . "'>";
                        $frmChild .= "<input type='hidden' name='cid' value='" . $row->category_id . "'>";
                        $frmChild .= "<input type='hidden' name='view' value='product'>";
                        $frmChild .= "<input type='hidden' name='option' value='com_redshop'>";
                        $frmChild .= "</form>";
                    }
                }
                $wishlist_data = str_replace("{child_products}", $frmChild, $wishlist_data);
            }
            $childproduct = $producthelper->getChildProduct($row->product_id);
            if (count($childproduct) > 0) {
                if (PURCHASE_PARENT_WITH_CHILD == 1) {
                    $isChilds = false;
                    $attributes_set = array();
                    if ($row->attribute_set_id > 0) {
                        $attributes_set = $producthelper->getProductAttribute(0, $row->attribute_set_id, 0, 1);
                    }
                    $attributes = $producthelper->getProductAttribute($row->product_id);
                    $attributes = array_merge($attributes, $wishlist_data);
                } else {
                    $isChilds = true;
                    $attributes = array();
                }
            } else {
                $isChilds = false;
                $attributes_set = array();
                if ($row->attribute_set_id > 0) {
                    $attributes_set = $producthelper->getProductAttribute(0, $row->attribute_set_id, 0, 1);
                }
                $attributes = $producthelper->getProductAttribute($row->product_id);
                $attributes = array_merge($attributes, $attributes_set);
            }
            $attribute_template = $producthelper->getAttributeTemplate($wishlist_data);
            // Check product for not for sale
            $wishlist_data = $producthelper->getProductNotForSaleComment($row, $wishlist_data, $attributes);
            $wishlist_data = $producthelper->replaceProductInStock($row->product_id, $wishlist_data, $attributes, $attribute_template);
            /////////////////////////////////// Product attribute  Start /////////////////////////////////
            $totalatt = count($attributes);
            $wishlist_data = $producthelper->replaceAttributeData($row->product_id, 0, 0, $attributes, $wishlist_data, $attribute_template, $isChilds);
            /////////////////////////////////// Product attribute  End  	// Checking for child products end/////////////////////////////////
            if (!$row->not_for_sale) {
                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) {
                            $mainproduct_price = $producthelper->getProductFormattedPrice($product_price);
                            $product_price = $product_price_discount;
                            $mainproduct_price = $producthelper->getProductFormattedPrice($product_price_discount);
                        } else {
                            $product_price = $product_price_discount;
                            $mainproduct_price = $producthelper->getProductFormattedPrice($product_price);
                        }
                    } else {
                        $mainproduct_price = $producthelper->getProductFormattedPrice($product_price);
                    }
                } else {
                    $mainproduct_price = $producthelper->getProductFormattedPrice($product_price);
                }
                $wishlist_data = str_replace('{product_price}', $mainproduct_price, $wishlist_data);
            }
            // Product User Field Start
            $count_no_user_field = 0;
            $returnArr = $producthelper->getProductUserfieldFromTemplate($wishlist_data);
            $template_userfield = $returnArr[0];
            $userfieldArr = $returnArr[1];
            if (strstr($wishlist_data, "{if product_userfield}") && strstr($wishlist_data, "{product_userfield end if}") && $template_userfield != "") {
                $ufield = "";
                $cart = $session->get('cart');
                if (isset($cart['idx'])) {
                    $idx = (int) $cart['idx'];
                }
                $idx = 0;
                $cart_id = '';
                for ($j = 0; $j < $idx; $j++) {
                    if ($cart[$j]['product_id'] == $row->product_id) {
                        $cart_id = $j;
                    }
                }
                for ($ui = 0; $ui < count($userfieldArr); $ui++) {
                    if (!$idx) {
                        $cart_id = "";
                    }
                    $mysesspro = "productuserfield_" . $ui;
                    for ($check_i = 1; $check_i <= $_SESSION["no_of_prod"]; $check_i++) {
                        if ($_SESSION['wish_' . $check_i]->product_id == $row->product_id) {
                            $product_userfileds_final = $_SESSION['wish_' . $check_i]->{$mysesspro};
                        }
                    }
                    if ($product_userfileds_final != '') {
                        $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', '', 0, $row->product_id, $product_userfileds_final, 1);
                    } else {
                        $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', $cart_id, 0, $row->product_id);
                    }
                    $ufield .= $product_userfileds[1];
                    //
                    if ($product_userfileds[1] != "") {
                        $count_no_user_field++;
                    }
                    if ($product_userfileds_final != '') {
                        $wishlist_data = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $wishlist_data);
                        $wishlist_data = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $wishlist_data);
                    } else {
                        $wishlist_data = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $wishlist_data);
                        $wishlist_data = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $wishlist_data);
                    }
                }
                $product_userfileds_form = "<form method='post' action='' id='user_fields_form' name='user_fields_form'>";
                if ($ufield != "") {
                    $wishlist_data = str_replace("{if product_userfield}", $product_userfileds_form, $wishlist_data);
                    $wishlist_data = str_replace("{product_userfield end if}", "</form>", $wishlist_data);
                } else {
                    $wishlist_data = str_replace("{if product_userfield}", "", $wishlist_data);
                    $wishlist_data = str_replace("{product_userfield end if}", "", $wishlist_data);
                }
            }
            // Product User Field End
            /////////////////////////////////// Product accessory Start /////////////////////////////////
            $accessory = $producthelper->getProductAccessory(0, $row->product_id);
            $totalAccessory = count($accessory);
            $wishlist_data = $producthelper->replaceAccessoryData($row->product_id, 0, $accessory, $wishlist_data, $isChilds);
            /////////////////////////////////// Product accessory End /////////////////////////////////
            $wishlist_data = str_replace('{product_name}', $pname, $wishlist_data);
            $wishlist_data = str_replace('{product_number}', $pnumber, $wishlist_data);
            $wishlist_data = str_replace('{product_s_desc}', $pdesc, $wishlist_data);
            $wishlist_data = $producthelper->getExtraSectionTag($extraFieldName, $row->product_id, "1", $wishlist_data, 1);
            $wishlist_data = $producthelper->replaceCartTemplate($row->product_id, $row->category_id, 0, 0, $wishlist_data, $isChilds, $userfieldArr, $totalatt, $totalAccessory, $count_no_user_field);
            $rmore = "<a href='" . $link . "' title='" . $row->product_name . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>";
            $wishlist_data = str_replace("{read_more}", $rmore, $wishlist_data);
            $wishlist_data = str_replace("{read_more_link}", $link, $wishlist_data);
            $wishlist_data = str_replace("{product_loop_start}", '', $wishlist_data);
            $wishlist_data = str_replace("{product_loop_end}", '', $wishlist_data);
            $wishlist_data = str_replace("{back_link}", '', $wishlist_data);
            $wishlist_data = str_replace("{back_link}", '', $wishlist_data);
            $wishlist_data = str_replace("{mail_link}", '', $wishlist_data);
            $wishlist_data = str_replace("{if product_on_sale}", '', $wishlist_data);
            $wishlist_data = str_replace("{product_on_sale end if}", '', $wishlist_data);
            $wishlist_data = str_replace("<table></table>", '', $wishlist_data);
            $wishlist_data = str_replace("{all_cart}", '', $wishlist_data);
            $wishlist_data = str_replace("{if product_on_sale}", "", $wishlist_data);
            $wishlist_data = str_replace("{product_on_sale end if}", "", $wishlist_data);
            $regdellink = JRoute::_("index.php?mydel=1&view=wishlist&wishlist_id=" . $row->product_id . "&task=mysessdelwishlist");
            $mainregdellink = "<div><a href=\"" . $regdellink . "\">" . JText::_('COM_REDSHOP_REMOVE_PRODUCT_FROM_WISHLIST') . "</a></div>";
            $wishlist_data = str_replace('{remove_product_link}', $mainregdellink, $wishlist_data);
            $mainid .= $row->product_id . ",";
            $totattid .= $totalatt . ",";
            $totcount_no_user_field .= $count_no_user_field . ",";
            $temp_template .= $wishlist_data;
        }
        $my = "<form name='frm' method='POST' action=''>";
        $my .= "<input type='hidden' name='product_id' id='product_id' value='" . $mainid . "' >\n\n\t\t\t<input type='hidden' name='totacc_id' id='totacc_id' value='" . $totattid . "' >\n\t\t\t<input type='hidden' name='totcount_no_user_field' id='totcount_no_user_field' value='" . $totcount_no_user_field . "' >\n\t\t\t<input type='button' name='submit' onclick='return productalladdprice();' value='" . JText::_('COM_REDSHOP_ADD_TO_CART') . "'>\n\t\t\t</form>";
        $data = $template_d1[0] . $temp_template . $template_d2[1];
        $data = str_replace('{back_link}', '', $data);
        $data = str_replace('{all_cart}', $my, $data);
        $data = $redTemplate->parseredSHOPplugin($data);
        echo eval("?>" . $data . "<?php ");
    }
}
Exemplo n.º 15
0
 public function store($data)
 {
     $row = $this->getTable();
     if (!$row->bind($data)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     } else {
         $db = JFactory::getDbo();
         $product_id = JRequest::getInt('product_id');
         if ($product_id) {
             $ins_query = "INSERT INTO " . $this->_table_prefix . "wishlist_product " . " SET wishlist_id=" . (int) $row->wishlist_id . ", product_id=" . (int) $product_id . ", cdate = " . $db->quote(time());
             $db->setQuery($ins_query);
             if ($db->Query()) {
                 return true;
             } else {
                 return false;
             }
         } elseif (!empty($_SESSION["no_of_prod"])) {
             ob_clean();
             $extraField = new extraField();
             $section = 12;
             $row_data = $extraField->getSectionFieldList($section);
             for ($si = 1; $si <= $_SESSION["no_of_prod"]; $si++) {
                 for ($k = 0; $k < count($row_data); $k++) {
                     $myfield = "productuserfield_" . $k;
                     if ($_SESSION['wish_' . $si]->{$myfield} != '') {
                         $myuserdata = $_SESSION['wish_' . $si]->{$myfield};
                         $ins_query = "INSERT INTO #__redshop_wishlist_userfielddata SET " . " wishlist_id = " . (int) $row->wishlist_id . " , product_id = " . (int) $_SESSION['wish_' . $si]->product_id . ", userfielddata = " . $db->quote($myuserdata);
                         $db->setQuery($ins_query);
                         $db->Query();
                     }
                 }
                 $ins_query = "INSERT INTO #__redshop_wishlist_product SET " . " wishlist_id = " . (int) $row->wishlist_id . ", product_id = " . (int) $_SESSION['wish_' . $si]->product_id . ", cdate = " . $db->quote($_SESSION['wish_' . $si]->cdate);
                 $db->setQuery($ins_query);
                 $db->Query();
                 unset($_SESSION['wish_' . $si]);
             }
             unset($_SESSION["no_of_prod"]);
         }
     }
     return true;
 }
Exemplo n.º 16
0
 public function addtowishlist2session($data)
 {
     ob_clean();
     $extraField = new extraField();
     $section = 12;
     $row_data = $extraField->getSectionFieldList($section);
     for ($check_i = 1; $check_i <= $_SESSION["no_of_prod"]; $check_i++) {
         if ($_SESSION['wish_' . $check_i]->product_id == $data['product_id']) {
             if ($data['task'] != "") {
                 unset($_SESSION["no_of_prod"]);
             }
         }
     }
     $_SESSION["no_of_prod"] += 1;
     $no_prod_i = 'wish_' . $_SESSION["no_of_prod"];
     $_SESSION[$no_prod_i]->product_id = $data['product_id'];
     $_SESSION[$no_prod_i]->comment = isset($data['comment']) ? $data['comment'] : "";
     $_SESSION[$no_prod_i]->cdate = $data['cdate'];
     for ($k = 0; $k < count($row_data); $k++) {
         $myfield = "productuserfield_" . $k;
         $_SESSION[$no_prod_i]->{$myfield} = $data['productuserfield_' . $k];
     }
     return true;
 }
Exemplo n.º 17
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();
require_once JPATH_COMPONENT . '/helpers/extra_field.php';
$producthelper = new producthelper();
$objhelper = new redhelper();
$extraField = new extraField();
$redTemplate = new Redtemplate();
$model = $this->getModel('giftcard');
$url = JURI::base();
$itemid = JRequest::getInt('Itemid');
$gid = JRequest::getInt('gid', 0, '', 'int');
$session = JFactory::getSession();
$cart = $session->get('cart');
$pagetitle = $this->pageheadingtag;
$detail = $this->detail;
$app = JFactory::getApplication();
$router = $app->getRouter();
if (count($this->template) > 0) {
    $template = $this->template[0]->template_desc;
} else {
    if ($gid != 0) {
Exemplo n.º 18
0
 public function replacePaymentTemplate($template_desc = "", $payment_method_id = 0, $is_company = 0, $ean_number = 0)
 {
     $ccdata = $this->_session->get('ccdata');
     $rsUserhelper = new rsUserhelper();
     $url = JURI::base();
     $user = JFactory::getUser();
     $user_id = $user->id;
     $cc_list = array();
     $cc_list['VISA'] = new stdClass();
     $cc_list['VISA']->img = 'visa.jpg';
     $cc_list['MC'] = new stdClass();
     $cc_list['MC']->img = 'master.jpg';
     $cc_list['amex'] = new stdClass();
     $cc_list['amex']->img = 'blue.jpg';
     $cc_list['maestro'] = new stdClass();
     $cc_list['maestro']->img = 'mastero.jpg';
     $cc_list['jcb'] = new stdClass();
     $cc_list['jcb']->img = 'jcb.jpg';
     $cc_list['diners'] = new stdClass();
     $cc_list['diners']->img = 'dinnersclub.jpg';
     $montharr = array();
     $montharr[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_MONTH'));
     $montharr[] = JHTML::_('select.option', '01', JText::_('COM_REDSHOP_JAN'));
     $montharr[] = JHTML::_('select.option', '02', JText::_('COM_REDSHOP_FEB'));
     $montharr[] = JHTML::_('select.option', '03', JText::_('COM_REDSHOP_MAR'));
     $montharr[] = JHTML::_('select.option', '04', JText::_('COM_REDSHOP_APR'));
     $montharr[] = JHTML::_('select.option', '05', JText::_('COM_REDSHOP_MAY'));
     $montharr[] = JHTML::_('select.option', '06', JText::_('COM_REDSHOP_JUN'));
     $montharr[] = JHTML::_('select.option', '07', JText::_('COM_REDSHOP_JUL'));
     $montharr[] = JHTML::_('select.option', '08', JText::_('COM_REDSHOP_AUG'));
     $montharr[] = JHTML::_('select.option', '09', JText::_('COM_REDSHOP_SEP'));
     $montharr[] = JHTML::_('select.option', '10', JText::_('COM_REDSHOP_OCT'));
     $montharr[] = JHTML::_('select.option', '11', JText::_('COM_REDSHOP_NOV'));
     $montharr[] = JHTML::_('select.option', '12', JText::_('COM_REDSHOP_DEC'));
     $paymentmethod = JPluginHelper::getPlugin('redshop_payment');
     $template_desc = str_replace("{payment_heading}", JText::_('COM_REDSHOP_PAYMENT_METHOD'), $template_desc);
     if (strstr($template_desc, "{split_payment}")) {
         if (SPLITABLE_PAYMENT == 1) {
             $splitpayment = '<input type="checkbox" name="issplit" value="1">' . JText::_('COM_REDSHOP_SPLIT_PAYMENT') . '?';
             $template_desc = str_replace("{split_payment}", $splitpayment, $template_desc);
         } else {
             $template_desc = str_replace("{split_payment}", "", $template_desc);
         }
     }
     if (strstr($template_desc, "{payment_loop_start}") && strstr($template_desc, "{payment_loop_end}")) {
         $template1 = explode("{payment_loop_start}", $template_desc);
         $template1 = explode("{payment_loop_end}", $template1[1]);
         $template_middle = $template1[0];
         $shopperGroupId = $rsUserhelper->getShopperGroup($user_id);
         $payment_display = "";
         $flag = false;
         for ($p = 0; $p < count($paymentmethod); $p++) {
             $cardinfo = "";
             $display_payment = "";
             $paymentFilePath = JPATH_SITE . '/plugins/redshop_payment/' . $paymentmethod[$p]->name . '/' . $paymentmethod[$p]->name . '.php';
             if (file_exists($paymentFilePath)) {
                 $paymentpath = JPATH_SITE . '/plugins/redshop_payment/' . $paymentmethod[$p]->name . '/' . $paymentmethod[$p]->name . '.php';
                 include_once $paymentpath;
                 $paymentparams = new JRegistry($paymentmethod[$p]->params);
                 $private_person = $paymentparams->get('private_person', '');
                 $business = $paymentparams->get('business', '');
                 $is_creditcard = $paymentparams->get('is_creditcard', 0);
                 $shopper_group = $paymentparams->get('shopper_group_id');
                 if (!is_array($shopper_group)) {
                     $shopper_groupArr = array();
                     $shopper_groupArr[0] = $shopper_group;
                     if ($shopper_group == '') {
                         $shopper_groupArr[0] = 0;
                     }
                 } else {
                     $shopper_groupArr = $shopper_group;
                 }
                 if (in_array($shopperGroupId, $shopper_groupArr) || $shopper_groupArr[0] == 0) {
                     if ($flag == false) {
                         if (count($paymentmethod) > 0) {
                             $payment_method_id = $paymentmethod[$p]->name;
                         }
                     }
                     $checked = '';
                     if ($payment_method_id === $paymentmethod[$p]->name) {
                         $checked = "checked";
                     }
                     $payment_chcked_class = '';
                     if ($payment_method_id == $paymentmethod[$p]->name) {
                         $payment_chcked_class = "paymentgtwchecked";
                     }
                     $payment_radio_output = '<div id="' . $paymentmethod[$p]->name . '" class="' . $payment_chcked_class . '"><input  type="radio" name="payment_method_id" id="' . $paymentmethod[$p]->name . $p . '" value="' . $paymentmethod[$p]->name . '" ' . $checked . ' onclick="javascript:onestepCheckoutProcess(this.name,\'\');" /><label for="' . $paymentmethod[$p]->name . $p . '">' . JText::_('PLG_' . strtoupper($paymentmethod[$p]->name)) . '</label></div>';
                     $is_subscription = false;
                     if ($paymentmethod[$p]->name == 'rs_payment_eantransfer' || $paymentmethod[$p]->name == 'rs_payment_cashtransfer' || $paymentmethod[$p]->name == 'rs_payment_banktransfer' || $paymentmethod[$p]->name == "rs_payment_banktransfer2" || $paymentmethod[$p]->name == "rs_payment_banktransfer3" || $paymentmethod[$p]->name == "rs_payment_banktransfer4" || $paymentmethod[$p]->name == "rs_payment_banktransfer5") {
                         if ($is_company == 0 && $private_person == 1) {
                             $display_payment = $payment_radio_output;
                             $flag = true;
                         } else {
                             if ($is_company == 1 && $business == 1 && ($paymentmethod[$p]->name != 'rs_payment_eantransfer' || $paymentmethod[$p]->name == 'rs_payment_eantransfer' && $ean_number == 1)) {
                                 $display_payment = $payment_radio_output;
                                 $flag = true;
                             }
                         }
                     } elseif ($is_subscription) {
                         $display_payment = '<input id="' . $paymentmethod[$p]->name . $p . '" type="radio" name="payment_method_id" value="' . $paymentmethod[$p]->name . '" ' . $checked . ' onclick="javascript:onestepCheckoutProcess(this.name);" />' . '<label for="' . $paymentmethod[$p]->name . $p . '">' . JText::_($paymentmethod[$p]->name) . '</label><br>';
                         $display_payment .= '<table><tr><td>' . JText::_('COM_REDSHOP_SUBSCRIPTION_PLAN') . '</td><td>' . $this->getSubscriptionPlans() . '<td></tr><table>';
                     } else {
                         $display_payment = $payment_radio_output;
                         $flag = true;
                     }
                     if ($is_creditcard) {
                         $cardinfo = '<div id="divcardinfo_' . $paymentmethod[$p]->name . '">';
                         if ($checked != "" && ONESTEP_CHECKOUT_ENABLE) {
                             $cardinfo .= $this->replaceCreditCardInformation($paymentmethod[$p]->name);
                         }
                         $cardinfo .= '</div>';
                     }
                 }
             }
             $payment_display .= $template_middle;
             $payment_display = str_replace("{payment_method_name}", $display_payment, $payment_display);
             $payment_display = str_replace("{creditcard_information}", $cardinfo, $payment_display);
         }
         $template_desc = str_replace("{payment_loop_start}", "", $template_desc);
         $template_desc = str_replace("{payment_loop_end}", "", $template_desc);
         $template_desc = str_replace($template_middle, $payment_display, $template_desc);
     }
     $extrafield_total = '';
     if (strstr($template_desc, "{payment_extrafields}")) {
         $extraField = new extraField();
         $paymentparams_new = new JRegistry($paymentmethod[0]->params);
         $extrafield_payment = $paymentparams_new->get('extrafield_payment');
         $extrafield_total = '';
         $extrafield_hidden = '';
         if (count($extrafield_payment) > 0) {
             for ($ui = 0; $ui < count($extrafield_payment); $ui++) {
                 $product_userfileds = $extraField->list_all_user_fields($extrafield_payment[$ui], 18, '', 0, 0, 0);
                 $extrafield_total .= $product_userfileds[0] . " " . $product_userfileds[1] . "<br>";
                 $extrafield_hidden .= "<input type='hidden' name='extrafields[]' value='" . $extrafield_payment[$ui] . "'>";
             }
             $template_desc = str_replace("{payment_extrafields}", "<div id='extrafield_payment'>" . $extrafield_total . $extrafield_hidden . "</div>", $template_desc);
         } else {
             $template_desc = str_replace("{payment_extrafields}", "<div id='extrafield_payment'></div>", $template_desc);
         }
     }
     if (count($paymentmethod) == 1 && $is_creditcard == "0" && $extrafield_total == "") {
         $template_desc = "<div style='display:none;'>" . $template_desc . "</div>";
     }
     return $template_desc;
 }
Exemplo n.º 19
0
 */
defined('_JEXEC') or die;
$producthelper = new producthelper();
$config = new Redconfiguration();
$related_product = $producthelper->getRelatedProduct($this->pid);
$template = $this->input->getString('template', '');
$relptemplate = $this->redTemplate->getTemplate("related_product", 0, $template);
$related_template = $relptemplate[0]->template_desc;
if (count($relptemplate) > 0) {
    $related_template_data = '';
    $product_start = explode("{related_product_start}", $related_template);
    $product_end = explode("{related_product_end}", $product_start[1]);
    $tempdata_div_start = $product_start[0];
    $tempdata_div_middle = $product_end[0];
    $tempdata_div_end = $product_end[1];
    $extra_field = new extraField();
    $fieldArray = $extra_field->getSectionFieldList(17, 0, 0);
    $attribute_template = $producthelper->getAttributeTemplate($tempdata_div_middle);
    /************************************************************ **********************************************/
    for ($r = 0; $r < count($related_product); $r++) {
        $related_template_data .= $tempdata_div_middle;
        $rlink = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $related_product[$r]->product_id . '&Itemid=' . $this->itemId);
        if (strstr($related_template_data, "{relproduct_image_3}")) {
            $rpimg_tag = '{relproduct_image_3}';
            $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT_3;
            $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH_3;
        } elseif (strstr($related_template_data, "{relproduct_image_2}")) {
            $rpimg_tag = '{relproduct_image_2}';
            $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT_2;
            $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH_2;
        } elseif (strstr($related_template_data, "{relproduct_image_1}")) {
Exemplo n.º 20
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>";
     }
 }
Exemplo n.º 21
0
 /**
  * getCompanyOrCustomer
  *
  * @return  string
  */
 public function getCompanyOrCustomer()
 {
     $redTemplate = new Redtemplate();
     $rsUserhelper = new rsUserhelper();
     $extraField = new extraField();
     $get = JRequest::get('get');
     $template_id = $get['template_id'];
     $is_company = $get['is_company'];
     $lists['extra_field_user'] = $extraField->list_all_field(7);
     $lists['extra_field_company'] = $extraField->list_all_field(8);
     $lists['shipping_customer_field'] = $extraField->list_all_field(14, 0, 'billingRequired valid');
     $lists['shipping_company_field'] = $extraField->list_all_field(15, 0, 'billingRequired valid');
     $lists['isAjax'] = 1;
     if ($is_company == 1) {
         $template = $redTemplate->getTemplate("company_billing_template", $template_id);
         if (count($template) > 0 && $template[0]->template_desc != "") {
             $template_desc = $template[0]->template_desc;
         } else {
             $template_desc = '<table class="admintable" style="height: 221px;" border="0" width="183"><tbody><tr><td width="100" align="right">{email_lbl}:</td><td>{email}</td><td><span class="required">*</span></td></tr><!-- {retype_email_start} --><tr><td width="100" align="right">{retype_email_lbl}</td><td>{retype_email}</td><td><span class="required">*</span></td></tr><!-- {retype_email_end} --><tr><td width="100" align="right">{company_name_lbl}</td><td>{company_name}</td><td><span class="required">*</span></td></tr><!-- {vat_number_start} --><tr><td width="100" align="right">{vat_number_lbl}</td><td>{vat_number}</td><td><span class="required">*</span></td></tr><!-- {vat_number_end} --><tr><td width="100" align="right">{firstname_lbl}</td><td>{firstname}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{lastname_lbl}</td><td>{lastname}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{address_lbl}</td><td>{address}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{zipcode_lbl}</td><td>{zipcode}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{city_lbl}</td><td>{city}</td><td><span class="required">*</span></td></tr><tr id="{country_txtid}" style="{country_style}"><td width="100" align="right">{country_lbl}</td><td>{country}</td><td><span class="required">*</span></td></tr><tr id="{state_txtid}" style="{state_style}"><td width="100" align="right">{state_lbl}</td><td>{state}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{phone_lbl}</td><td>{phone}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{ean_number_lbl}</td><td>{ean_number}</td><td></td></tr><tr><td width="100" align="right">{tax_exempt_lbl}</td><td>{tax_exempt}</td></tr><tr><td colspan="3">{company_extrafield}</td></tr></tbody></table>';
         }
         $template_desc = $rsUserhelper->replaceCompanyCustomer($template_desc, $get, $lists);
     } else {
         $template = $redTemplate->getTemplate("private_billing_template", $template_id);
         if (count($template) > 0 && $template[0]->template_desc != "") {
             $template_desc = $template[0]->template_desc;
         } else {
             $template_desc = '<table class="admintable" style="height: 221px;" border="0" width="183"><tbody><tr><td width="100" align="right">{email_lbl}:</td><td>{email}</td><td><span class="required">*</span></td></tr><!-- {retype_email_start} --><tr><td width="100" align="right">{retype_email_lbl}</td><td>{retype_email}</td><td><span class="required">*</span></td></tr><!-- {retype_email_end} --><tr><td width="100" align="right">{firstname_lbl}</td><td>{firstname}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{lastname_lbl}</td><td>{lastname}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{address_lbl}</td><td>{address}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{zipcode_lbl}</td><td>{zipcode}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{city_lbl}</td><td>{city}</td><td><span class="required">*</span></td></tr><tr id="{country_txtid}" style="{country_style}"><td width="100" align="right">{country_lbl}</td><td>{country}</td><td><span class="required">*</span></td></tr><tr id="{state_txtid}" style="{state_style}"><td width="100" align="right">{state_lbl}</td><td>{state}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{phone_lbl}</td><td>{phone}</td><td><span class="required">*</span></td></tr><tr><td colspan="3">{private_extrafield}</td></tr></tbody></table>';
         }
         $template_desc = $rsUserhelper->replacePrivateCustomer($template_desc, $get, $lists);
     }
     echo $return = "<div id='ajaxRegistrationDiv'>" . $template_desc . "</div>";
     die;
 }
Exemplo n.º 22
0
 public function getPaymentandShippingExtrafields($order, $section_id)
 {
     $extraField = new extraField();
     $row_data = $extraField->getSectionFieldList($section_id, 1);
     $resultArr = array();
     for ($j = 0; $j < count($row_data); $j++) {
         $main_result = $extraField->getSectionFieldDataList($row_data[$j]->field_id, $section_id, $order->order_id);
         if ($main_result->data_txt != "" && $row_data[$j]->field_show_in_front == 1) {
             $resultArr[] = $main_result->field_title . " : " . $main_result->data_txt;
         }
     }
     $resultstr = "";
     if (count($resultArr) > 0) {
         $resultstr = implode("<br/>", $resultArr);
     }
     return $resultstr;
 }
Exemplo n.º 23
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $model = $this->getModel('checkout');
     $Itemid = JRequest::getInt('Itemid');
     $task = JRequest::getCmd('task');
     $user = JFactory::getUser();
     $redhelper = new redhelper();
     $field = new extraField();
     $session = JFactory::getSession();
     // Load language file
     $payment_lang_list = $redhelper->getPlugins("redshop_payment");
     $language = JFactory::getLanguage();
     $base_dir = JPATH_ADMINISTRATOR;
     $language_tag = $language->getTag();
     for ($l = 0; $l < count($payment_lang_list); $l++) {
         $extension = 'plg_redshop_payment_' . $payment_lang_list[$l]->element;
         $language->load($extension, $base_dir, $language_tag, true);
     }
     JHTML::Script('joomla.javascript.js', 'includes/js/', false);
     JHTML::Script('validate.js', 'media/system/js/', false);
     JHTML::Script('jquery-1.4.2.min.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('jquery.validate.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('common.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('jquery.metadata.js', 'components/com_redshop/assets/js/', false);
     JHTML::Script('registration.js', 'components/com_redshop/assets/js/', false);
     JHTML::Stylesheet('validation.css', 'components/com_redshop/assets/css/');
     JHTML::Script('redBOX.js', 'components/com_redshop/assets/js/', false);
     if (JPluginHelper::isEnabled('redshop_veis_registration', 'rs_veis_registration')) {
         JHTML::Script('veis.js', 'plugins/redshop_veis_registration/rs_veis_registration/js/', false);
     }
     $cart = $session->get('cart');
     $auth = $session->get('auth');
     if (!is_array($auth)) {
         $auth['users_info_id'] = 0;
         $session->set('auth', $auth);
         $auth = $session->get('auth');
     }
     if ($cart['idx'] < 1) {
         $msg = JText::_('COM_REDSHOP_EMPTY_CART');
         $link = 'index.php?option=com_redshop&Itemid=' . $Itemid;
         $app->Redirect($link, $msg);
     }
     $lists = array();
     if ($task != '') {
         $tpl = $task;
     } else {
         if ($user->id || $auth['users_info_id'] > 0) {
             $cart = $session->get('cart');
             if (DEFAULT_QUOTATION_MODE == 1 && !array_key_exists("quotation_id", $cart)) {
                 $app->Redirect('index.php?option=com_redshop&view=quotation&Itemid=' . $Itemid);
             }
             $users_info_id = JRequest::getInt('users_info_id');
             $billingaddresses = $model->billingaddresses();
             $shippingaddresses = $model->shippingaddresses();
             if (!$users_info_id) {
                 if ((!isset($users_info_id) || $users_info_id == 0) && count($shippingaddresses) > 0) {
                     $users_info_id = $shippingaddresses[0]->users_info_id;
                 } elseif ((!isset($users_info_id) || $users_info_id == 0) && count($billingaddresses) > 0) {
                     $users_info_id = $billingaddresses->users_info_id;
                 } else {
                     $app->Redirect("index.php?option=com_redshop&view=account_billto&Itemid=" . $Itemid);
                 }
             }
             $shipping_rate_id = JRequest::getInt('shipping_rate_id');
             $element = JRequest::getCmd('payment_method_id');
             $ccinfo = JRequest::getInt('ccinfo');
             $total_discount = $cart['cart_discount'] + $cart['voucher_discount'] + $cart['coupon_discount'];
             $subtotal = SHIPPING_AFTER == 'total' ? $cart['product_subtotal'] - $total_discount : $cart['product_subtotal'];
             $this->users_info_id = $users_info_id;
             $this->shipping_rate_id = $shipping_rate_id;
             $this->element = $element;
             $this->ccinfo = $ccinfo;
             $this->order_subtotal = $subtotal;
             $this->ordertotal = $cart['total'];
         } else {
             // Field_section 6 : Customer Registration
             $lists['extra_field_user'] = $field->list_all_field(7);
             // Field_section 6 : Company Address
             $lists['extra_field_company'] = $field->list_all_field(8);
             $lists['shipping_customer_field'] = $field->list_all_field(14, 0, 'billingRequired valid');
             $lists['shipping_company_field'] = $field->list_all_field(15, 0, 'billingRequired valid');
         }
     }
     if (($user->id || $auth['users_info_id'] > 0) && ONESTEP_CHECKOUT_ENABLE) {
         $this->setLayout('onestepcheckout');
     }
     $this->lists = $lists;
     parent::display($tpl);
 }