Beispiel #1
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redshop.cfg.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/configuration.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/template.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/stockroom.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/economic.php';
     require_once JPATH_SITE . '/components/com_redshop/helpers/product.php';
     $Redconfiguration = new Redconfiguration();
     $data = array();
     $where = array();
     $category = array_map('intval', explode('||', $this->_data->get('redshopproductssourcecategory', '')));
     if (!in_array(0, $category) && count($category) > 0) {
         $where[] = 'pr_cat.category_id IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('redshopproductssourcepublished', 1)) {
         $where[] = ' pr.published = 1 ';
     }
     if ($this->_data->get('redshopproductssourcespecial', 0)) {
         $where[] = ' (pr.product_special =  1) ';
     }
     if ($this->_data->get('redshopproductssourceonsale', 0)) {
         $where[] = ' (pr.product_on_sale =  1) ';
     }
     $o = '';
     $order = NextendParse::parse($this->_data->get('redshopproductsorder1', 'pr.product_name|*|asc'));
     if ($order[0]) {
         $o .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('redshopproductsorder2', 'pr.product_name|*|asc'));
         if ($order[0]) {
             $o .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query = "SELECT \r\n                        pr.product_id, \r\n                        pr.published, \r\n                        pr_cat.ordering, \r\n                        pr.product_name as name, \r\n                        pr.product_s_desc as short_description, \r\n                        pr.product_desc as description, \r\n                        man.manufacturer_name as man_name,\r\n                        pr.product_full_image as image, \r\n                        pr.product_thumb_image as image_thumbnail, \r\n                        pr.product_price,\r\n                        cat.category_id,\r\n                        cat.category_name, \r\n                        cat.category_short_description , \r\n                        cat.category_description\r\n                    FROM `#__redshop_product` AS pr\r\n                    LEFT JOIN `#__redshop_product_category_xref` AS pr_cat USING (product_id)\r\n                    LEFT JOIN `#__redshop_category` AS cat USING (category_id)\r\n                    LEFT JOIN `#__redshop_manufacturer` AS man USING(manufacturer_id)\r\n                    WHERE pr.product_parent_id=0 " . (count($where) ? ' AND ' . implode(' AND ', $where) : '') . " " . $o . " LIMIT 0, " . $number;
     $db->setQuery($query);
     $result = $db->loadAssocList();
     $uri = str_replace(array('http://', 'https://'), '//', NextendUri::getBaseUri());
     for ($i = 0; $i < count($result); $i++) {
         $product = new producthelper();
         $result[$i]['title'] = $result[$i]['name'];
         $result[$i]['price'] = $product->getProductFormattedPrice($product->getProductPrice($result[$i]['product_id']));
         $result[$i]['addtocart'] = $result[$i]['url'] = 'index.php?option=com_redshop&view=product&pid=' . $result[$i]['product_id'] . '&cid=' . $result[$i]['category_id'];
         $result[$i]['addtocart_label'] = 'View product';
         $result[$i]['category_url'] = 'index.php?option=com_redshop&view=category&cid=' . $result[$i]['category_id'] . '&layout=detail';
         $result[$i]['thumbnail'] = $result[$i]['image_thumbnail'] = $uri . REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . $result[$i]['image_thumbnail'];
         $result[$i]['image'] = $uri . REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . $result[$i]['image'];
     }
     return $result;
 }
Beispiel #2
0
function display_products($rows)
{
    $url = JURI::base();
    $extra_data = new producthelper();
    $producthelper = new producthelper();
    for ($i = 0; $i < count($rows); $i++) {
        $row = $rows[$i];
        $Itemid = $this->redHelper->getItemid($row->product_id);
        $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&Itemid=' . $Itemid);
        $product_price = $producthelper->getProductPrice($row->product_id);
        $productArr = $producthelper->getProductNetPrice($row->product_id);
        $product_price_discount = $productArr['productPrice'] + $productArr['productVat'];
        if ($row->product_full_image) {
            echo $thum_image = "<div class='mod_wishlist_product_image' >" . ($thum_image = $producthelper->getProductImage($row->product_id, $link, "100", "100") . "\n\t\t\t</div>");
        }
        echo "<a href='" . $link . "'>" . $row->product_name . "</a><br>";
        if ($row->product_on_sale && $product_price_discount > 0) {
            if ($product_price > $product_price_discount) {
                $s_price = $product_price - $product_price_discount;
                if ($this->show_discountpricelayout) {
                    echo "<div id='mod_redoldprice' class='mod_redoldprice'><span style='text-decoration:line-through;'>" . $producthelper->getProductFormattedPrice($product_price) . "</span></div>";
                    $product_price = $product_price_discount;
                    echo "<div id='mod_redmainprice' class='mod_redmainprice'>" . $producthelper->getProductFormattedPrice($product_price_discount) . "</div>";
                    echo "<div id='mod_redsavedprice' class='mod_redsavedprice'>" . JText::_('COM_REDSHOP_PRODCUT_PRICE_YOU_SAVED') . ' ' . $producthelper->getProductFormattedPrice($s_price) . "</div>";
                } else {
                    $product_price = $product_price_discount;
                    echo "<div class='mod_redproducts_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>";
                }
            } else {
                echo "<div class='mod_redproducts_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>";
            }
        } else {
            echo "<div class='mod_redproducts_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>";
        }
        echo "<br><a href='" . $link . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>&nbsp;";
        echo $addtocartdata = $producthelper->replaceCartTemplate($row->product_id);
        echo "<div>" . $addtocartdata . "</div>";
    }
}
Beispiel #3
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;
 }
Beispiel #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');
     }
 }
Beispiel #5
0
     $tag = '{product_thumb_image}';
     $h_thumb = THUMB_HEIGHT;
     $w_thumb = THUMB_WIDTH;
 }
 $temp_template = '';
 $extraFieldName = $extraField->getSectionFieldNameArray(1, 1, 1);
 if (count($MyWishlist) > 0) {
     $mainid = null;
     $totattid = null;
     $totcount_no_user_field = null;
     foreach ($MyWishlist as $row) {
         $wishlistuserfielddata = $producthelper->getwishlistuserfieldata($row->wishlist_id, $row->product_id);
         $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&Itemid=' . $Itemid);
         $link_remove = JRoute::_('index.php?option=com_redshop&view=account&layout=mywishlist&wishlist_id=' . $wishlist_id . '&pid=' . $row->product_id . '&remove=1&Itemid=' . $Itemid);
         $thum_image = $producthelper->getProductImage($row->product_id, $link, $w_thumb, $h_thumb);
         $product_price = $producthelper->getProductPrice($row->product_id);
         $product_price_discount = $producthelper->getProductNetPrice($row->product_id);
         $pname = "<a href='" . $link . "' >" . $row->product_name . "</a>";
         $wishlist_data = str_replace($tag, $thum_image, $wishlist_desc);
         $wishlist_data = str_replace('{product_number}', $row->product_number, $wishlist_data);
         $wishlist_data = str_replace('{product_name}', $pname, $wishlist_data);
         /*if($product_price > $product_price_discount)
         		{
         		$wishlist_data = str_replace('{product_price}', $producthelper->getProductFormattedPrice($product_price_discount) , $wishlist_data);
         		}else{
         		$wishlist_data = str_replace('{product_price}', $producthelper->getProductFormattedPrice($product_price) , $wishlist_data);
         		}*/
         $wishlist_data = str_replace('{product_s_desc}', $row->product_s_desc, $wishlist_data);
         // Checking for child products start
         if (strstr($wishlist_data, "{child_products}")) {
             $parentproductid = $row->product_id;
Beispiel #6
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 ");
    }
}