Esempio n. 1
0
 private static function getProductDetail($id)
 {
     $component = JComponentHelper::getComponent("com_redshop");
     if (!isset($component->id)) {
         JError::raiseError('500', 'redShop Component is not installed');
     }
     if (!defined('TABLE_PREFIX')) {
         require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redshop.cfg.php';
     }
     require_once JPATH_SITE . '/components/com_redshop/helpers/helper.php';
     $objhelper = new redhelper();
     $producthelper = new producthelper();
     $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $id);
     if (count($ItemData) > 0) {
         $pItemid = $ItemData->id;
     } else {
         $pItemid = $objhelper->getItemid($id);
     }
     $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $id . '&Itemid=' . $pItemid);
     $product = $producthelper->getProductById($id);
     $product->product_price = $producthelper->getProductPrice($id);
     $product->link = $link;
     return $product;
 }
Esempio n. 2
0
 public function getRelatedtemplateView($template_desc, $product_id)
 {
     $extra_field = new extraField();
     $config = new Redconfiguration();
     $redTemplate = new Redtemplate();
     $redhelper = new redhelper();
     $related_product = $this->getRelatedProduct($product_id);
     $related_template = $this->getRelatedProductTemplate($template_desc);
     $option = 'com_redshop';
     $fieldArray = $extra_field->getSectionFieldList(17, 0, 0);
     if (count($related_template) > 0) {
         if (count($related_product) > 0 && strstr($related_template->template_desc, "{related_product_start}") && strstr($related_template->template_desc, "{related_product_end}")) {
             $related_template_data = '';
             $product_start = explode("{related_product_start}", $related_template->template_desc);
             $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];
             $attribute_template = $this->getAttributeTemplate($tempdata_div_middle);
             for ($r = 0; $r < count($related_product); $r++) {
                 $related_template_data .= $tempdata_div_middle;
                 $ItemData = $this->getMenuInformation(0, 0, '', 'product&pid=' . $related_product[$r]->product_id);
                 if (count($ItemData) > 0) {
                     $pItemid = $ItemData->id;
                 } else {
                     $pItemid = $redhelper->getItemid($related_product[$r]->product_id);
                 }
                 $rlink = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $related_product[$r]->product_id . '&Itemid=' . $pItemid);
                 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}")) {
                     $rpimg_tag = '{relproduct_image_1}';
                     $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT;
                     $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH;
                 } else {
                     $rpimg_tag = '{relproduct_image}';
                     $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT;
                     $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH;
                 }
                 $hidden_thumb_image = "<input type='hidden' name='rel_main_imgwidth' id='rel_main_imgwidth' value='" . $rpw_thumb . "'><input type='hidden' name='rel_main_imgheight' id='rel_main_imgheight' value='" . $rph_thumb . "'>";
                 $relimage = $this->getProductImage($related_product[$r]->product_id, $rlink, $rpw_thumb, $rph_thumb);
                 $related_template_data = str_replace($rpimg_tag, $relimage . $hidden_thumb_image, $related_template_data);
                 if (strstr($related_template_data, "{relproduct_link}")) {
                     $rpname = "<a href='" . $rlink . "' title='" . $related_product[$r]->product_name . "'>" . $config->maxchar($related_product[$r]->product_name, RELATED_PRODUCT_TITLE_MAX_CHARS, RELATED_PRODUCT_TITLE_END_SUFFIX) . "</a>";
                 } else {
                     $rpname = $config->maxchar($related_product[$r]->product_name, RELATED_PRODUCT_TITLE_MAX_CHARS, RELATED_PRODUCT_TITLE_END_SUFFIX);
                 }
                 $rpdesc = $config->maxchar($related_product[$r]->product_desc, RELATED_PRODUCT_DESC_MAX_CHARS, RELATED_PRODUCT_DESC_END_SUFFIX);
                 $rp_shortdesc = $config->maxchar($related_product[$r]->product_s_desc, RELATED_PRODUCT_SHORT_DESC_MAX_CHARS, RELATED_PRODUCT_SHORT_DESC_END_SUFFIX);
                 $related_template_data = str_replace("{relproduct_link}", '', $related_template_data);
                 if (strstr($related_template_data, "{relproduct_link}")) {
                     $related_template_data = str_replace("{relproduct_name}", "", $related_template_data);
                 } else {
                     $related_template_data = str_replace("{relproduct_name}", $rpname, $related_template_data);
                 }
                 $related_template_data = str_replace("{relproduct_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER_LBL'), $related_template_data);
                 $related_template_data = str_replace("{relproduct_number}", $related_product[$r]->product_number, $related_template_data);
                 $related_template_data = str_replace("{relproduct_s_desc}", $rp_shortdesc, $related_template_data);
                 $related_template_data = str_replace("{relproduct_desc}", $rpdesc, $related_template_data);
                 // ProductFinderDatepicker Extra Field Start
                 $related_template_data = $this->getProductFinderDatepickerValue($related_template_data, $related_product[$r]->product_id, $fieldArray);
                 // ProductFinderDatepicker Extra Field End
                 if (strstr($related_template_data, "{manufacturer_name}") || strstr($related_template_data, "{manufacturer_link}")) {
                     $manufacturer = $this->getSection("manufacturer", $related_product[$r]->manufacturer_id);
                     if (count($manufacturer) > 0) {
                         $man_url = JRoute::_('index.php?option=' . $option . '&view=manufacturers&layout=products&mid=' . $related_product[$r]->manufacturer_id . '&Itemid=' . $pItemid);
                         $manufacturerLink = "<a href='" . $man_url . "'>" . JText::_("COM_REDSHOP_VIEW_ALL_MANUFACTURER_PRODUCTS") . "</a>";
                         $related_template_data = str_replace("{manufacturer_name}", $manufacturer->manufacturer_name, $related_template_data);
                         $related_template_data = str_replace("{manufacturer_link}", $manufacturerLink, $related_template_data);
                     } else {
                         $related_template_data = str_replace("{manufacturer_name}", '', $related_template_data);
                         $related_template_data = str_replace("{manufacturer_link}", '', $related_template_data);
                     }
                 }
                 $relmorelink = JRoute::_('index.php?option=' . $option . '&view=product&pid=' . $related_product[$r]->product_id . '&cid=' . $related_product[$r]->cat_in_sefurl . '&Itemid=' . $pItemid);
                 $rmore = "<a href='" . $relmorelink . "' title='" . $related_product[$r]->product_name . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>";
                 $related_template_data = str_replace("{read_more}", $rmore, $related_template_data);
                 $related_template_data = str_replace("{read_more_link}", $relmorelink, $related_template_data);
                 /*
                  *  related product Required Attribute start
                  * 	this will parse only Required Attributes
                  */
                 $relid = $related_product[$r]->product_id;
                 $attributes_set = array();
                 if ($related_product[$r]->attribute_set_id > 0) {
                     $attributes_set = $this->getProductAttribute(0, $related_product[$r]->attribute_set_id);
                 }
                 $attributes = $this->getProductAttribute($relid);
                 $attributes = array_merge($attributes, $attributes_set);
                 $related_template_data = $this->replaceAttributeData($related_product[$r]->mainproduct_id, 0, $related_product[$r]->product_id, $attributes, $related_template_data, $attribute_template);
                 // Check product for not for sale
                 $related_template_data = $this->getProductNotForSaleComment($related_product[$r], $related_template_data, $attributes, 1);
                 $related_template_data = $this->replaceCartTemplate($related_product[$r]->mainproduct_id, 0, 0, $related_product[$r]->product_id, $related_template_data, false, 0, count($attributes), 0, 0);
                 $related_template_data = $this->replaceCompareProductsButton($related_product[$r]->product_id, 0, $related_template_data, 1);
                 $related_template_data = $this->replaceProductInStock($related_product[$r]->product_id, $related_template_data);
                 $related_template_data = $this->getProductOnSaleComment($related_product[$r], $related_template_data);
                 $related_template_data = $this->getSpecialProductComment($related_product[$r], $related_template_data);
                 // related product attribute price list
                 $related_template_data = $this->replaceAttributePriceList($related_product[$r]->product_id, $related_template_data);
             }
             $related_template_data = $tempdata_div_start . $related_template_data . $tempdata_div_end;
             $template_desc = str_replace("{related_product:{$related_template->template_name}}", $related_template_data, $template_desc);
             $template_desc = $redTemplate->parseredSHOPplugin($template_desc);
         } else {
             $template_desc = str_replace("{related_product:{$related_template->template_name}}", "", $template_desc);
         }
     }
     return $template_desc;
 }
Esempio n. 3
0
    $doc->addStyleDeclaration('html { overflow:scroll; }');
}
// 	Getting the configuration
require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redshop.cfg.php';
require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/configuration.php';
$Redconfiguration = new Redconfiguration();
$Redconfiguration->defineDynamicVars();
require_once JPATH_SITE . '/components/com_redshop/helpers/currency.php';
$session = JFactory::getSession('product_currency');
$post = JRequest::get('POST');
$Itemid = JRequest::getVar('Itemid');
require_once JPATH_SITE . '/components/com_redshop/helpers/helper.php';
$redhelper = new redhelper();
$cart_Itemid = $redhelper->getCartItemid();
if ($cart_Itemid == "" || $cart_Itemid == 0) {
    $cItemid = $redhelper->getItemid();
    $tmpItemid = $cItemid;
} else {
    $tmpItemid = $cart_Itemid;
}
if (isset($post['product_currency'])) {
    $session->set('product_currency', $post['product_currency']);
}
$currency_symbol = REDCURRENCY_SYMBOL;
$currency_convert = 1;
$script = "\n\t\twindow.site_url = '" . JURI::root() . "';\n\t\twindow.AJAX_CART_BOX = '" . AJAX_CART_BOX . "';\n\t\twindow.REDSHOP_VIEW = '" . $view . "';\n\t\twindow.REDSHOP_LAYOUT = '" . $layout . "';\n\t\twindow.DEFAULT_CUSTOMER_REGISTER_TYPE = '" . DEFAULT_CUSTOMER_REGISTER_TYPE . "';\n\t\twindow.AJAX_CART_URL = '" . JRoute::_('index.php?option=com_redshop&view=cart&Itemid=' . $tmpItemid, false) . "';\n\t\twindow.REDCURRENCY_SYMBOL = '" . REDCURRENCY_SYMBOL . "';\n\t\twindow.CURRENCY_SYMBOL_CONVERT = '" . $currency_symbol . "';\n\t\twindow.CURRENCY_CONVERT = '" . $currency_convert . "';\n\t\twindow.PRICE_SEPERATOR = '" . PRICE_SEPERATOR . "';\n\t\twindow.COM_REDSHOP_PRODUCT_OUTOFSTOCK_MESSAGE = '" . JText::_('COM_REDSHOP_PRODUCT_OUTOFSTOCK_MESSAGE') . "';\n\t\twindow.COM_REDSHOP_PREORDER_PRODUCT_OUTOFSTOCK_MESSAGE = '" . JText::_('COM_REDSHOP_PREORDER_PRODUCT_OUTOFSTOCK_MESSAGE') . "';\n\t\twindow.CURRENCY_SYMBOL_POSITION = '" . CURRENCY_SYMBOL_POSITION . "';\n\t\twindow.PRICE_DECIMAL = '" . PRICE_DECIMAL . "';\n\t\twindow.COM_REDSHOP_PASSWORD_MIN_CHARACTER_LIMIT = '" . JText::_('COM_REDSHOP_PASSWORD_MIN_CHARACTER_LIMIT') . "';\n\t\twindow.THOUSAND_SEPERATOR = '" . THOUSAND_SEPERATOR . "';\n\t\twindow.COM_REDSHOP_VIEW_CART = '" . JText::_('COM_REDSHOP_VIEW_CART') . "';\n\t\twindow.COM_REDSHOP_CONTINUE_SHOPPING = '" . JText::_('COM_REDSHOP_CONTINUE_SHOPPING') . "';\n\t\twindow.COM_REDSHOP_YOUR_MUST_PROVIDE_A_VALID_PHONE = '" . JText::_('COM_REDSHOP_YOUR_MUST_PROVIDE_A_VALID_PHONE') . "';\n\t\twindow.COM_REDSHOP_CART_SAVE = '" . JText::_('COM_REDSHOP_CART_SAVE') . "';\n\t\twindow.COM_REDSHOP_IS_REQUIRED = '" . JText::_('COM_REDSHOP_IS_REQUIRED') . "';\n\t\twindow.COM_REDSHOP_ENTER_NUMBER = '" . JText::_('COM_REDSHOP_ENTER_NUMBER') . "';\n\t\twindow.USE_STOCKROOM = '" . USE_STOCKROOM . "';\n\t\twindow.USE_AS_CATALOG = '" . USE_AS_CATALOG . "';\n\t\twindow.AJAX_CART_DISPLAY_TIME = '" . AJAX_CART_DISPLAY_TIME . "';\n\t\twindow.SHOW_PRICE = '" . SHOW_PRICE . "';\n\t\twindow.DEFAULT_QUOTATION_MODE = '" . DEFAULT_QUOTATION_MODE . "';\n\t\twindow.PRICE_REPLACE = '" . PRICE_REPLACE . "';\n\t\twindow.PRICE_REPLACE_URL = '" . PRICE_REPLACE_URL . "';\n\t\twindow.ZERO_PRICE_REPLACE = '" . ZERO_PRICE_REPLACE . "';\n\t\twindow.ZERO_PRICE_REPLACE_URL = '" . ZERO_PRICE_REPLACE_URL . "';\n\t\twindow.OPTIONAL_SHIPPING_ADDRESS = '" . OPTIONAL_SHIPPING_ADDRESS . "';\n\t\twindow.SHIPPING_METHOD_ENABLE = '" . SHIPPING_METHOD_ENABLE . "';\n\t\twindow.PRODUCT_ADDIMG_IS_LIGHTBOX = '" . PRODUCT_ADDIMG_IS_LIGHTBOX . "';\n\t\twindow.ALLOW_PRE_ORDER = '" . ALLOW_PRE_ORDER . "';\n\t\twindow.ATTRIBUTE_SCROLLER_THUMB_WIDTH = '" . ATTRIBUTE_SCROLLER_THUMB_WIDTH . "';\n\t\twindow.ATTRIBUTE_SCROLLER_THUMB_HEIGHT = '" . ATTRIBUTE_SCROLLER_THUMB_HEIGHT . "';\n\t\twindow.PRODUCT_DETAIL_IS_LIGHTBOX = '" . PRODUCT_DETAIL_IS_LIGHTBOX . "';\n\t\twindow.REQUIRED_VAT_NUMBER = '" . REQUIRED_VAT_NUMBER . "';\n\t\twindow.COM_REDSHOP_PLEASE_ENTER_COMPANY_NAME = '" . JText::_('COM_REDSHOP_PLEASE_ENTER_COMPANY_NAME', true) . "';\n\t\twindow.COM_REDSHOP_YOUR_MUST_PROVIDE_A_FIRSTNAME = '" . JText::_('COM_REDSHOP_YOUR_MUST_PROVIDE_A_FIRSTNAME', true) . "';\n\t\twindow.COM_REDSHOP_YOUR_MUST_PROVIDE_A_LASTNAME = '" . JText::_('COM_REDSHOP_YOUR_MUST_PROVIDE_A_LASTNAME', true) . "';\n\t\twindow.COM_REDSHOP_YOUR_MUST_PROVIDE_A_ADDRESS = '" . JText::_('COM_REDSHOP_YOUR_MUST_PROVIDE_A_ADDRESS', true) . "';\n\t\twindow.COM_REDSHOP_YOUR_MUST_PROVIDE_A_ZIP = '" . JText::_('COM_REDSHOP_YOUR_MUST_PROVIDE_A_ZIP', true) . "';\n\t\twindow.COM_REDSHOP_YOUR_MUST_PROVIDE_A_CITY = '" . JText::_('COM_REDSHOP_YOUR_MUST_PROVIDE_A_CITY', true) . "';\n\t\twindow.COM_REDSHOP_YOUR_MUST_PROVIDE_A_PHONE = '" . JText::_('COM_REDSHOP_YOUR_MUST_PROVIDE_A_PHONE', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_REQUIRED = '" . JText::_('COM_REDSHOP_THIS_FIELD_REQUIRED', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_REMOTE = '" . JText::_('COM_REDSHOP_THIS_FIELD_REMOTE', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_URL= '" . JText::_('COM_REDSHOP_THIS_FIELD_URL', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_DATE= '" . JText::_('COM_REDSHOP_THIS_FIELD_DATE', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_DATEISO= '" . JText::_('COM_REDSHOP_THIS_FIELD_DATEISO', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_NUMBER= '" . JText::_('COM_REDSHOP_THIS_FIELD_NUMBER', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_DIGITS= '" . JText::_('COM_REDSHOP_THIS_FIELD_DIGITS', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_CREDITCARD= '" . JText::_('COM_REDSHOP_THIS_FIELD_CREDITCARD', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_EQUALTO= '" . JText::_('COM_REDSHOP_THIS_FIELD_EQUALTO', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_ACCEPT= '" . JText::_('COM_REDSHOP_THIS_FIELD_ACCEPT', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_MAXLENGTH= '" . JText::_('COM_REDSHOP_THIS_FIELD_MAXLENGTH', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_MINLENGTH= '" . JText::_('COM_REDSHOP_THIS_FIELD_MINLENGTH', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_RANGELENGTH= '" . JText::_('COM_REDSHOP_THIS_FIELD_RANGELENGTH', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_RANGE= '" . JText::_('COM_REDSHOP_THIS_FIELD_RANGE', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_MAX= '" . JText::_('COM_REDSHOP_THIS_FIELD_MAX', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_MIN= '" . JText::_('COM_REDSHOP_THIS_FIELD_MIN', true) . "';\n\t\twindow.COM_REDSHOP_YOU_MUST_PROVIDE_LOGIN_NAME = '" . JText::_('COM_REDSHOP_YOU_MUST_PROVIDE_LOGIN_NAME', true) . "';\n\t\twindow.COM_REDSHOP_PROVIDE_EMAIL_ADDRESS = '" . JText::_('COM_REDSHOP_PROVIDE_EMAIL_ADDRESS', true) . "';\n\t\twindow.COM_REDSHOP_EMAIL_NOT_MATCH = '" . JText::_('COM_REDSHOP_EMAIL_NOT_MATCH', true) . "';\n\t\twindow.COM_REDSHOP_PASSWORD_NOT_MATCH = '" . JText::_('COM_REDSHOP_PASSWORD_NOT_MATCH', true) . "';\n\t\twindow.NOOF_SUBATTRIB_THUMB_FOR_SCROLLER = '" . NOOF_SUBATTRIB_THUMB_FOR_SCROLLER . "';\n\t\twindow.COM_REDSHOP_NOT_AVAILABLE = '" . JText::_('COM_REDSHOP_NOT_AVAILABLE', true) . "';\n\t\twindow.COM_REDSHOP_PLEASE_INSERT_HEIGHT = '" . JText::_('COM_REDSHOP_PLEASE_INSERT_HEIGHT', true) . "';\n\t\twindow.COM_REDSHOP_PLEASE_INSERT_WIDTH = '" . JText::_('COM_REDSHOP_PLEASE_INSERT_WIDTH', true) . "';\n\t\twindow.COM_REDSHOP_PLEASE_INSERT_DEPTH = '" . JText::_('COM_REDSHOP_PLEASE_INSERT_DEPTH', true) . "';\n\t\twindow.COM_REDSHOP_PLEASE_INSERT_RADIUS = '" . JText::_('COM_REDSHOP_PLEASE_INSERT_RADIUS', true) . "';\n\t\twindow.COM_REDSHOP_PLEASE_INSERT_UNIT = '" . JText::_('COM_REDSHOP_PLEASE_INSERT_UNIT', true) . "';\n\t\twindow.COM_REDSHOP_THIS_FIELD_IS_REQUIRED = '" . JText::_('COM_REDSHOP_THIS_FIELD_IS_REQUIRED', true) . "';\n\t\twindow.COM_REDSHOP_SELECT_SUBSCRIPTION_PLAN = '" . JText::_('COM_REDSHOP_SELECT_SUBSCRIPTION_PLAN', true) . "';\n\t    window.COM_REDSHOP_USERNAME_MIN_CHARACTER_LIMIT = '" . JText::_('COM_REDSHOP_USERNAME_MIN_CHARACTER_LIMIT', true) . "';\n\t\twindow.CREATE_ACCOUNT_CHECKBOX = '" . CREATE_ACCOUNT_CHECKBOX . "';\n\t\twindow.USE_TAX_EXEMPT = '" . USE_TAX_EXEMPT . "';\n\t\twindow.SHOW_EMAIL_VERIFICATION = '" . SHOW_EMAIL_VERIFICATION . "';\n\t\twindow.SHOW_QUOTATION_PRICE = '" . SHOW_QUOTATION_PRICE . "';\n\t\twindow.AJAX_DETAIL_BOX_WIDTH = '" . AJAX_DETAIL_BOX_WIDTH . "';\n\t\twindow.AJAX_DETAIL_BOX_HEIGHT = '" . AJAX_DETAIL_BOX_HEIGHT . "';\n\t\twindow.AJAX_BOX_WIDTH = '" . AJAX_BOX_WIDTH . "';\n\t\twindow.AJAX_BOX_HEIGHT = '" . AJAX_BOX_HEIGHT . "';\n\t\twindow.COM_REDSHOP_EAN_MIN_CHARACTER_LIMIT = '" . JText::_('COM_REDSHOP_EAN_MIN_CHARACTER_LIMIT', true) . "';\n\t";
$doc->addScriptDeclaration($script);
if ($view == 'product') {
    if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . 'slimbox/' . PRODUCT_DETAIL_LIGHTBOX_CLOSE_BUTTON_IMAGE)) {
        $slimboxCloseButton = "#sbox-btn-close {background: transparent url( \"" . REDSHOP_FRONT_IMAGES_ABSPATH . "slimbox/" . PRODUCT_DETAIL_LIGHTBOX_CLOSE_BUTTON_IMAGE . "\" ) no-repeat center;}";
    } else {
Esempio n. 4
0
 function renderLayout()
 {
     if ($this->config['module_mode'] !== 'normal') {
         $this->render_portal_mode($this->config['module_mode']);
     } else {
         $renderer = new NSP_GK4_Layout_Parts();
         // detecting mode - com_content or K2
         $k2_mode = false;
         $rs_mode = false;
         $vm_mode = false;
         $producthelper = '';
         $redhelper = '';
         //check the source
         if ($this->config["data_source"] == 'k2_categories' || $this->config["data_source"] == 'k2_articles' || $this->config["data_source"] == 'all_k2_articles' || $this->config["data_source"] == 'k2_tags') {
             if ($this->config['k2_categories'] != -1) {
                 $k2_mode = true;
             } else {
                 // exception when K2 is not installed
                 $this->content = array("ID" => array(), "alias" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "author" => array(), "cat_name" => array(), "cat_alias" => array(), "hits" => array(), "news_amount" => 0, "rating_sum" => 0, "rating_count" => 0, "plugins" => '');
             }
         } else {
             if ($this->config["data_source"] == 'redshop_categories' || $this->config["data_source"] == 'redshop_products' || $this->config["data_source"] == 'all_redshop_products') {
                 if ($this->config['redshop_categories'] != -1 && file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_redshop')) {
                     $rs_mode = true;
                     $producthelper = new producthelper();
                     $redhelper = new redhelper();
                 } else {
                     // exception when RedSHOP is not installed
                     $this->content = array("ID" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "price" => array(), "discount_price" => array(), "discount_start" => array(), "discount_end" => array(), "tax" => array(), "cat_name" => array(), "manufacturer" => array(), "manufacturer_id" => array(), "product_image" => array(), "news_amount" => array());
                 }
             } elseif ($this->config["data_source"] == 'vm_categories' || $this->config["data_source"] == 'vm_products') {
                 if ($this->config['vm_categories'] != -1) {
                     $vm_mode = true;
                 } else {
                     // exception when VirtueMart is not installed
                     $this->content = array("ID" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "price" => array(), "price_currency" => array(), "discount_amount" => array(), "discount_is_percent" => array(), "discount_start" => array(), "discount_end" => array(), "tax" => array(), "cat_name" => array(), "manufacturer" => array(), "manufacturer_id" => array(), "product_image" => array(), "news_amount" => 0);
                 }
             }
         }
         // tables which will be used in generated content
         $news_list_tab = array();
         $news_html_tab = array();
         // Generating content
         $uri =& JURI::getInstance();
         $li_counter = 0;
         $news_k2_store = '';
         $news_header = '';
         $news_image = '';
         $news_readmore = '';
         $news_textt = '';
         $news_infoo = '';
         $news_infoo2 = '';
         //
         for ($i = 0; $i < count($this->content["ID"]); $i++) {
             if ($i < $this->config['news_column'] * $this->config['news_rows'] * $this->config['news_full_pages']) {
                 // GENERATING NEWS CONTENT
                 if ($k2_mode == FALSE && $rs_mode == FALSE && $vm_mode == FALSE) {
                     // GENERATING HEADER
                     if ($this->config['news_header_enabled'] == 1) {
                         $news_header = $renderer->header($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i]);
                     }
                     // GENERATING IMAGE
                     if ($this->config['news_image_enabled'] == 1) {
                         $news_image = $renderer->image($this->config, $uri, $this->content['ID'][$i], $this->content['IID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $this->content['title'][$i], $this->content['images'][$i]);
                     }
                     // GENERATING READMORE
                     if ($this->config['news_readmore_enabled'] == 1) {
                         $news_readmore = $renderer->readMore($this->config, $this->content['ID'][$i], $this->content['CID'][$i]);
                     }
                     // GENERATING TEXT
                     if ($this->config['news_text_enabled'] == 1) {
                         $news_textt = $renderer->text($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $news_readmore);
                     }
                     // GENERATE NEWS INFO
                     if ($this->config['news_info_enabled'] == 1) {
                         $news_infoo = $renderer->info($this->config, $this->content['catname'][$i], $this->content['CID'][$i], $this->content['author'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['rating_count'][$i], $this->content['rating_sum'][$i]);
                     }
                     // GENERATE NEWS INFO2
                     if ($this->config['news_info2_enabled'] == 1) {
                         $news_infoo2 = $renderer->info($this->config, $this->content['catname'][$i], $this->content['CID'][$i], $this->content['author'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['rating_count'][$i], $this->content['rating_sum'][$i], 2);
                     }
                 } else {
                     if ($rs_mode == FALSE && $vm_mode == FALSE && $k2_mode == TRUE) {
                         // GENERATING HEADER
                         if ($this->config['news_header_enabled'] == 1) {
                             $news_header = $renderer->header_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['title'][$i]);
                         }
                         // GENERATING IMAGE
                         if ($this->config['news_image_enabled'] == 1) {
                             $news_image = $renderer->image_k2($this->config, $uri, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['text'][$i], $this->content['title'][$i]);
                         }
                         // GENERATING READMORE
                         if ($this->config['news_readmore_enabled'] == 1) {
                             $news_readmore = $renderer->readMore_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i]);
                         }
                         // GENERATING TEXT
                         if ($this->config['news_text_enabled'] == 1) {
                             $news_textt = $renderer->text_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['text'][$i], $news_readmore);
                         }
                         // GENERATE NEWS INFO
                         if ($this->config['news_info_enabled'] == 1) {
                             $news_infoo = $renderer->info_k2($this->config, $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['author'][$i], $this->content['author_id'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['alias'][$i], $this->content['comments'], $this->content['rating_count'][$i], $this->content['rating_sum'][$i]);
                         }
                         // GENERATE NEWS INFO2
                         if ($this->config['news_info2_enabled'] == 1) {
                             $news_infoo2 = $renderer->info_k2($this->config, $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['author'][$i], $this->content['author_id'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['alias'][$i], $this->content['comments'], $this->content['rating_count'][$i], $this->content['rating_sum'][$i], 2);
                         }
                         // GENERATE STORE BLOCK
                         $news_k2_store = $renderer->store_k2($this->config, $this->content['ID'][$i], $this->content['plugins'][$i], $this->k2store_params);
                     } else {
                         if ($rs_mode == TRUE && $vm_mode == FALSE && $k2_mode == FALSE) {
                             $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $this->content['ID'][$i]);
                             $id = $this->content['ID'][$i];
                             $cid = $producthelper->getCategoryProduct($this->content['ID'][$i]);
                             $Itemid = $redhelper->getItemid($this->content['ID'][$i]);
                             $product = $producthelper->getProductById($this->content['ID'][$i]);
                             // GENERATING HEADER
                             if ($this->config['news_header_enabled'] == 1) {
                                 $news_header = $renderer->header_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i], $Itemid);
                             }
                             // GENERATING IMAGE
                             if ($this->config['news_image_enabled'] == 1) {
                                 $news_image = $renderer->image_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['product_image'][$i], $this->content['title'][$i], $Itemid);
                             }
                             // GENERATING READMORE
                             if ($this->config['news_readmore_enabled'] == 1) {
                                 $news_readmore = $renderer->readMore_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $Itemid);
                             }
                             // GENERATING TEXT
                             if ($this->config['news_text_enabled'] == 1) {
                                 $news_textt = $renderer->text_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $news_readmore, $Itemid);
                             }
                             // GENERATE NEWS INFO
                             if ($this->config['news_info_enabled'] == 1) {
                                 $news_infoo = $renderer->info_rs($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $Itemid, $this->content['manufacturer_id'][$i], 1);
                             }
                             // GENERATE NEWS INFO2
                             if ($this->config['news_info2_enabled'] == 1) {
                                 $news_infoo2 = $renderer->info_rs($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $Itemid, $this->content['manufacturer_id'][$i], 2);
                             }
                             // COMPUTE PRICE DEPENDS OF USER ID
                             $user =& JFactory::getUser();
                             $price = $producthelper->getProductPrice($this->content['ID'][$i], $this->config['rs_price_with_vat'], $user->id);
                             $price = $producthelper->getProductFormattedPrice($price, true);
                             if ($this->config['rs_add_to_cart'] == 1) {
                                 $addToCart = $producthelper->replaceCartTemplate($this->content['ID'][$i], 0, 0, 0, "", false, array(), 0, 0, 0);
                                 $addToCart = str_replace('&', '&amp;', $addToCart);
                                 if ($this->config['rs_show_default_cart_button'] == 0) {
                                     $btnCode = '<a class=\'nspAddToCart\' onclick="if(displayAddtocartForm(\'addtocart_prd_' . $this->content['ID'][$i];
                                     $btnCode .= '\',\'' . $id . '\',\'0\',\'0\', \'user_fields_form\'))';
                                     $btnCode .= '{checkAddtocartValidation(\'addtocart_prd_' . $id . '\',\'' . $id . '\',\'0\',\'0\', \'user_fields_form\',\'0\',\'0\',\'0\');}"><span style=\'cursor: pointer;\' id=\'pdaddtocartprd' . $id . '\' title=\'\' class=\'\'>' . JText::_('MOD_NEWS_PRO_GK4_ADD_TO_CART') . '</span></a>';
                                     $addToCart = preg_replace('/\\<img.*?\\>/i', $btnCode, $addToCart);
                                 }
                             }
                             // GET THE CURRENCY
                             $bool = preg_match('/[^0-9]/u', $price, $currency);
                             $currency = $currency[0];
                             $bool = preg_match('/[0-9]+/u', $price, $price);
                             $price = $price[0];
                             // GENERATE RedSHOP STORE INFO
                             $news_rs_store = $renderer->store_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $price, $this->content['discount_start'][$i], $this->content['discount_end'][$i], $this->content['tax'][$i], $this->content['discount_price'][$i], $currency, $Itemid, $addToCart);
                         } else {
                             if ($vm_mode == TRUE) {
                                 // GENERATING HEADER
                                 if ($this->config['news_header_enabled'] == 1) {
                                     $news_header = $renderer->header_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i]);
                                 }
                                 // GENERATING IMAGE
                                 if ($this->config['news_image_enabled'] == 1) {
                                     $news_image = $renderer->image_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['product_image'][$i], $this->content['title'][$i]);
                                 }
                                 // GENERATING READMORE
                                 if ($this->config['news_readmore_enabled'] == 1) {
                                     $news_readmore = $renderer->readMore_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i]);
                                 }
                                 // GENERATING TEXT
                                 if ($this->config['news_text_enabled'] == 1) {
                                     $news_textt = $renderer->text_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $news_readmore);
                                 }
                                 // GENERATE NEWS INFO
                                 if ($this->config['news_info_enabled'] == 1) {
                                     $news_infoo = $renderer->info_vm($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['comments']);
                                 }
                                 // GENERATE NEWS INFO2
                                 if ($this->config['news_info2_enabled'] == 1) {
                                     $news_infoo2 = $renderer->info_vm($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['comments'], 2);
                                 }
                                 $news_vm_store = $renderer->store_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['price'][$i], $this->content['price_currency'][$i], $this->content['discount_amount'][$i], true, $this->content['discount_start'][$i], $this->content['discount_end'][$i], $this->content['tax'][$i], $this->content['manufacturer_id'][$i]);
                             }
                         }
                     }
                 }
                 // PARSING PLUGINS
                 if ($this->config['parse_plugins'] == TRUE) {
                     $news_textt = JHtml::_('content.prepare', $news_textt);
                 }
                 // CLEANING PLUGINS
                 if ($this->config['clean_plugins'] == TRUE) {
                     $news_textt = preg_replace("/(\\{.+?\\}.+?\\{.+?})|(\\{.+?\\})/", "", $news_textt);
                 }
                 // GENERATE CONTENT FOR TAB
                 $news_generated_content = '';
                 // initialize variable
                 //
                 for ($j = 1; $j < 7; $j++) {
                     if ($this->config['wrapContent'] == 1 && $this->config['news_image_order'] == 1) {
                         if ($j == 2) {
                             $news_generated_content .= '<div class="gkArtContentWrap">';
                         }
                     }
                     if ($this->config['news_header_order'] == $j) {
                         $news_generated_content .= $news_header;
                     }
                     if ($this->config['news_image_order'] == $j) {
                         $news_generated_content .= $news_image;
                     }
                     if ($this->config['news_text_order'] == $j) {
                         $news_generated_content .= $news_textt;
                     }
                     if ($this->config['news_info_order'] == $j) {
                         $news_generated_content .= $news_infoo;
                     }
                     if ($this->config['news_info2_order'] == $j) {
                         $news_generated_content .= $news_infoo2;
                     }
                     if ($this->config['news_rs_store_enabled'] != 'disabled') {
                         if ($rs_mode != FALSE && $this->config['news_rs_store_order'] == $j) {
                             $news_generated_content .= $news_rs_store;
                         }
                         if ($vm_mode != FALSE && $this->config['news_rs_store_order'] == $j) {
                             $news_generated_content .= $news_vm_store;
                         }
                         if ($k2_mode != FALSE && $this->config['news_rs_store_order'] == $j) {
                             $news_generated_content .= $news_k2_store;
                         }
                     }
                 }
                 //
                 if ($this->config['news_content_readmore_pos'] != 'after') {
                     $news_generated_content .= $news_readmore;
                 }
                 if ($this->config['wrapContent'] == 1 && $this->config['news_image_order'] == 1) {
                     $news_generated_content .= '</div>';
                 }
                 // creating table with news content
                 array_push($news_html_tab, $news_generated_content);
             } else {
                 if ($k2_mode == FALSE && $vm_mode == FALSE) {
                     array_push($news_list_tab, $renderer->lists($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i], $this->content['text'][$i], $li_counter % 2, $li_counter));
                 } elseif ($k2_mode == TRUE) {
                     array_push($news_list_tab, $renderer->lists_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['title'][$i], $this->content['text'][$i], $li_counter % 2, $li_counter));
                 } else {
                     array_push($news_list_tab, $renderer->lists_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i], $this->content['text'][$i], $li_counter % 2, $li_counter));
                 }
                 //
                 $li_counter++;
             }
         }
         /** GENERATING FINAL XHTML CODE START **/
         // create instances of basic Joomla! classes
         $document = JFactory::getDocument();
         $uri = JURI::getInstance();
         // add stylesheets to document header
         if ($this->config["useCSS"] == 1) {
             $document->addStyleSheet($uri->root() . 'modules/mod_news_pro_gk4/interface/css/style.css', 'text/css');
         }
         // add script to the document header
         if ($this->config['useScript'] == 1) {
             $document->addScript($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.js');
         }
         // init $headData variable
         $headData = false;
         // add scripts with automatic mode to document header
         if ($this->config['useScript'] == 2) {
             // getting module head section datas
             unset($headData);
             $headData = $document->getHeadData();
             // generate keys of script section
             $headData_keys = array_keys($headData["scripts"]);
             // set variable for false
             $engine_founded = false;
             // searching phrase mootools in scripts paths
             if (array_search($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.js', $headData_keys) > 0) {
                 $engine_founded = true;
             }
             // if engine doesn't exists in the head section
             if (!$engine_founded) {
                 // add new script tag connected with mootools from module
                 $document->addScript($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.js');
             }
         }
         //
         require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'content');
         require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'default');
     }
 }
Esempio n. 5
0
             }
             $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_" . $product->product_id . "' name='user_fields_form_" . $product->product_id . "'>" . $template_userfield . "</form></div>";
         }
     }
 }
 $prddata_add = $prddata_add . $hidden_userfield;
 /************** end user fields ***************************/
 $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $product->product_id);
 if (count($ItemData) > 0) {
     $pItemid = $ItemData->id;
 } else {
     $pItemid = $objhelper->getItemid($product->product_id);
 }
 $prddata_add = str_replace("{product_id_lbl}", JText::_('COM_REDSHOP_PRODUCT_ID_LBL'), $prddata_add);
 $prddata_add = str_replace("{product_id}", $product->product_id, $prddata_add);
 $prddata_add = str_replace("{product_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER_LBL'), $prddata_add);
 $product_number_output = '<span id="product_number_variable' . $product->product_id . '">' . $product->product_number . '</span>';
 $prddata_add = str_replace("{product_number}", $product_number_output, $prddata_add);
 $product_volume_unit = '<span class="product_unit_variable">' . DEFAULT_VOLUME_UNIT . "3" . '</span>';
 $strToInsert = $producthelper->redunitDecimal($product->product_volume) . "&nbsp;" . $product_volume_unit;
 $prddata_add = str_replace("{product_size}", $strToInsert, $prddata_add);
 $product_unit = '<span class="product_unit_variable">' . DEFAULT_VOLUME_UNIT . '</span>';
 $strToInsert = $producthelper->redunitDecimal($product->product_length) . "&nbsp;" . $product_unit;
 $prddata_add = str_replace("{product_length}", $strToInsert, $prddata_add);
 $prddata_add = str_replace("{product_width}", $producthelper->redunitDecimal($product->product_width) . "&nbsp;" . $product_unit, $prddata_add);
 $strToInsert = $producthelper->redunitDecimal($product->product_height) . "&nbsp;" . $product_unit;
 $prddata_add = str_replace("{product_height}", $strToInsert, $prddata_add);
Esempio n. 6
0
 /**
  * Method to add product in cart
  *
  * @return void
  */
 public function add()
 {
     $app = JFactory::getApplication();
     $option = JRequest::getVar('option');
     $post = JRequest::get('post');
     $parent_accessory_productid = $post['product_id'];
     $Itemid = JRequest::getVar('Itemid');
     $producthelper = new producthelper();
     $redhelper = new redhelper();
     $Itemid = $redhelper->getCartItemid();
     $model = $this->getModel('cart');
     // Call add method of modal to store product in cart session
     $userfiled = JRequest::getVar('userfiled');
     JPluginHelper::importPlugin('redshop_product');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeAddProductToCart', array(&$post));
     $result = $this->_carthelper->addProductToCart($post);
     if (is_bool($result) && $result) {
     } else {
         $errmsg = $result ? $result : JText::_("COM_REDSHOP_PRODUCT_NOT_ADDED_TO_CART");
         if (AJAX_CART_BOX == 1) {
             echo "`0`" . $errmsg;
             die;
         } else {
             $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $post['product_id']);
             if (count($ItemData) > 0) {
                 $prdItemid = $ItemData->id;
             } else {
                 $prdItemid = $redhelper->getItemid($post['product_id']);
             }
             $link = JRoute::_("index.php?option=" . $option . "&view=product&pid=" . $post["product_id"] . "&Itemid=" . $prdItemid, false);
             $app->Redirect($link, $errmsg);
         }
     }
     $session = JFactory::getSession();
     $cart = $session->get('cart');
     if (isset($cart['AccessoryAsProduct'])) {
         $attArr = $cart['AccessoryAsProduct'];
         if (ACCESSORY_AS_PRODUCT_IN_CART_ENABLE) {
             $data['accessory_data'] = $attArr[0];
             $data['acc_quantity_data'] = $attArr[1];
             $data['acc_attribute_data'] = $attArr[2];
             $data['acc_property_data'] = $attArr[3];
             $data['acc_subproperty_data'] = $attArr[4];
             if (isset($data['accessory_data']) && ($data['accessory_data'] != "" && $data['accessory_data'] != 0)) {
                 $accessory_data = explode("@@", $data['accessory_data']);
                 $acc_quantity_data = explode("@@", $data['acc_quantity_data']);
                 $acc_attribute_data = explode("@@", $data['acc_attribute_data']);
                 $acc_property_data = explode("@@", $data['acc_property_data']);
                 $acc_subproperty_data = explode("@@", $data['acc_subproperty_data']);
                 for ($i = 0; $i < count($accessory_data); $i++) {
                     $accessory = $producthelper->getProductAccessory($accessory_data[$i]);
                     $post = array();
                     $post['parent_accessory_product_id'] = $parent_accessory_productid;
                     $post['product_id'] = $accessory[0]->child_product_id;
                     $post['quantity'] = $acc_quantity_data[$i];
                     $post['category_id'] = 0;
                     $post['sel_wrapper_id'] = 0;
                     $post['attribute_data'] = $acc_attribute_data[$i];
                     $post['property_data'] = $acc_property_data[$i];
                     $post['subproperty_data'] = $acc_subproperty_data[$i];
                     $result = $this->_carthelper->addProductToCart($post);
                     $cart = $session->get('cart');
                     if (is_bool($result) && $result) {
                     } else {
                         $errmsg = $result ? $result : JText::_("COM_REDSHOP_PRODUCT_NOT_ADDED_TO_CART");
                         if (JError::isError(JError::getError())) {
                             $error = JError::getError();
                             $errmsg = $error->message;
                         }
                         if (AJAX_CART_BOX == 1) {
                             echo "`0`" . $errmsg;
                             die;
                         } else {
                             $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $post['product_id']);
                             if (count($ItemData) > 0) {
                                 $prdItemid = $ItemData->id;
                             } else {
                                 $prdItemid = $redhelper->getItemid($post['product_id']);
                             }
                             $link = JRoute::_("index.php?option=" . $option . "&view=product&pid=" . $post["product_id"] . "&Itemid=" . $prdItemid, false);
                             $app->Redirect($link, $errmsg);
                         }
                     }
                 }
             }
         }
         if (!DEFAULT_QUOTATION_MODE || DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE) {
             $this->_carthelper->carttodb();
         }
         $this->_carthelper->cartFinalCalculation();
         unset($cart['AccessoryAsProduct']);
     } else {
         if (!DEFAULT_QUOTATION_MODE || DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE) {
             $this->_carthelper->carttodb();
         }
         $this->_carthelper->cartFinalCalculation();
     }
     if (!$userfiled) {
         if (AJAX_CART_BOX == 1 && isset($post['ajax_cart_box'])) {
             $link = JRoute::_('index.php?option=' . $option . '&view=cart&ajax_cart_box=' . $post['ajax_cart_box'] . '&tmpl=component&Itemid=' . $Itemid, false);
             $app->Redirect($link);
         } else {
             if (ADDTOCART_BEHAVIOUR == 1) {
                 $link = JRoute::_('index.php?option=' . $option . '&view=cart&Itemid=' . $Itemid, false);
                 $app->Redirect($link);
             } else {
                 $link = JRoute::_($_SERVER['HTTP_REFERER'], false);
                 if ($cart['notice_message'] != "") {
                     $msg = $cart['notice_message'] . "<br>";
                 }
                 $msg .= JTEXT::_('COM_REDSHOP_PRODUCT_ADDED_TO_CART');
                 $app->Redirect($link, $msg);
             }
         }
     } else {
         $link = JRoute::_('index.php?option=' . $option . '&view=product&pid=' . $post['p_id'] . '&Itemid=' . $Itemid, false);
         $app->Redirect($link);
     }
 }
Esempio n. 7
0
				<?php 
if ($this->detail->product_id > 0) {
    ?>
					<?php 
    /*
     * @ToDo Seams to be that this mess outputs product's frontend link.
     * @ToDo Examine if there is better, more optimized way to obtain this link.
     */
    $ItemData = $this->producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $this->detail->product_id);
    $catidmain = $this->detail->first_selected_category_id;
    if (count($ItemData) > 0) {
        $pItemid = $ItemData->id;
    } else {
        $objhelper = new redhelper();
        $pItemid = $objhelper->getItemid($this->detail->product_id, $catidmain);
    }
    $link = JURI::root();
    $link .= 'index.php?option=' . $this->option;
    $link .= '&view=product&pid=' . $this->detail->product_id;
    $link .= '&cid=' . $catidmain;
    $link .= '&Itemid=' . $pItemid;
    ?>

					<tr>
						<td class="key">
							<label>
								<?php 
    echo JText::_('COM_REDSHOP_FRONTEND_LINK');
    ?>
							</label>
Esempio n. 8
0
 public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $db = JFactory::getDbo();
     $user = JFactory::getUser();
     $searchText = $text;
     // Load plugin params info
     $pluginParams = $this->params;
     $limit = $pluginParams->def('search_limit', 50);
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     $section = JText::_('COM_REDSHOP_Products');
     $wheres = array();
     switch ($phrase) {
         case 'exact':
             $text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
             $wheres2 = array();
             $wheres2[] = 'a.product_name LIKE ' . $text;
             $wheres2[] = 'a.product_number LIKE ' . $text;
             $wheres2[] = 'c.data_txt LIKE ' . $text;
             $where = '(' . implode(') OR (', $wheres2) . ')';
             break;
         case 'all':
         case 'any':
         default:
             $words = explode(' ', $text);
             $wheres = array();
             foreach ($words as $word) {
                 $word = $db->Quote('%' . $db->getEscaped($word, true) . '%', false);
                 $wheres2 = array();
                 $wheres2[] = 'a.product_name LIKE ' . $word;
                 $wheres2[] = 'a.product_number LIKE ' . $word;
                 $wheres2[] = 'c.data_txt LIKE ' . $word;
                 $wheres[] = implode(' OR ', $wheres2);
             }
             $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
             break;
     }
     switch ($ordering) {
         case 'oldest':
             $order = 'a.product_id ASC';
             break;
         case 'newest':
         default:
             $order = 'a.product_id DESC';
     }
     // Shopper group - choose from manufactures Start
     $rsUserhelper = new rsUserhelper();
     $shopper_group_manufactures = $rsUserhelper->getShopperGroupManufacturers();
     $whereaclProduct = "";
     if ($shopper_group_manufactures != "") {
         $whereaclProduct = " AND a.manufacturer_id IN (" . $shopper_group_manufactures . ") ";
     }
     // Shopper group - choose from manufactures End
     $query = 'SELECT c.data_txt as customtxt,a.product_id,a.product_name AS title,a.product_number as number,a.product_s_desc AS text,' . ' "2" AS browsernav,"Redshop product" as section,"" as created' . ' FROM #__redshop_product AS a LEFT join #__redshop_fields_data As c on c.itemid = a.product_id' . ' WHERE (' . $where . ') ' . $whereaclProduct . '' . ' AND a.published = 1' . ' ORDER BY ' . $order;
     $db->setQuery($query, 0, $limit);
     $rows = $db->loadObjectList();
     $redhelper = new redhelper();
     foreach ($rows as $key => $row) {
         $Itemid = $redhelper->getItemid($row->product_id);
         $rows[$key]->href = "index.php?option=com_redshop&view=product&pid=" . $row->product_id . "&Itemid=" . $Itemid;
     }
     $return = array();
     foreach ($rows as $key => $weblink) {
         if (searchHelper::checkNoHTML($weblink, $searchText, array('url', 'text', 'title', 'number', 'customtxt'))) {
             $return[] = $weblink;
         }
     }
     return $return;
 }
Esempio n. 9
0
		<table border="0" cellpadding="5" cellspacing="0" width="100%">
			<?php 
    $i = 0;
    $cnt = 0;
    if ($compare['idx'] > 0) {
        for ($i = 0; $i < $compare['idx']; $i++) {
            $row = $producthelper->getProductById($compare[$i]["product_id"]);
            $catid = $compare[$i]["category_id"];
            if (!$cid) {
                $cid = $producthelper->getCategoryProduct($row->product_id);
            }
            $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $row->product_id);
            if (count($ItemData) > 0) {
                $Itemid = $ItemData->id;
            } else {
                $Itemid = $redhelper->getItemid($row->product_id);
            }
            $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&cid=' . $cid . '&Itemid=' . $Itemid);
            if (PRODUCT_COMPARISON_TYPE == "category") {
                if ($cid == $catid) {
                    ?>
							<tr valign="top">
								<td width="95%">
									<span><a href='<?php 
                    echo $link;
                    ?>
'
									         title='<?php 
                    echo $row->product_name;
                    ?>
'><?php 
Esempio n. 10
0
             } else {
                 $stock_status = "<div  class='mod_product_preorder' align='center'>" . JText::_('COM_REDSHOP_PRE_ORDER') . "</div>";
             }
         } else {
             $stock_status = "<div  class='mod_product_outstock' align='center'>" . JText::_('COM_REDSHOP_OUT_OF_STOCK') . "</div>";
         }
     } else {
         $stock_status = "<div  class='mod_product_instock' align='center'>" . JText::_('COM_REDSHOP_AVAILABLE_STOCK') . "</div>";
     }
 }
 $category_id = $producthelper->getCategoryProduct($row->product_id);
 $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $row->product_id);
 if (count($ItemData) > 0) {
     $Itemid = $ItemData->id;
 } else {
     $Itemid = $redhelper->getItemid($row->product_id, $category_id);
 }
 $link = JRoute::_('index.php?option=' . $option . '&view=product&pid=' . $row->product_id . '&cid=' . $category_id . '&Itemid=' . $Itemid);
 if ($vertical_product) {
     echo "<div class='mod_redshop_products'>";
 } else {
     echo "<div class='mod_redshop_products_horizontal'>";
 }
 echo "<div class='mod_redshop_products_outer'><div class='mod_redshop_products_inner'>";
 $productInfo = $producthelper->getProductById($row->product_id);
 if ($image) {
     $thumb = $productInfo->product_full_image;
     if (WATERMARK_PRODUCT_IMAGE) {
         $thum_image = $redhelper->watermark('product', $thumb, $thumbwidth, $thumbheight, WATERMARK_PRODUCT_THUMB_IMAGE, '0');
         echo "<div class='mod_redshop_products_image'><img src=" . $thum_image . "></div>";
     } else {
Esempio n. 11
0
 /**
  * Go to nav Product
  *
  * @return  void
  */
 public function gotonavproduct()
 {
     $producthelper = new producthelper();
     $objhelper = new redhelper();
     $post = JRequest::get('post');
     $cid = $producthelper->getCategoryProduct($post['pid']);
     $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $post['pid']);
     if (count($ItemData) > 0) {
         $pItemid = $ItemData->id;
     } else {
         $pItemid = $objhelper->getItemid($product->product_id, $cid);
     }
     $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $post['pid'] . '&cid=' . $cid . '&Itemid=' . $pItemid, false);
     $this->setRedirect($link);
 }
Esempio n. 12
0
             $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_" . $product->product_id . "' name='user_fields_form_" . $product->product_id . "'>" . $template_userfield . "</form></div>";
         }
     }
 }
 $data_add = $data_add . $hidden_userfield;
 /************** end user fields ***************************/
 $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $product->product_id);
 $catidmain = Jrequest::getVar("cid");
 if (count($ItemData) > 0) {
     $pItemid = $ItemData->id;
 } else {
     $pItemid = $objhelper->getItemid($product->product_id, $catidmain);
 }
 $data_add = str_replace("{product_id_lbl}", JText::_('COM_REDSHOP_PRODUCT_ID_LBL'), $data_add);
 $data_add = str_replace("{product_id}", $product->product_id, $data_add);
 $data_add = str_replace("{product_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER_LBL'), $data_add);
 $product_number_output = '<span id="product_number_variable' . $product->product_id . '">' . $product->product_number . '</span>';
 $data_add = str_replace("{product_number}", $product_number_output, $data_add);
 $product_volume_unit = '<span class="product_unit_variable">' . DEFAULT_VOLUME_UNIT . "3" . '</span>';
 $dataAddStr = $producthelper->redunitDecimal($product->product_volume) . "&nbsp;" . $product_volume_unit;
 $data_add = str_replace("{product_size}", $dataAddStr, $data_add);
 $product_unit = '<span class="product_unit_variable">' . DEFAULT_VOLUME_UNIT . '</span>';
 $data_add = str_replace("{product_length}", $producthelper->redunitDecimal($product->product_length) . "&nbsp;" . $product_unit, $data_add);
 $data_add = str_replace("{product_width}", $producthelper->redunitDecimal($product->product_width) . "&nbsp;" . $product_unit, $data_add);
 $data_add = str_replace("{product_height}", $producthelper->redunitDecimal($product->product_height) . "&nbsp;" . $product_unit, $data_add);
 $data_add = $producthelper->replaceVatinfo($data_add);
 $specificLink = $this->dispatcher->trigger('createProductLink', array($product));
Esempio n. 13
0
 public function sendWishlist($post)
 {
     $user = JFactory::getUser();
     $redshopMail = new redshopMail();
     $redhelper = new redhelper();
     $wishlist_id = JRequest::getInt('wishlist_id');
     $emailto = $post['emailto'];
     $sender = $post['sender'];
     $email = $post['email'];
     $subject = $post['subject'];
     $Itemid = $post['Itemid'];
     $producthelper = new producthelper();
     // Get data from database if not than fetch from session
     if ($user->id && $wishlist_id) {
         $query = "SELECT DISTINCT w.* ,p.* FROM " . $this->_table_prefix . "wishlist AS w " . "LEFT JOIN " . $this->_table_prefix . "wishlist_product AS pw ON w.wishlist_id=pw.wishlist_id " . "LEFT JOIN " . $this->_table_prefix . "product AS p ON p.product_id = pw.product_id " . "WHERE w.user_id = " . (int) $user->id . " " . "AND w.wishlist_id = " . (int) $wishlist_id . " ";
     } else {
         // Add this code to send wishlist while user is not loged in ...
         $prod_id = "";
         for ($add_i = 1; $add_i < $_SESSION["no_of_prod"]; $add_i++) {
             $prod_id .= (int) $_SESSION['wish_' . $add_i]->product_id . ",";
         }
         $prod_id .= (int) $_SESSION['wish_' . $add_i]->product_id;
         $query = "SELECT DISTINCT p.* FROM " . $this->_table_prefix . "product AS p " . "WHERE p.product_id IN (" . $prod_id . ")";
     }
     $MyWishlist = $this->_getList($query);
     $i = 0;
     $data = "";
     $mailbcc = null;
     $wishlist_body = $redshopMail->getMailtemplate(0, "mywishlist_mail");
     if (count($wishlist_body) > 0) {
         $wishlist_body = $wishlist_body[0];
         $data = $wishlist_body->mail_body;
         $subject = $wishlist_body->mail_subject;
         if (trim($wishlist_body->mail_bcc) != "") {
             $mailbcc = explode(",", $wishlist_body->mail_bcc);
         }
     }
     if ($data) {
         $template_d1 = explode("{product_loop_start}", $data);
         $template_d2 = explode("{product_loop_end}", $template_d1[1]);
         $wishlist_desc = $template_d2[0];
         if (strstr($data, '{product_thumb_image_2}')) {
             $tag = '{product_thumb_image_2}';
             $h_thumb = THUMB_HEIGHT_2;
             $w_thumb = THUMB_WIDTH_2;
         } elseif (strstr($data, '{product_thumb_image_3}')) {
             $tag = '{product_thumb_image_3}';
             $h_thumb = THUMB_HEIGHT_3;
             $w_thumb = THUMB_WIDTH_3;
         } elseif (strstr($data, '{product_thumb_image_1}')) {
             $tag = '{product_thumb_image_1}';
             $h_thumb = THUMB_HEIGHT;
             $w_thumb = THUMB_WIDTH;
         } else {
             $tag = '{product_thumb_image}';
             $h_thumb = THUMB_HEIGHT;
             $w_thumb = THUMB_WIDTH;
         }
         $temp_template = '';
         if (count($MyWishlist)) {
             foreach ($MyWishlist as $row) {
                 $Itemid = $redhelper->getItemid($row->product_id);
                 $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&Itemid=' . (int) $Itemid, true, -1);
                 $thum_image = $producthelper->getProductImage($row->product_id, $link, $w_thumb, $h_thumb);
                 $pname = $row->product_name;
                 $pname = $pname;
                 $wishlist_data = str_replace($tag, $thum_image, $wishlist_desc);
                 $wishlist_data = str_replace('{product_name}', $pname, $wishlist_data);
                 // Attribute ajax change
                 if (!$row->not_for_sale) {
                     $wishlist_data = $producthelper->GetProductShowPrice($row->product_id, $wishlist_data);
                 } else {
                     $wishlist_data = str_replace("{product_price}", "", $wishlist_data);
                     $wishlist_data = str_replace("{price_excluding_vat}", "", $wishlist_data);
                     $wishlist_data = str_replace("{product_price_table}", "", $wishlist_data);
                     $wishlist_data = str_replace("{product_old_price}", "", $wishlist_data);
                     $wishlist_data = str_replace("{product_price_saving}", "", $wishlist_data);
                 }
                 $temp_template .= $wishlist_data;
             }
         }
         $data = $template_d1[0] . $temp_template . $template_d2[1];
         $name = @explode('@', $emailto);
         $data = str_replace('{from}', $sender, $data);
         $data = str_replace('{name}', $name[0], $data);
         $data = str_replace('{from_name}', $sender, $data);
         $data_add = $data;
     } else {
         if (count($MyWishlist)) {
             $link = JURI::root() . "index.php?tmpl=component&option=com_redshop&view=account&layout=mywishlist&mail=1";
             foreach ($MyWishlist as $row) {
                 $data_add .= '<div class="redProductWishlist">';
                 $thum_image = "";
                 $pname = $row->product_name;
                 $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&Itemid=' . $Itemid);
                 $thum_image = $producthelper->getProductImage($row->product_id, $link, THUMB_WIDTH, THUMB_HEIGHT);
                 $data_add .= $thum_image;
                 $pname = "<div><a href='" . $link . "' >" . $pname . "</a></div>";
                 $data_add .= $pname;
                 $formatted_price = $producthelper->GetProductShowPrice($row->product_id, $wishlist_data);
                 // For attribute price count
                 $price_add = '<span id="pr_price">' . $formatted_price . '</span>';
                 $i++;
                 $data_add .= '</div>';
             }
         }
     }
     if (JFactory::getMailer()->sendMail($email, $sender, $emailto, $subject, $data_add, true, null, $mailbcc)) {
         return true;
     } else {
         return false;
     }
 }
Esempio 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 ");
    }
}