Пример #1
0
 function genMenuItem(&$row, $level, $pos)
 {
     global $urlpath;
     $app = JFactory::getApplication();
     $txt = '';
     $objhelper = new redhelper();
     $Itemid = JRequest::getInt('Itemid', '1');
     $cItemid = $objhelper->getCategoryItemid($row->id);
     if ($cItemid != "") {
         $tmpItemid = $cItemid;
     } else {
         $tmpItemid = $Itemid;
     }
     switch ($row->type) {
         case 'separator':
         case 'component_item_link':
             break;
         case 'content_item_link':
             $temp = split("&task=view&id=", $row->link);
             $row->link .= '&Itemid=' . $app->getItemid($temp[1]);
             break;
         case 'url':
             if (eregi('index.php\\?', $row->link)) {
                 if (!eregi('Itemid=', $row->link)) {
                     $row->link .= '&Itemid=' . $tmpItemid;
                 }
             }
             break;
         case 'content_typed':
         default:
             $row->link .= '&Itemid=' . $tmpItemid;
             break;
     }
     if (strcasecmp(substr($row->link, 0, 4), 'http')) {
         $row->link = JRoute::_($row->link);
     }
     if ($level) {
         $pmenu = "tmenu{$row->parent}";
         $active = 0;
         if (in_array($row->id, $this->parent->open)) {
             $active = 1;
         }
         $row->link = JRoute::_($row->link);
         echo "{$pmenu}.addItem(\"{$row->name}\", \"{$row->link}\", {$row->browserNav}, {$active});\n";
     } else {
         $pmenu = "ms";
     }
     $cmenu = "tmenu{$row->id}";
     $idmenu = "menu{$row->id}";
     if ($this->parent->hasSubItems($row->id)) {
         if ($level == 0) {
             echo "var {$cmenu} = " . $pmenu . ".addMenu(document.getElementById(\"{$idmenu}\"));\n";
         } else {
             echo "var {$cmenu} = " . $pmenu . ".addMenu(" . $pmenu . ".items[" . $pos . "]);\n";
         }
     }
 }
Пример #2
0
 function traverse_tree_down(&$mymenu_content, $category_id = '0', $level = '0', $shopper_group_id)
 {
     static $ibg = 0;
     global $Itemid, $urlpath, $sortparam;
     $db = JFactory::getDbo();
     $objhelper = new redhelper();
     $Itemid = JRequest::getInt('Itemid');
     $level++;
     $redproduct_menu = new modProMenuHelper();
     if ($shopper_group_id) {
         $shoppergroup_cat = $redproduct_menu->get_shoppergroup_cat($shopper_group_id);
     }
     $query = "SELECT category_name as cname, category_id as cid, category_child_id as ccid FROM #__redshop_category as a " . "LEFT JOIN #__redshop_category_xref as b ON a.category_id=b.category_child_id " . "WHERE a.published=1 " . "AND b.category_parent_id=" . (int) $category_id;
     if ($shopper_group_id && count($shoppergroup_cat) > 0) {
         $query .= " and category_id in (" . $shoppergroup_cat[0] . ")";
     }
     $query .= " ORDER BY " . $sortparam . "";
     $db->setQuery($query);
     $categories = $db->loadObjectList();
     if (!($categories == null)) {
         $i = 1;
         $numCategories = count($categories);
         foreach ($categories as $category) {
             $ibg++;
             $Treeid = $ibg;
             $cItemid = $objhelper->getCategoryItemid($category->cid);
             if ($cItemid != "") {
                 $tmpItemid = $cItemid;
             } else {
                 $tmpItemid = $Itemid;
             }
             $mymenu_content .= str_repeat("\t", $level - 1);
             if ($level > 1 && $i == 1) {
                 $mymenu_content .= ",";
             }
             $mymenu_content .= "['" . $category->cname;
             //$mymenu_content.= "','href='".JRoute::_($urlpath.'index.php?option=com_redshop&view=category&layout=detail&cid='.$category->cid.'&Treeid='.$Treeid.$itemid)."\''\n ";
             $mymenu_content .= "','href=\\'" . JRoute::_('index.php?option=com_redshop&view=category&layout=detail&cid=' . $category->cid . '&Treeid=' . $Treeid . '&Itemid=' . $tmpItemid) . "\\''\n ";
             /* recurse through the subcategories */
             $this->traverse_tree_down($mymenu_content, $category->ccid, $level, $shopper_group_id);
             $mymenu_content .= str_repeat("\t", $level - 1);
             /* let's see if the loop has reached its end */
             if ($i == sizeof($categories) && $level == 1) {
                 $mymenu_content .= "]\n";
             } else {
                 $mymenu_content .= "],\n";
             }
             $i++;
         }
     }
 }
Пример #3
0
 function traverse_tree_down(&$mymenu_content, $category_id = '0', $level = '0', $params = '', $shopper_group_id)
 {
     static $ibg = 0;
     global $urlpath, $redproduct_menu;
     $db = JFactory::getDbo();
     $level++;
     $redproduct_menu = new modProMenuHelper();
     if ($params->get('categorysorttype') == "catnameasc") {
         $sortparam = "category_name ASC";
     }
     if ($params->get('categorysorttype') == "catnamedesc") {
         $sortparam = "category_name DESC";
     }
     if ($params->get('categorysorttype') == "newest") {
         $sortparam = "category_id DESC";
     }
     if ($params->get('categorysorttype') == "catorder") {
         $sortparam = "ordering ASC";
     }
     if ($shopper_group_id) {
         $shoppergroup_cat = $redproduct_menu->get_shoppergroup_cat($shopper_group_id);
     }
     $query = "SELECT category_name, category_id, category_child_id FROM #__redshop_category AS a " . "LEFT JOIN #__redshop_category_xref as b ON a.category_id=b.category_child_id " . "WHERE a.published='1' " . "AND b.category_parent_id= " . (int) $category_id;
     if ($shopper_group_id && count($shoppergroup_cat) > 0) {
         $query .= " and category_id IN(" . $shoppergroup_cat[0] . ")";
     }
     $query .= " ORDER BY " . $sortparam . "";
     //	."ORDER BY ".$sortparam."";
     $db->setQuery($query);
     $traverse_results = $db->loadObjectList();
     $objhelper = new redhelper();
     $Itemid = JRequest::getInt('Itemid');
     foreach ($traverse_results as $traverse_result) {
         $cItemid = $objhelper->getCategoryItemid($traverse_result->category_id);
         if ($cItemid != "") {
             $tmpItemid = $cItemid;
         } else {
             $tmpItemid = $Itemid;
         }
         if ($ibg != 0) {
             $mymenu_content .= ",";
         }
         $mymenu_content .= "\n[ '<img src=\"' + ctThemeXPBase + 'darrow.png\" alt=\"arr\" />','" . $traverse_result->category_name . "','" . JRoute::_('index.php?option=com_redshop&view=category&layout=detail&cid=' . $traverse_result->category_id . '&Itemid=' . $tmpItemid) . "',null,'" . $traverse_result->category_name . "'\n ";
         $ibg++;
         /* recurse through the subcategories */
         $this->traverse_tree_down($mymenu_content, $traverse_result->category_child_id, $level, $params, $shopper_group_id);
         /* let's see if the loop has reached its end */
         $mymenu_content .= "]";
     }
 }
Пример #4
0
 public function getProductCaterories($product_id, $displaylink = 0)
 {
     $prodCatsObjectArray = array();
     $query = "SELECT  ct.category_name, ct.category_id FROM " . $this->_table_prefix . "category AS ct " . "LEFT JOIN " . $this->_table_prefix . "product_category_xref AS pct ON ct.category_id=pct.category_id " . "WHERE pct.product_id = " . (int) $product_id . " " . "AND ct.published=1 ";
     $this->_db->setQuery($query);
     $rows = $this->_db->loadObjectList();
     for ($i = 0; $i < count($rows); $i++) {
         $ppCat = $pCat = '';
         $row = $rows[$i];
         $query = "SELECT cx.category_parent_id,c.category_name FROM " . $this->_table_prefix . "category_xref AS cx " . "LEFT JOIN " . $this->_table_prefix . "category AS c ON cx.category_parent_id=c.category_id " . "WHERE cx.category_child_id=" . (int) $row->category_id;
         $this->_db->setQuery($query);
         $parentCat = $this->_db->loadObject();
         if (count($parentCat) > 0 && $parentCat->category_parent_id) {
             $pCat = $parentCat->category_name;
             $query = "SELECT cx.category_parent_id,c.category_name FROM " . $this->_table_prefix . "category_xref AS cx " . "LEFT JOIN " . $this->_table_prefix . "category AS c ON cx.category_parent_id=c.category_id " . "WHERE cx.category_child_id = " . (int) $parentCat->category_parent_id;
             $this->_db->setQuery($query);
             $pparentCat = $this->_db->loadObject();
             if (count($pparentCat) > 0 && $pparentCat->category_parent_id) {
                 $ppCat = $pparentCat->category_name;
             }
         }
         $spacediv = isset($pCat) && $pCat ? " > " : "";
         $pspacediv = isset($ppCat) && $ppCat ? " > " : "";
         $catlink = '';
         if ($displaylink) {
             $redhelper = new redhelper();
             $catItem = $redhelper->getCategoryItemid($row->category_id);
             $catlink = JRoute::_('index.php?option=com_redshop&view=category&layout=detail&cid=' . $row->category_id . '&Itemid=' . $catItem);
         }
         $prodCatsObject = new stdClass();
         $prodCatsObject->name = $ppCat . $pspacediv . $pCat . $spacediv . $row->category_name;
         $prodCatsObject->link = $catlink;
         $prodCatsObjectArray[] = $prodCatsObject;
     }
     return $prodCatsObjectArray;
 }
Пример #5
0
     $w_thumb = THUMB_WIDTH_3;
 } elseif (strstr($middletemplate_desc, '{category_thumb_image_1}')) {
     $tag = '{category_thumb_image_1}';
     $h_thumb = THUMB_HEIGHT;
     $w_thumb = THUMB_WIDTH;
 } else {
     $tag = '{category_thumb_image}';
     $h_thumb = THUMB_HEIGHT;
     $w_thumb = THUMB_WIDTH;
 }
 $extraFieldName = $extraField->getSectionFieldNameArray(2, 1, 1);
 $data_add = "";
 for ($i = 0; $i < count($this->detail); $i++) {
     $row = $this->detail[$i];
     $data_add .= $middletemplate_desc;
     $cItemid = $objhelper->getCategoryItemid($row->category_id);
     if ($cItemid != "") {
         $tmpItemid = $cItemid;
     } else {
         $tmpItemid = $this->itemid;
     }
     $link = JRoute::_('index.php?option=com_redshop&view=category&cid=' . $row->category_id . '&layout=detail&Itemid=' . $tmpItemid);
     $middlepath = REDSHOP_FRONT_IMAGES_RELPATH . 'category/';
     $title = " title='" . $row->category_name . "' ";
     $alt = " alt='" . $row->category_name . "' ";
     $product_img = REDSHOP_FRONT_IMAGES_ABSPATH . "noimage.jpg";
     $linkimage = $product_img;
     if ($row->category_full_image && file_exists($middlepath . $row->category_full_image)) {
         $product_img = $objhelper->watermark('category', $row->category_full_image, $w_thumb, $h_thumb, WATERMARK_CATEGORY_THUMB_IMAGE, '0');
         $linkimage = $objhelper->watermark('category', $row->category_full_image, '', '', WATERMARK_CATEGORY_IMAGE, '0');
     } elseif (CATEGORY_DEFAULT_IMAGE && file_exists($middlepath . CATEGORY_DEFAULT_IMAGE)) {
Пример #6
0
				    class="key"><?php 
echo JText::_('COM_REDSHOP_PRODUCT_COMPARE_TEMPLATE_FOR_CATEGORY');
?>
:
				</td>
				<td><?php 
echo $this->lists['compare_template_id'];
echo JHTML::tooltip(JText::_('COM_REDSHOP_TOOLTIP_PRODUCT_COMPARE_TEMPLATE_FOR_CATEGORY_LABEL'), JText::_('COM_REDSHOP_TOOLTIP_PRODUCT_COMPARE_TEMPLATE_FOR_CATEGORY'), 'tooltip.png', '', '', false);
?>
</td>
			</tr>

			<?php 
if ($this->detail->category_id > 0) {
    $catid = $this->detail->category_id;
    $Itemid = $objhelper->getCategoryItemid($catid);
    if ($Itemid != '') {
        $cItemid = $Itemid;
    } else {
        $cItemid = '';
    }
    //echo "<pre>";print_r($Itemid);exit;
    ?>
				<tr>
					<td valign="top" align="right" class="key"><?php 
    echo JText::_('COM_REDSHOP_FRONTEND_LINK');
    ?>
:
					</td>
					<td>
						<a href="<?php 
Пример #7
0
 function get_category_tree($params, $category_id = 0, $links_css_class = "mainlevel", $list_css_class = "mm123", $highlighted_style = "font-style:italic;", $shopper_group_id)
 {
     $objhelper = new redhelper();
     $parent_selected = $params->get('redshop_category', '');
     $parent_selected_remove = $params->get('redshop_category_remove', '');
     $categories = $this->getCategoryTreeArray($only_published = 1, $keyword = "", $shopper_group_id, $parent_selected_remove);
     // $categories = $this->getCategoryTreeArray(); // Get array of category objects
     // Sort array of category objects
     $result = $this->sortCategoryTreeArray($categories, $parent_selected);
     $row_list = $result['row_list'];
     $depth_list = $result['depth_list'];
     $category_tmp = $result['category_tmp'];
     $nrows = sizeof($category_tmp);
     // Copy the Array into an Array with auto_incrementing Indexes
     // Array of category table primary keys
     $key = array_keys($categories);
     // Category count
     $nrows = $size = sizeOf($key);
     $html = "";
     // Find out if we have subcategories to display
     $allowed_subcategories = array();
     if (!empty($categories[$category_id]["category_parent_id"])) {
         // Find the Root Category of this category
         $root = $categories[$category_id];
         $allowed_subcategories[] = $categories[$category_id]["category_parent_id"];
         // Loop through the Tree up to the root
         while (!empty($root["category_parent_id"])) {
             $allowed_subcategories[] = $categories[$root["category_child_id"]]["category_child_id"];
             $root = $categories[$root["category_parent_id"]];
         }
     }
     // Fix the empty Array Fields
     if ($nrows < count($row_list)) {
         $nrows = count($row_list);
     }
     // Now show the categories
     for ($n = 0; $n < $nrows; $n++) {
         if (!isset($row_list[$n]) || !isset($category_tmp[$row_list[$n]]["category_child_id"])) {
             continue;
         }
         if ($category_id == $category_tmp[$row_list[$n]]["category_child_id"] || $category_tmp[$row_list[$n]]["category_child_id"] == $root["category_child_id"] || in_array($category_tmp[$row_list[$n]]["category_child_id"], $allowed_subcategories)) {
             $style = $highlighted_style;
         } else {
             $style = "";
         }
         $allowed = false;
         if ($depth_list[$n] > 0) {
             // Subcategory!
             if (isset($root) && in_array($category_tmp[$row_list[$n]]["category_child_id"], $allowed_subcategories) || $category_tmp[$row_list[$n]]["category_parent_id"] == $category_id || $category_tmp[$row_list[$n]]["category_parent_id"] == @$categories[$category_id]["category_parent_id"] || $category_tmp[$row_list[$n]]["category_parent_id"] == $root["category_child_id"]) {
                 $allowed = true;
             }
         } else {
             $allowed = true;
         }
         $append = "";
         $class = "";
         if ($allowed) {
             if ($n == 0) {
                 $html .= '<ul>';
             }
             if ($style == $highlighted_style) {
                 $append = '&id=active_menu';
                 $class = "class='active'";
             }
             if ($depth_list[$n] > 0) {
                 $css_class = "sublevel";
                 if ($depth_list[$n] > $sub) {
                     $html .= '<ul>';
                     $sub = $depth_list[$n];
                 }
                 if ($depth_list[$n] < $sub) {
                     for ($i = $depth_list[$n]; $i < $sub; $i++) {
                         $html .= '</ul></li>';
                     }
                     $sub = $depth_list[$n];
                 }
             } else {
                 $css_class = $links_css_class;
                 if ($sub > 0) {
                     $html .= str_repeat("</ul></li>", $sub);
                     $sub = 0;
                 }
                 $html .= "</li>";
             }
             $catname = JText::_($category_tmp[$row_list[$n]]["category_name"]);
             $Itemid = $objhelper->getCategoryItemid($category_tmp[$row_list[$n]]["category_child_id"]);
             if (!$Itemid) {
                 $Itemid = JRequest::getInt('Itemid');
             }
             $uri = JURI::getInstance();
             $url = $uri->root();
             $catlink = 'index.php?option=com_redshop&view=category&layout=detail&cid=' . $category_tmp[$row_list[$n]]["category_child_id"] . $append . '&Itemid=' . $Itemid;
             $html .= '
        <li ' . $class . ' ><a title="' . $catname . '" style="display:block;' . $style . '" class="' . $css_class . '" href=' . JRoute::_($catlink) . '>' . str_repeat("", $depth_list[$n]) . $catname . $this->products_in_category($category_tmp[$row_list[$n]]["category_child_id"], $params) . '</a>';
             if ($n == $nrows - 1) {
                 $html .= "</ul>";
             }
         }
     }
     return $html;
 }
Пример #8
0
$redhelper = new redhelper();
$uri = JURI::getInstance();
$url = $uri->root(true);
$app = JFactory::getApplication();
$itemId = (int) $redhelper->getCartItemid();
$getNewItemId = true;
if ($itemId != 0) {
    $menu = $app->getMenu();
    $item = $menu->getItem($itemId);
    $getNewItemId = false;
    if (isset($item->id) === false) {
        $getNewItemId = true;
    }
}
if ($getNewItemId) {
    $itemId = (int) $redhelper->getCategoryItemid();
}
$display_button = JText::_('COM_REDSHOP_CHECKOUT');
if ($button_text != "") {
    $display_button = $button_text;
}
$link = JRoute::_("index.php?option=com_redshop&view=cart&Itemid=" . $itemId);
$cartTotalProduct = $count;
$cartTotallbl = "";
$cartTotalValue = "";
$shippingvalue = "";
$shippinglbl = "";
if (!DEFAULT_QUOTATION_MODE || DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE) {
    $cartTotallbl = JText::_('COM_REDSHOP_TOTAL') . ':';
    $shippinglbl = JText::_('COM_REDSHOP_SHIPPING_LBL') . ':';
    $cartTotalValue = $producthelper->getProductFormattedPrice($total);
Пример #9
0
// it could be that we are displaying e.g. mainmenu in this dtree,
// but item in usermenu is selected,
// so: for the rest of this module track if this menu contains the selected item
// Default value: first node (=baseid), but not selected
$opento = $baseid;
$opento_selected = "false";
// what do you know... the first node was selected
if ($baseid == $openid) {
    $opento_selected = "true";
}
$target = "";
// create the first node, parent is always -1
$menu_htmlcode .= "{$tree}.add(\"{$baseid}\",\"-1\",\"{$basename}\",\"{$baselink}\",\"\",\"{$target}\");\n";
$document = JFactory::getDocument();
foreach ($catdatas as $catdata) {
    $cItemid = $objhelper->getCategoryItemid($catdata->category_id);
    if ($cItemid != "") {
        $tmpItemid = $cItemid;
    } else {
        $tmpItemid = $Itemid;
    }
    // get name and link (just to save space in the code later on)
    $name = $catdata->category_name . $redproduct_menu->products_in_category($catdata->category_id, $params);
    $url = JRoute::_("index.php?option=com_redshop&view=category&layout=detail&Itemid=" . $tmpItemid . "&cid=" . $catdata->category_id);
    $menu_htmlcode .= "{$tree}.add(\"" . $catdata->category_id . "\",\"" . $catdata->category_parent_id . "\",\"{$name}\",\"{$url}\",\"\",\"{$target}\");\n";
    // if this node is the selected node
    if ($catdata->category_id == $openid) {
        $opento = $openid;
        $opento_selected = "true";
    }
}
Пример #10
0
    $print_url = $url . "index.php?option=com_redshop&view=manufacturers&print=1&tmpl=component&Itemid=" . $Itemid;
    $onclick = "onclick='window.open(\"{$print_url}\",\"mywindow\",\"scrollbars=1\",\"location=1\")'";
}
$print_tag = "<a " . $onclick . " title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "'>";
$print_tag .= "<img src='" . JSYSTEM_IMAGES_PATH . "printButton.png' alt='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' />";
$print_tag .= "</a>";
if (strstr($template_desc, "{category_loop_start}") && strstr($template_desc, "{category_loop_end}")) {
    $template_d1 = explode("{category_loop_start}", $template_desc);
    $template_d2 = explode("{category_loop_end}", $template_d1[1]);
    $subcat_template = $template_d2[0];
    $cat_detail = "";
    foreach ($detail as $row) {
        $category = $row['category_detail'];
        $manufacturers = $row['manufacturers'];
        $data_add = $subcat_template;
        $cItemid = $redhelper->getCategoryItemid($category->category_id);
        if ($cItemid != "") {
            $tmpItemid = $cItemid;
        } else {
            $tmpItemid = $Itemid;
        }
        $link = JRoute::_('index.php?option=' . $option . '&view=category&cid=' . $category->category_id . '&layout=detail&Itemid=' . $tmpItemid);
        $title = " title='" . $category->category_name . "' ";
        if (strstr($data_add, '{category_name}')) {
            $cat_name = '<a href="' . $link . '" ' . $title . '>' . $category->category_name . '</a>';
            $data_add = str_replace("{category_name}", $cat_name, $data_add);
        }
        if (strstr($data_add, '{manufacturer_loop_start}') && strstr($data_add, '{manufacturer_loop_end}')) {
            $data_add_d1 = explode("{manufacturer_loop_start}", $data_add);
            $data_add_d2 = explode("{manufacturer_loop_end}", $data_add_d1[1]);
            $template_middle = $data_add_d2[0];