/**
  * Redirects after action.
  */
 function redirect()
 {
     global $application;
     $request = new Request();
     $request->setView('EditCategory');
     $request->setKey('tree_id', modApiFunc('Request', 'getValueByKey', 'tree_id'));
     // getting the category name for category tree
     // Note: assume the data language for the tree page is not changed
     //       otherwise the data language for that page should be set below
     // Note: Since the redirect is taken place we do not worry about
     //       restoring the language
     modApiFunc('MultiLang', 'setLanguage', modApiFunc('MultiLang', 'getResourceLanguage'));
     $catInfo = new CCategoryInfo($this->old_id);
     $request->setKey('new_name', urlencode($catInfo->getCategoryTagValue('name')));
     $request->setKey('old_id', $this->old_id);
     $application->redirect($request);
 }
 function outputLocationBreadcrumb($parents_list, $links, $view_name = "NavigationBar")
 {
     global $application;
     $CategoryId1Info = new CCategoryInfo(1);
     $this->CategoryId1Name = $CategoryId1Info->getCategoryTagValue('name');
     $retval = "";
     $isFirst = 1;
     $n = sizeof($parents_list);
     for ($i = 0; $i < $n; $i++) {
         $value = $parents_list[$i];
         $cat = new CCategoryInfo($value["id"]);
         $name = prepareHTMLDisplay($value["name"]);
         if ($cat->getCategoryTagValue('RecursiveStatus') == CATEGORY_STATUS_ONLINE) {
         } else {
             $name = '<span style="color: rgb(175, 175, 175);">' . $name . '</span>';
         }
         $arr = array("Href" => $this->getLinkToView($value["id"], $view_name, $cat), "Name" => $name, "CategoryId1Name" => prepareHTMLDisplay($this->CategoryId1Name));
         if ($n == 1) {
             $retval .= $this->mTmplFiller->fill("catalog/breadcrumb/", "single.tpl.html", $arr);
         } else {
             if ($i == 0) {
                 if ($links) {
                     $retval .= $this->mTmplFiller->fill("catalog/breadcrumb/", "first_link.tpl.html", $arr);
                 } else {
                     $retval .= $this->mTmplFiller->fill("catalog/breadcrumb/", "first.tpl.html", $arr);
                 }
             } else {
                 if ($i == $n - 1) {
                     $retval .= $this->mTmplFiller->fill("catalog/breadcrumb/", "last.tpl.html", $arr);
                 } else {
                     if ($links) {
                         $retval .= $this->mTmplFiller->fill("catalog/breadcrumb/", "default_link.tpl.html", $arr);
                     } else {
                         $retval .= $this->mTmplFiller->fill("catalog/breadcrumb/", "default.tpl.html", $arr);
                     }
                 }
             }
         }
     }
     if ($retval == "") {
         CTrace::wrn(array("CODE" => "CORE_053"), __CLASS__, __FUNCTION__);
     }
     return $retval;
 }
 /**
  *
  *
  * Action: Confirm Copy Products.
  *
  * @ finish the functions on this page
  */
 function onAction()
 {
     global $application;
     $request = $application->getInstance('Request');
     $req = $_POST;
     $to_categoryval = $req['to_category_id'];
     $from_category = modApiFunc('CProductListFilter', 'getCurrentCategoryId');
     $to_category = explode("|", $to_categoryval);
     $products_ids = $request->getValueByKey('products_ids');
     $products_ids = explode("|", $products_ids);
     $catsprods = array_combine($products_ids, $to_category);
     if ($to_category != null and $products_ids != null) {
         modApiFunc('Catalog', 'copyProducts', $catsprods);
         $cat_obj = new CCategoryInfo($to_category);
         modApiFunc('Paginator', 'setPaginatorPageToLast', 'Catalog_ProdsList_' . $to_category, $cat_obj->getCategoryTagValue('productsnumber'));
     }
     modApiFunc('CProductListFilter', 'changeCurrentCategoryId', $to_category);
     $request->setView('ProductList');
     $application->redirect($request);
 }
 function output()
 {
     global $application;
     $this->msg_res =& $application->getInstance('MessageResources');
     $this->category_id = modApiFunc('CProductListFilter', 'getCurrentCategoryId');
     loadClass('CCategoryInfo');
     $cat_info = new CCategoryInfo($this->category_id);
     $this->_Current_Category =& $cat_info;
     $i_w = $cat_info->getCategoryTagValue('SmallImageWidth');
     $i_h = $cat_info->getCategoryTagValue('SmallImageHeight');
     $i_url = $cat_info->getCategoryTagValue('SmallImageSrc');
     if ($i_url == '' || $i_w == 0 || $i_h == 0) {
         $i_w = 100;
         $i_h = 100;
         $i_url = $this->no_image_url;
     }
     $cat_info->setAdditionalCategoryTag('AttributeImageWidth', $i_w);
     $cat_info->setAdditionalCategoryTag('AttributeImageHeight', $i_h);
     $cat_info->setAdditionalCategoryTag('AttributeImageURL', $i_url);
     $cat_info->setAdditionalCategoryTag('CategoryStatus', $cat_info->getCategoryTagValue('status', CATEGORYINFO_LOCALIZED_DATA));
     $application->registerAttributes($cat_info->getAdditionalCategoryTagList());
     $application->registerAttributes(array('CategoryProducts', 'CategoryProductsRec', 'FeaturedProducts', 'BestsellersProducts'));
     return modApiFunc('TmplFiller', 'fill', "catalog/category_review/", "review.tpl.html", array());
 }
 /**
  * Returns the Catalog Category Info view.
  *
  * @ finish the functions on this page
  */
 function output()
 {
     global $application;
     $obj =& $application->getInstance('MessageResources');
     $CatID = modApiFunc('Catalog', 'getEditableCategoryID');
     if ($CatID == NULL) {
     } else {
         $catInfo = new CCategoryInfo($CatID);
         $request = new Request();
         $request->setView('EditCategory');
         $request->setAction('SetEditableCategory');
         $request->setKey('category_id', $CatID);
         $catInfo->setAdditionalCategoryTag('EditCatHref', $request->getURL());
         $cat_status = "";
         switch ($catInfo->getCategoryTagValue("Status")) {
             case CATEGORY_STATUS_ONLINE:
                 $cat_status = getMsg('SYS', 'CAT_STATUS_ONLINE');
                 break;
             case CATEGORY_STATUS_OFFLINE:
                 $cat_status = getMsg('SYS', 'CAT_STATUS_OFFLINE');
                 break;
             default:
                 //: report error
                 $cat_status = "";
         }
         $this->_Current_Category = $catInfo;
         $this->_Current_Category->setAdditionalCategoryTag('ShowProductsRecursivelyStatus', $catInfo->getCategoryTagValue('showproductsrecursivelystatus', CATEGORYINFO_LOCALIZED_DATA));
         $this->_Current_Category->setAdditionalCategoryTag('CategoryStatus', $catInfo->getCategoryTagValue('status', CATEGORYINFO_LOCALIZED_DATA));
         $this->_Current_Category->setAdditionalCategoryTag('AttributeImageWidth', $catInfo->getCategoryTagValue('LargeImageWidth'));
         $this->_Current_Category->setAdditionalCategoryTag('AttributeImageHeight', $catInfo->getCategoryTagValue('LargeImageHeight'));
         $this->_Current_Category->setAdditionalCategoryTag('AttributeImageURL', $catInfo->getCategoryTagValue('LargeImageSrc'));
         $this->_Current_Category->setAdditionalCategoryTag('largeimage', $obj->getMessage(new ActionMessage('INFO_CTGR_NO_IMG')));
         $application->registerAttributes($this->_Current_Category->getAdditionalCategoryTagList());
         $application->registerAttributes(array('SmallImage'));
         if ($this->_Current_Category->getCategoryTagValue('largeimagesrc') != '') {
             $this->_Current_Category->setAdditionalCategoryTag('largeimage', modApiFunc('TmplFiller', 'fill', "catalog/view_cat/", "attr-large-image.tpl.html", array()));
         }
         $retval = modApiFunc('TmplFiller', 'fill', "catalog/view_cat/", "list.tpl.html", array());
     }
     return $retval;
 }
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'Local_AddPromoCode_URL':
             $request = new Request();
             $request->setView(CURRENT_REQUEST_URL);
             $request->setAction('AddPromoCode');
             #$request->setKey( 'promo_code', '' );
             $value = $request->getURL();
             break;
         case 'Local_AddPromoCode_Error':
             $AddPromoCodeError = modApiFunc("PromoCodes", "getAddPromoCodeError");
             modApiFunc("PromoCodes", "setAddPromoCodeError", "");
             if (!empty($AddPromoCodeError)) {
                 $value = getMsg('SYS', $AddPromoCodeError);
             } else {
                 $value = "";
             }
             break;
         case 'Local_RemovePromoCode_URL':
             $request = new Request();
             $request->setView(CURRENT_REQUEST_URL);
             $request->setAction('RemovePromoCode');
             $value = $request->getURL();
             break;
         case 'Local_PromoCode':
             $value = '';
             if ($this->pc_info !== false) {
                 $value = prepareHTMLDisplay($this->pc_info["promo_code"]);
             }
             break;
         case 'Local_PromoCodeDiscountedItemsListForCZ':
             $value = '';
             if ($this->pc_info !== false && $this->applicable === true) {
                 $home_present = false;
                 $cat_names = array();
                 $prod_names = array();
                 if ($this->pc_info['cats'] != null) {
                     $cats = explode('|', $this->pc_info['cats']);
                     foreach ($cats as $cid) {
                         $cat_obj = new CCategoryInfo($cid);
                         if ($cat_obj->_fCategoryIDIsIncorrect === true) {
                             continue;
                         }
                         // Home category present, we do not need anything else
                         if ($cid == 1) {
                             $home_present = true;
                             $cat_names = array();
                             $cat_names[] = cz_getMsg('PROMOCODE_HOME_CATEGORY_NAME_SUBST');
                             break;
                         } else {
                             $cat_names[] = $cat_obj->getCategoryTagValue('Name');
                         }
                     }
                 }
                 if ($this->pc_info['prods'] != null && !$home_present) {
                     $prods = explode('|', $this->pc_info['prods']);
                     foreach ($prods as $pid) {
                         $obj = new CProductInfo($pid);
                         if (!$obj->isProductIdCorrect()) {
                             continue;
                         }
                         $prod_names[] = $obj->getProductTagValue('Name');
                     }
                 }
                 if ($cat_names) {
                     $cat_names_str = implode(', ', $cat_names);
                     if ($home_present) {
                         $value .= $cat_names_str;
                     } else {
                         if (count($cat_names) == 1) {
                             $value .= cz_getMsg("PROMOCODE_CATEGORY_LABEL") . $cat_names_str;
                         } else {
                             $value .= cz_getMsg("PROMOCODE_CATEGORIES_LABEL") . $cat_names_str;
                         }
                     }
                     if ($prod_names) {
                         $value .= cz_getMsg("PROMOCODE_AND_LABEL");
                     }
                 }
                 if ($prod_names) {
                     $prod_names_str = implode(', ', $prod_names);
                     if (count($prod_names) == 1) {
                         $value .= cz_getMsg("PROMOCODE_PRODUCT_LABEL") . $prod_names_str;
                     } else {
                         $value .= cz_getMsg("PROMOCODE_PRODUCTS_LABEL") . $prod_names_str;
                     }
                 }
             }
             break;
         case 'Local_PromoCodeMinSubtotal':
             $value = '';
             if ($this->pc_info !== false && $this->applicable === true && $this->pc_info["min_subtotal"] != 0) {
                 $min_subtotal = modApiFunc("Localization", "currency_format", $this->pc_info["min_subtotal"]);
                 $value = str_replace('{MINSUBTOTAL}', $min_subtotal, cz_getMsg('PROMOCODE_MINSUBTOTAL_NEEDED'));
             }
             break;
         case 'Local_PromoCodeDiscount':
             $value = '';
             if ($this->pc_info !== false && $this->applicable === true) {
                 $o_subtotal = modApiFunc("Checkout", "getOrderPrice", "Subtotal", modApiFunc("Localization", "getMainStoreCurrency"));
                 $value = modApiFunc("Localization", "currency_format", modApiFunc("PromoCodes", "getPromoCodeDiscount", $o_subtotal, modApiFunc("PromoCodes", "getPromoCodeId"), array()));
             }
             if ($value == "") {
                 $value = modApiFunc("Localization", "currency_format", PRICE_N_A);
             }
             break;
         case 'Local_PromoCodeDiscountText':
             //        "10%"     "$2"          ,
             //               .
             $value = "";
             if ($this->pc_info !== false && $this->applicable === true) {
                 switch ($this->pc_info["discount_cost_type_id"]) {
                     case 1:
                         $value = modApiFunc("Localization", "currency_format", $this->pc_info["discount_cost"]);
                         break;
                     case 2:
                         $value = modApiFunc("Localization", "num_format", $this->pc_info["discount_cost"]) . "%";
                         break;
                     default:
                         //: report error.
                         exit(1);
                 }
             }
             break;
         case 'Local_PromoCodeStrictCartAttitude':
             $value = '';
             if ($this->pc_info && $this->pc_info['strict_cart'] == PROMO_CODE_STRICT_CART) {
                 // get product IDs and their categories' IDs
                 $prod = $coupon_cart = array();
                 $promo_codes = $application->getInstance('PromoCodes');
                 $order_cart = modApiFunc("Cart", "getCartContentExt");
                 foreach ($order_cart as $product) {
                     $coupon_cart[] = array('id' => $product["ID"], 'cat' => $product['CategoryID'], 'total' => $product['TotalExcludingTaxes']);
                 }
                 // coupon not applicable due to not meeting coupon conditions
                 if (false == $promo_codes->isPromoCodeAreaApplicable($this->pc_info, $coupon_cart)) {
                     $value = cz_getMsg('PROMOCODE_STRICT_CART_NEEDED');
                 }
             }
             break;
         case 'Local_PromoCodeShippingAttitude':
             $value = '';
             if ($this->pc_info !== false && $this->applicable === true) {
                 if ($this->pc_info['free_shipping'] == PROMO_CODE_FORBIDS_FREE_SHIPPING) {
                     $value = cz_getMsg('PROMOCODE_FREE_SHIPPING_FORBIDDEN');
                 } else {
                     if ($this->pc_info['free_shipping'] == PROMO_CODE_GRANTS_FREE_SHIPPING) {
                         $value = cz_getMsg('PROMOCODE_FREE_SHIPPING_GRANTED');
                     }
                 }
             }
             break;
         case 'Local_PromoCodeHandlingAttitude':
             $value = '';
             if ($this->pc_info !== false && $this->applicable === true) {
                 if ($this->pc_info['free_handling'] == PROMO_CODE_FORBIDS_FREE_HANDLING) {
                     $value = cz_getMsg('PROMOCODE_FREE_HANDLING_FORBIDDEN');
                 } else {
                     if ($this->pc_info['free_handling'] == PROMO_CODE_GRANTS_FREE_HANDLING) {
                         $value = cz_getMsg('PROMOCODE_FREE_HANDLING_GRANTED');
                     }
                 }
             }
             break;
         case 'Local_PromoCodeGlobalDiscountIgnored':
             $value = '';
             if ($this->pc_info !== false && $this->applicable === true) {
                 if ($this->pc_info['b_ignore_other_discounts'] == 1) {
                     // ignore global discount
                     $value = cz_getMsg('PROMOCODE_GLOBAL_DISCOUNT_IGNORED');
                 }
             }
             break;
         default:
             $value = NULL;
             break;
     }
     return $value;
 }
 /**
  * Gets search filter data text
  */
 function getSearchFilterDataText()
 {
     // if empty filter -> returns empty string
     if (empty($this->psf_filter)) {
         return '';
     }
     $output = array();
     if ($this->psf_filter['pattern'] != '') {
         $line = getMsg('CTL', 'PSF_SEARCH_PATTERN') . ' ';
         if ($this->psf_filter['pattern_type'] == 'all') {
             $line .= '<b>' . getMsg('CTL', 'PSF_ALL_WORDS') . '</b>';
         } elseif ($this->psf_filter['pattern_type'] == 'any') {
             $line .= '<b>' . getMsg('CTL', 'PSF_ANY_WORD') . '</b>';
         } else {
             $line .= '<b>' . getMsg('CTL', 'PSF_EXACT_PHRASE') . '</b>';
         }
         $line .= ' ' . getMsg('CTL', 'PSF_OF') . ' ';
         $line .= '<b>"' . prepareHTMLDisplay($this->psf_filter['pattern']) . '"</b>';
         $line .= ' ' . getMsg('CTL', 'PSF_IN') . ' ';
         $in_fields = array();
         if (isset($this->psf_filter['in_name'])) {
             $in_fields[] = '<b>' . getMsg('SYS', 'PRD_NAME_NAME') . '</b>';
         }
         if (isset($this->psf_filter['in_id'])) {
             $in_fields[] = '<b>' . getMsg('SYS', 'PRD_ID_NAME') . '</b>';
         }
         if (isset($this->psf_filter['in_sku'])) {
             $in_fields[] = '<b>' . getMsg('SYS', 'PRD_SKU_NAME') . '</b>';
         }
         if (isset($this->psf_filter['in_descr'])) {
             $in_fields[] = '<b>' . getMsg('SYS', 'PRD_SHRDESCR_NAME') . '</b>';
         }
         if (isset($this->psf_filter['in_det_descr'])) {
             $in_fields[] = '<b>' . getMsg('SYS', 'PRD_DETDESCR_NAME') . '</b>';
         }
         if (isset($this->psf_filter['in_title'])) {
             $in_fields[] = '<b>' . getMsg('SYS', 'PRD_PAGETTL_NAME') . '</b>';
         }
         if (isset($this->psf_filter['in_keywords'])) {
             $in_fields[] = '<b>' . getMsg('SYS', 'PRD_METAKWRD_NAME') . '</b>';
         }
         if (isset($this->psf_filter['in_meta_descr'])) {
             $in_fields[] = '<b>' . getMsg('SYS', 'PRD_METADESCR_NAME') . '</b>';
         }
         $line .= join(', ', $in_fields);
         $output[] = $line;
     }
     if ($this->psf_filter['category'] > 0) {
         $line = getMsg('CTL', 'PSF_CATEGORY') . ' ';
         $tmp_info = new CCategoryInfo($this->psf_filter['category']);
         $line .= '<b>' . $tmp_info->getCategoryTagValue('name') . '</b>';
         if (isset($this->psf_filter['recursive'])) {
             $line .= ' (' . _ml_strtolower(getMsg('CTL', 'PSF_INCLUDE_SUBCATEGORIES')) . ')';
         }
         $output[] = $line;
     }
     if ($this->psf_filter['manufacturer'] > 0) {
         $line = getMsg('CTL', 'PSF_MANUFACTURER') . ' ';
         $tmp_info = modApiFunc('Manufacturers', 'getManufacturerInfo', $this->psf_filter['manufacturer']);
         $line .= '<b>' . $tmp_info['manufacturer_name'] . '</b>';
         $output[] = $line;
     }
     if ($this->psf_filter['price_min'] !== '' || $this->psf_filter['price_max'] !== '') {
         $line = getMsg('CTL', 'PSF_PRICE_RANGE') . ' ';
         $line .= $this->psf_filter['price_min'] !== '' ? '<b>' . $this->psf_filter['price_min'] . '</b>' : '<b>0.00</b>';
         $line .= $this->psf_filter['price_max'] !== '' ? ' - <b>' . $this->psf_filter['price_max'] . '</b>' : '<b>+</b>';
         $output[] = $line;
     }
     // request to reset filter
     $request = new Request();
     $request->setView('ProductList');
     $request->setAction('SetCurrCat');
     $request->setKey('category_id', 1);
     $request = $request->getURL();
     $output[] = '<input type="hidden" value="0" id="categoryval_id" /><a href="javascript:gotoCategory();" style="font-weight:bold; font-size:11px; color:#000; font-family:Tahoma,sans-serif; text-decoration:underline;">' . getMsg('CTL', 'PSF_RESET_FILTER') . '</a>';
     $output[] = '';
     //        $output[] = '<div class="button button_10em" title="' . getMsg('CTL', 'PSF_RESET_FILTER') . '" onclick="javascript:go(\'' . $request . '\');">' . getMsg('CTL', 'PSF_RESET_FILTER') . '</div>';
     if (count($this->psf_filter['result']) > 1) {
         $output[] = getMsg('CTL', 'PSF_SHOWING') . ' ' . '<b>' . $this->From . '</b> - <b>' . $this->To . '</b>' . ' ' . getMsg('CTL', 'PSF_OF') . ' <b>' . (count($this->psf_filter['result']) - 1) . '</b>';
     } else {
         $output[] = getMsg('CTL', 'PSF_NO_PRODUCTS_FOUND');
     }
     if (@$this->psf_filter['overflow']) {
         $output[] = ' <span style="color: red">' . getMsg('CTL', 'PSF_OVERFLOWTEXT') . '</span>';
     }
     return join('<br />', $output);
 }
 /**
  * Returns the Catalog Navigator Tree view.
  */
 function outputCatalogNavigatorTree($start_with_category_id = null)
 {
     global $application;
     static $level_offset = null;
     $tree = "";
     $categories_list = null;
     if ($start_with_category_id == null) {
         $start_with_category_id = $this->settings['TREE_ROOT'];
         // array of online direct subcategories only
         if ($this->settings['DISPLAY_ROOT'] == 'YES') {
             $categories_list = array(new CCategoryInfo($start_with_category_id));
         }
     }
     // array of online direct subcategories only
     if ($categories_list === null) {
         $categories_list = modApiFunc("Catalog", "getDirectSubcategoriesListFull", $start_with_category_id, true);
     }
     // necessary tests before output
     $start_category_obj = new CCategoryInfo($start_with_category_id);
     if ($categories_list == null || $start_category_obj->getCategoryTagValue('recursivestatus', CATEGORYINFO_NOT_LOCALIZED_DATA) == CATEGORY_STATUS_OFFLINE) {
         return "";
     }
     // prepare plain-list of all parent IDs of the __current__ category
     $parents = modApiFunc('Catalog', 'getCategoryFullPath', $this->cat_id);
     $parent_ids = array();
     foreach ($parents as $catInfo) {
         $parent_ids[] = $catInfo['id'];
     }
     foreach ($categories_list as $categoryInfo) {
         $_selected = in_array($categoryInfo->getCategoryTagValue('id'), $parent_ids);
         $_selected_current = $this->cat_id == $categoryInfo->getCategoryTagValue('id');
         $_without_nested = !$categoryInfo->getCategoryTagValue('hasonlinesubcategories');
         // select template
         if ($_selected && $_without_nested) {
             $template = $_selected_current || $this->settings['SELECTED'] == 'CATEGORY_PATH' ? 'CategoryDefaultSelectedWithoutNested' : 'CategoryDefaultWithoutNested';
         } else {
             if ($_selected && !$_without_nested) {
                 $template = $_selected_current || $this->settings['SELECTED'] == 'CATEGORY_PATH' ? 'CategoryDefaultSelected' : 'CategoryDefault';
             } else {
                 if (!$_selected && $_without_nested) {
                     $template = 'CategoryDefaultWithoutNested';
                 } else {
                     if ($this->settings['EXPAND_TREE_NODES'] == 'ALL') {
                         $template = 'CategoryDefault';
                     } else {
                         $template = 'CategoryDefaultWithoutNested';
                     }
                 }
             }
         }
         //
         //                    $this->_Current_Category,
         //                                              .
         //                                                                            .
         $_prev__this_Current_Category = $this->_Current_Category;
         $this->_Current_Category = $categoryInfo;
         $tree .= $this->mTmplFiller->fill($template);
         $this->_Current_Category = $_prev__this_Current_Category;
     }
     return $tree;
 }
 function displayDefaultCategories()
 {
     $categories = modApiFunc("Catalog", "getSubcategoriesFullListWithParent", 1, false);
     $_Cat_Info = new CCategoryInfo(1);
     // Category Info get for Home Category
     $countOfSubCategory = $_Cat_Info->getCategoryTagValue('subcategoriesnumber') + 1;
     //Count total number of item in the subcategory of Home category
     $slicedcats = array_slice($categories, 0, $countOfSubCategory);
     $count = count($categories);
     $value = "";
     foreach ($slicedcats as $category) {
         if ($category['level'] == 0 || $category['level'] == 1) {
             $catid = $category["id"];
             $catmainlink = getCategoryLink($catid);
             $cathomelink = getPageURL('Categories {1}');
             $value .= "<li>";
             if ($catid == 1) {
                 $value .= "<a href='{$cathomelink}' class='parent'><span>" . $category['name'] . "</span></a>\n\t\t\t\t\t    <div><ul>";
             } else {
                 $value .= "<a href='{$catmainlink}' class='parent'><span>" . $category['name'] . "</span></a>\n\t\t\t\t\t    <div><ul>";
             }
             if (modApiFunc("Catalog", "hasOnlineSubcategories", $category['id']) && $category['level'] > 0) {
                 $value .= $this->defaultsubcatlevel($category['id'], 1);
                 // Looping for subcategories
             }
             $value .= "</ul></div></li>";
         }
     }
     return $value;
 }
 /**
  * Processes tags in the templates for the given view.
  *
  * @return string tag value, if tag has been processed. NULL, otherwise.
  */
 function getTag($tag, $arg_list = array())
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'Local_Columns':
             $value = $this->columns;
             break;
         case 'Local_ProductNumberToDisplay':
             $value = count($this->__product_list_to_display);
             break;
         case 'Local_NextProductIdToDisplay':
             if ($this->__index >= count($this->__product_list_to_display)) {
                 $value = null;
             } else {
                 $value = $this->__product_list_to_display[$this->__index]['product_id'];
                 $this->__index++;
             }
             $this->__current_product_id_to_display = $value;
             break;
         case 'Local_CurrentProductIdToDisplay':
             return $this->__current_product_id_to_display;
             break;
         case 'Local_ProductDetails':
             $pid = $this->getTag('Local_NextProductIdToDisplay');
             if ($pid == null) {
                 $value = '';
             } else {
                 $value = $this->renderProductInfo($pid);
             }
             break;
             # override the PaginatorRows tag behavior
         # override the PaginatorRows tag behavior
         case 'PaginatorLine':
             $value = getPaginatorLine($this->__paginator_name, 'ProductList', $this->__filter_hash);
             //
             break;
             # override the PaginatorRows tag behavior
         # override the PaginatorRows tag behavior
         case 'PaginatorDropdown':
             $value = getPaginatorDropdown($this->__paginator_name, 'ProductList');
             break;
         case 'CategoryName':
             $catobj = new CCategoryInfo($this->__tag_settings->filter->category_id);
             $value = $catobj->getCategoryTagValue('name');
             break;
         case 'ProductOptionsForm':
             $value = getOptionsChoice($this->_Product_Info->getProductTagValue('ID'));
             break;
         case 'RelatedProducts':
             $value = getRelatedProducts($this->_Product_Info->getProductTagValue('ID'));
             break;
         case 'Local_JSfuncProductFormSubmit':
             $value = "<script type=\"text/javascript\">" . "function ProductFormSubmit_" . $this->_Product_Info->getProductTagValue('ID') . "()" . "{" . " document.forms['ProductForm_" . $this->_Product_Info->getProductTagValue('ID') . "'].submit();" . "};" . "</script>";
             break;
         case 'Local_ProductFormStart':
             $value = '<form action="cart.php" name="ProductForm_' . $this->_Product_Info->getProductTagValue('ID') . '" id="ProductForm_' . $this->_Product_Info->getProductTagValue('ID') . '" method="post">
                       <input type="hidden" name="asc_action" value="AddToCart" />
                       <input type="hidden" name="prod_id" value="' . $this->_Product_Info->getProductTagValue('ID') . '" />
                     <script type="text/javascript">
                     function ProductFormSubmit_' . $this->_Product_Info->getProductTagValue('ID') . '()
                     {
                         document.forms[\'ProductForm_' . $this->_Product_Info->getProductTagValue('ID') . '\'].submit();
                     };
                     </script>';
             break;
         case 'Local_ProductFormEnd':
             $value = '</form>';
             break;
         case 'Local_ProductAddToCart':
             $value = 'javascript: ProductFormSubmit_' . $this->_Product_Info->getProductTagValue('ID') . '();';
             break;
         case 'ProductDetailedImages':
             $value = getProductDetailedImages($this->_Product_Info->getProductTagValue('ID'));
             break;
         case 'Local_FormQuantityFieldName':
             $value = 'quantity_in_cart';
             break;
         case 'Local_ProductQuantityOptions':
             $qty_in_cart = modApiFunc("Cart", "getProductQuantity", $this->_Product_Info->getProductTagValue('ID'));
             $value = modApiFunc("Cart", "getProductQuantityOptions", $qty_in_cart, $this->_Product_Info->getProductTagValue('ID'));
             break;
         default:
             list($entity, $tag) = getTagName($tag);
             if ($entity == 'product' && is_object($this->_Product_Info)) {
                 $value = $this->_Product_Info->getProductTagValue($tag);
             }
             break;
     }
     return $value;
 }
 function out_CategoriesList()
 {
     $html_code = '';
     if (!empty($this->affected['cats'])) {
         global $application;
         foreach ($this->affected['cats'] as $cat_id) {
             $obj = new CCategoryInfo($cat_id);
             // CCategoryInfo::isCategoryIdCorrect() does not exist
             if ($obj->_fCategoryIDIsIncorrect !== true) {
                 $tags = array('CategoryID' => $cat_id, 'CategoryName' => $obj->getCategoryTagValue('Name'));
                 $this->_Template_Contents = $tags;
                 $application->registerAttributes($this->_Template_Contents);
                 $this->mTmplFiller =& $application->getInstance('TmplFiller');
                 $html_code .= $this->mTmplFiller->fill("shipping_cost_calculator/edit_fs_rule_area/", "cat_item.tpl.html", array());
             }
         }
     }
     return $html_code;
 }
 /**
  * Returns the Subcategories Listing view.
  *
  * @return string the Subcategories List view.
  */
 function output()
 {
     global $application;
     #define whether to output the view or not
     if ($this->NoView) {
         $application->outputTagErrors(true, "SubcategoryList", "Errors");
         return "";
     } else {
         $application->outputTagErrors(true, "SubcategoryList", "Warnings");
     }
     $this->templateFiller = new TemplateFiller();
     /*
      Check whether the parameter specified by the category id was passed to
      the Subcategories() block. In such case the Subcategories block will
      output specified category info, inpsite of the current category.
     */
     $CatID = @func_get_arg(0);
     $CurrentCatalogCategoryID = null;
     if ($CatID === false) {
         $CatID = modApiFunc('CProductListFilter', 'getCurrentCategoryId');
     } else {
         /*
          The category id was passed to the Subcategories block.
          In order all the Category* tags output values for the specified
          category, but not for the current one, to the template-container,
          override the current category value in the Catalog module.
          Return the current value after outputting the Subcategories block.
         */
         $CurrentCatalogCategoryID = modApiFunc('CProductListFilter', 'getCurrentCategoryId');
         modApiFunc('CProductListFilter', 'disableSynchronization');
         modApiFunc('CProductListFilter', 'changeCurrentCategoryId', $CatID);
     }
     $this->_CatID = $CatID;
     $this->template = $application->getBlockTemplate('Subcategories');
     $this->templateFiller->setTemplate($this->template);
     $this->subcatList = modApiFunc("Catalog", "getDirectSubcategoriesListFull", $this->_CatID, true);
     $cat = new CCategoryInfo($CatID);
     if (NULL == $this->subcatList || $cat->getCategoryTagValue('RecursiveStatus') != CATEGORY_STATUS_ONLINE) {
         $retval = $this->templateFiller->fill("ContainerEmpty");
     } else {
         $retval = $this->templateFiller->fill("Container");
     }
     /*
      Restore the current category value in the Catalog module,
      if it has been overridden by the time of outputting the Subcategories block.
     */
     if ($CurrentCatalogCategoryID !== null) {
         modApiFunc('CProductListFilter', 'changeCurrentCategoryId', $CurrentCatalogCategoryID);
         modApiFunc('CProductListFilter', 'enableSynchronization');
     }
     return $retval;
 }
 /**
  *
  *
  * @return
  */
 function initDBFormData()
 {
     $cid = modApiFunc('Catalog', 'getEditableCategoryID');
     $catInfo = new CCategoryInfo($cid);
     $this->ViewState = array("hasCloseScript" => "false", "SmallImage" => basename($catInfo->getCategoryTagValue('smallimagesrc')), "LargeImage" => basename($catInfo->getCategoryTagValue('largeimagesrc')));
     $this->POST = array("CategoryID" => $cid, "CategoryStatus" => $catInfo->getCategoryTagValue('status'), "ImageDescriptionText" => $catInfo->getCategoryTagValue('imagealttext'), "ParentCategoryID" => modApiFunc('CProductListFilter', 'getCurrentCategoryId'), "PageTitleText" => $catInfo->getCategoryTagValue('pagetitle'), "SubcategoryText" => $catInfo->getCategoryTagValue('name'), "DescriptionText" => $catInfo->getCategoryTagValue('description'), "MetaKeywordsText" => $catInfo->getCategoryTagValue('metakeywords'), "MetaDescriptionText" => $catInfo->getCategoryTagValue('metadescription'), "CategoryShowProductsRecursivelyStatus" => $catInfo->getCategoryTagValue('showproductsrecursivelystatus'), "SEO_URL_prefix" => urldecode($catInfo->getCategoryTagValue('seo_url_prefix')));
     //            $this->ViewState =
     //                array(
     //                    "hasCloseScript"   => "false",
     //                    "SmallImage" => ($catInfo['SmallImageShowThatFileIsNotUploaded'] == '1') ? "" : basename($catInfo['SmallImageSrc']),
     //                    "LargeImage" => ($catInfo['LargeImageShowThatFileIsNotUploaded'] == '1') ? "" : basename($catInfo['LargeImageSrc'])
     //                     );
     //            $this->POST  =
     //                array(
     //                    "CategoryID"            => $cid,
     //                    "CategoryStatus"        => $catInfo['Status'],
     //                    "ImageDescriptionText"  => $catInfo['ImageAltText'],
     //                    "ParentCategoryID"      => modApiFunc("Catalog", "getCurrentCategoryID"),
     //                    "PageTitleText"         => $catInfo['PageTitle'],
     //                    "SubcategoryText"       => $catInfo['Name'],
     //                    "DescriptionText"       => $catInfo['Description'],
     //                    "MetaKeywordsText"      => $catInfo['MetaKeywords'],
     //                    "MetaDescriptionText"   => $catInfo['MetaDescription'],
     //                    "CategoryShowProductsRecursivelyStatus" => $catInfo['ShowProductsRecursivelyStatus'],
     //                    "SEO_URL_prefix"        => $catInfo['SEO_URL_prefix']
     //                );
 }
Esempio n. 14
0
 function _addSEO($m)
 {
     global $application;
     if (strstr($this->_fProcessedURL['query'], '%cSEO%')) {
         $catObj = new CCategoryInfo($m[1]);
         $seo_prefix = $catObj->getCategoryTagValue('seo_url_prefix');
         if (!empty($seo_prefix)) {
             $seo_prefix .= '-';
         } else {
             $this->_fProcessedURL['query'] = preg_replace('/([a-zA-Z0-9_\\-\\%\\+]+)lng[A-Z]{2}-([a-zA-Z0-9_\\-\\%\\+\\.]+)/', '${1}${2}', $this->_fProcessedURL['query']);
         }
         $this->_fProcessedURL['query'] = str_replace('%cSEO%', $seo_prefix, $this->_fProcessedURL['query']);
         return;
     }
     if (strstr($this->_fProcessedURL['query'], '%pSEO%')) {
         $catObj = new CProductInfo($m[1]);
         $seo_prefix = $catObj->getProductTagValue('SEOPrefix');
         if (!empty($seo_prefix)) {
             $seo_prefix .= '-';
         } else {
             $this->_fProcessedURL['query'] = preg_replace('/([a-zA-Z0-9_\\-\\%\\+]+)lng[A-Z]{2}-([a-zA-Z0-9_\\-\\%\\+\\.]+)/', '${1}${2}', $this->_fProcessedURL['query']);
         }
         $this->_fProcessedURL['query'] = str_replace('%pSEO%', $seo_prefix, $this->_fProcessedURL['query']);
         return;
     }
 }
 /**
  * @ describe the function ProductList->getTag.
  */
 function getTag($tag)
 {
     global $application;
     $value = null;
     $CatID = modApiFunc('CProductListFilter', 'getCurrentCategoryId');
     loadClass('CCategoryInfo');
     $currCategoryObj = new CCategoryInfo($CatID);
     $OptionsListHiddenArray = array();
     loadCoreFile('html_form.php');
     $HtmlForm = new HtmlForm();
     switch ($tag) {
         case 'HiddenArrayViewState':
             $value = $this->outputViewState();
             break;
         case 'HiddenFieldAction':
             $value = $this->getHiddenFiled();
             break;
         case 'OptionsList':
             $value = $this->outputOptionsList($CatID, $OptionsListHiddenArray);
             break;
         case 'CategoryName':
             $value = $currCategoryObj->getCategoryTagValue('name');
             break;
         case 'OptionsListHidden':
             $OptionsListHiddenArray = $this->getOptionsListHiddenArray($CatID);
             $value = implode('|', $OptionsListHiddenArray);
             break;
         case 'SaveCatHref':
             $value = $this->outputSaveSortHref();
             break;
         case 'Sort_Object_CP':
             $value = $this->outputSortObject('CP');
             break;
         case 'Sort_Object_CS':
             $value = $this->outputSortObject('CS');
             break;
         case 'Sort_Object_P':
             $value = $this->outputSortObject('P');
             break;
         case 'Sort_Object_S':
             $value = $this->outputSortObject('S');
             break;
         case 'Sort_Subject':
             $value = $this->outputSortSubject();
             break;
         case 'Breadcrumb':
             $obj =& $application->getInstance('Breadcrumb');
             $value = $obj->output(false);
             break;
     }
     return $value;
 }
Esempio n. 16
0
 /**
  * Moves the category.
  *
  * @author Alexander Girin
  * @param integer $newParentCatId the new category id,
  *        to which the category is moved
  * @param integer $cid the moved category id
  * @return
  */
 function moveCategory($newParentCatId, $cid)
 {
     global $application;
     $NewParentCatInfo = $this->fetchCategoryInfo($newParentCatId);
     $CatInfo = $this->fetchCategoryInfo($cid);
     $catobj = new CCategoryInfo($cid);
     $CurrentParentCatInfo = $catobj->getCategoryTagValue('parentid');
     if ($NewParentCatInfo == FALSE || $CatInfo == FALSE) {
         return;
     }
     $tables = $this->getTables();
     $c = $tables['categories']['columns'];
     # categories is a database table
     $deltaLevel = -($CatInfo['level'] - 1) + $NewParentCatInfo['level'];
     if ($NewParentCatInfo['left'] < $CatInfo['left'] && $NewParentCatInfo['right'] > $CatInfo['right'] && $NewParentCatInfo['level'] < $CatInfo['level'] - 1) {
         $query = new DB_Update('categories');
         $query->addUpdateExpression($c['level'], $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['level'] . sprintf('%+d', $deltaLevel), $c['level']));
         $query->addUpdateExpression($c['right'], $query->fIf($c['right'] . ' ' . DB_BETWEEN . ' ' . ($CatInfo['right'] + 1) . ' ' . DB_AND . ' ' . ($NewParentCatInfo['right'] - 1), $c['right'] . '-' . ($CatInfo['right'] - $CatInfo['left'] + 1), $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['right'] . '+' . (($NewParentCatInfo['right'] - $CatInfo['right'] - $CatInfo['level'] + $NewParentCatInfo['level']) / 2 * 2 + $CatInfo['level'] - $NewParentCatInfo['level'] - 1), $c['right'])));
         $query->addUpdateExpression($c['left'], $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . ($CatInfo['right'] + 1) . ' ' . DB_AND . ' ' . ($NewParentCatInfo['right'] - 1), $c['left'] . '-' . ($CatInfo['right'] - $CatInfo['left'] + 1), $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['left'] . '+' . (($NewParentCatInfo['right'] - $CatInfo['right'] - $CatInfo['level'] + $NewParentCatInfo['level']) / 2 * 2 + $CatInfo['level'] - $NewParentCatInfo['level'] - 1), $c['left'])));
         $query->WhereField($c['left'], DB_BETWEEN, "'" . ($NewParentCatInfo['left'] + 1) . "'" . ' ' . DB_AND . " '" . ($NewParentCatInfo['right'] - 1) . "'");
         $application->db->getDB_Result($query);
     } elseif ($NewParentCatInfo['left'] < $CatInfo['left']) {
         $query = new DB_Update('categories');
         $query->addUpdateExpression($c['level'], $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['level'] . sprintf('%+d', $deltaLevel), $c['level']));
         $query->addUpdateExpression($c['left'], $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $NewParentCatInfo['right'] . ' ' . DB_AND . ' ' . ($CatInfo['left'] - 1), $c['left'] . '+' . ($CatInfo['right'] - $CatInfo['left'] + 1), $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['left'] . '-' . ($CatInfo['left'] - $NewParentCatInfo['right']), $c['left'])));
         $query->addUpdateExpression($c['right'], $query->fIf($c['right'] . ' ' . DB_BETWEEN . ' ' . $NewParentCatInfo['right'] . ' ' . DB_AND . ' ' . $CatInfo['left'], $c['right'] . '+' . ($CatInfo['right'] - $CatInfo['left'] + 1), $query->fIf($c['right'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['right'] . '-' . ($CatInfo['left'] - $NewParentCatInfo['right']), $c['right'])));
         $query->WhereField($c['left'], DB_BETWEEN, "'" . $NewParentCatInfo['left'] . "'" . ' ' . DB_AND . " '" . $CatInfo['right'] . "'");
         $query->WhereOR();
         $query->WhereField($c['right'], DB_BETWEEN, "'" . $NewParentCatInfo['left'] . "'" . ' ' . DB_AND . " '" . $CatInfo['right'] . "'");
         $application->db->getDB_Result($query);
     } else {
         $query = new DB_Update('categories');
         $query->addUpdateExpression($c['level'], $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['level'] . sprintf('%+d', $deltaLevel), $c['level']));
         $query->addUpdateExpression($c['left'], $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['right'] . ' ' . DB_AND . ' ' . $NewParentCatInfo['right'], $c['left'] . '-' . ($CatInfo['right'] - $CatInfo['left'] + 1), $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['left'] . '+' . ($NewParentCatInfo['right'] - $CatInfo['right'] - 1), $c['left'])));
         $query->addUpdateExpression($c['right'], $query->fIf($c['right'] . ' ' . DB_BETWEEN . ' ' . ($CatInfo['right'] + 1) . ' ' . DB_AND . ' ' . ($NewParentCatInfo['right'] - 1), $c['right'] . '-' . ($CatInfo['right'] - $CatInfo['left'] + 1), $query->fIf($c['right'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['right'] . '+' . ($NewParentCatInfo['right'] - $CatInfo['right'] - 1), $c['right'])));
         $query->WhereField($c['left'], DB_BETWEEN, "'" . $CatInfo['left'] . "'" . ' ' . DB_AND . " '" . $NewParentCatInfo['right'] . "'");
         $query->WhereOR();
         $query->WhereField($c['right'], DB_BETWEEN, "'" . $CatInfo['left'] . "'" . ' ' . DB_AND . " '" . $NewParentCatInfo['right'] . "'");
         $application->db->getDB_Result($query);
     }
     modApiFunc('EventsManager', 'throwEvent', 'CategoryMoved', array('OLD_PARENT_CATEGORY_ID' => $CurrentParentCatInfo, 'NEW_PARENT_CATEGORY_ID' => $newParentCatId, 'CATEGORY_ID_LIST' => $cid));
 }
 function outputMoveObject()
 {
     global $application;
     $obj =& $application->getInstance('MessageResources');
     $cat = new CCategoryInfo(modApiFunc('Catalog', 'getEditableCategoryID'));
     return $obj->getMessage(new ActionMessage('MOVE_CTGR_HEADER')) . ' ' . $cat->getCategoryTagValue('Name');
 }
 /**
  * Returns the HTML code of the deleted object list.
  *
  * @return HTML code
  */
 function outputListItems($CatID)
 {
     global $application;
     $catitems = '';
     /*
      Get a list of all subcategories without paginator.
     */
     $SubcategoriesFullList = modApiFunc('Catalog', 'getSubcategoriesFullListWithParent', $CatID);
     /*
      Look through the list of categories and:
      - save each of them in the array of the $this->CatsId ID category,
      - get a product list in each category, without paginator, i.e. the whole list
      - save each of them in the array of the $this->ProdsId ID of each product
      - generate HTML to output one category
     */
     $i = 0;
     foreach ($SubcategoriesFullList as $catInfo) {
         /*
          This array of the categories ID will be outputted in the form of
          the hidden field.
          These very categories will be deleted from the catalog.
         */
         array_push($this->CatsId, $catInfo['id']);
         /*
          Execute a query for optimization.
         */
         $result = modApiFunc('Catalog', 'selectCatgoryProducts', $catInfo['id']);
         foreach ($result as $productid) {
             /*
              This array of the products ID will be outputted in the form of
              the hidden field.
              These very products will be deleted from the catalog.
             */
             array_push($this->ProdsId, $productid['id']);
         }
         /*
                                               HTML
         */
         $categoryInfo = new CCategoryInfo($catInfo['id']);
         $ProductsCountTotal = $categoryInfo->getCategoryTagValue("productsnumberrecursively");
         $ProductsCountInCat = $categoryInfo->getCategoryTagValue("productsnumber");
         $full_subcat_path_arr = modApiFunc('Catalog', 'getCategoryFullPath', $catInfo['id']);
         $categoryInfo->setAdditionalCategoryTag('N', $i + 1);
         $categoryInfo->setAdditionalCategoryTag('Category_Full_Name', $this->outputLocationBreadcrumb($full_subcat_path_arr, false));
         $categoryInfo->setAdditionalCategoryTag('Products_Count_In_Cat', $ProductsCountInCat);
         $categoryInfo->setAdditionalCategoryTag('Products_Count_Total', $ProductsCountTotal);
         $this->_Current_Category = $categoryInfo;
         $application->registerAttributes($this->_Current_Category->getAdditionalCategoryTagList());
         $catitems .= modApiFunc('TmplFiller', 'fill', "catalog/del_cat/", "list_item.tpl.html", array());
         $i++;
     }
     return $catitems;
 }
 function outputFsRuleEffectiveAreaDetails($affected, $cat_num, $prod_num)
 {
     global $application;
     if ($cat_num == 0 && $prod_num == 0) {
         return '';
     }
     $cat_list = array();
     $cat_str = '';
     if ($cat_num != 0) {
         loadClass("CCategoryInfo");
         foreach ($affected['cats'] as $cat) {
             $obj = new CCategoryInfo($cat);
             // CCategoryInfo::isCategoryIdCorrect() does not exist
             if ($obj->_fCategoryIDIsIncorrect !== true) {
                 $cat_list[] = $obj->getCategoryTagValue('Name');
             }
         }
         $cat_str = implode('<br />', $cat_list);
     }
     $prod_list = array();
     $prod_str = '';
     if ($prod_num != 0) {
         loadClass("CProductInfo");
         foreach ($affected['prods'] as $prod) {
             $obj = new CProductInfo($prod);
             if ($obj->isProductIdCorrect()) {
                 $prod_list[] = $obj->getProductTagValue('Name');
             }
         }
         $prod_str = implode('<br />', $prod_list);
     }
     $this->_Template_Contents = array("CategoriesAffectedList" => $cat_str, "ProductsAffectedList" => $prod_str);
     $application->registerAttributes($this->_Template_Contents);
     return $this->mTmplFiller->fill("shipping_cost_calculator/edit_fs_rule/", "fs_rule_effective_area_details.tpl.html", array());
 }
Esempio n. 20
0
 /**
  * Returns the Product Listing view.
  *
  * @return string the Products List view.
  */
 function output()
 {
     global $application;
     #define whether to output the view or not
     if ($this->NoView) {
         $application->outputTagErrors(true, __CLASS__, "Errors");
         return "";
     } else {
         $application->outputTagErrors(true, __CLASS__, "Warnings");
     }
     //                                           .
     $in_param = @func_get_arg(0);
     //                        -                        CProductListTagSettings,
     if (_is_a($in_param, 'CProductListTagSettings')) {
         $this->pl_tag_settings = $in_param;
     } else {
         //                            CProductListTagSettings
         $this->pl_tag_settings = new CProductListTagSettings();
         //                                       ,
         if ($in_param === false || $in_param === null) {
             $this->pl_tag_settings->filter = modApiFunc('CProductListFilter', 'getProductListParamsObject');
             //                                 (default                                       )
             //                                                   -
             $this->pl_tag_settings->filter->use_paginator = true;
         } else {
             //                        ,                  CProductListTagSettings,
             //                 Category Id,
             $category_id_to_read_from = $in_param;
             if (modApiFunc('Catalog', 'isCorrectCategoryId', $category_id_to_read_from)) {
                 //                         ,                                         Show products from all subcategories
                 $this->pl_tag_settings->product_list_filter_object->disableSynchronization();
                 $this->pl_tag_settings->product_list_filter_object->changeCurrentCategoryId($category_id_to_read_from);
                 $this->pl_tag_settings->updateFilterParams();
             }
         }
     }
     //
     $this->pagParam = $this->pl_tag_settings->filter->category_id;
     $category = new CCategoryInfo($this->pagParam);
     $category_status = $category->getCategoryTagValue('status');
     if ($category_status == CATEGORY_STATUS_OFFLINE) {
         $request = new Request();
         $request->setView('Index');
         $application->redirect($request);
         return;
     }
     $this->pagName = modApiFunc('CProductListFilter', 'getMnfPaginatorName');
     if (!$this->pagName) {
         $this->pagName = "Catalog_ProdsList_" . $this->pl_tag_settings->filter->category_id;
     }
     modAPIFunc('paginator', 'setCurrentPaginatorName', $this->getPagName());
     //
     $this->registerAttributes();
     $this->templateFiller = new TemplateFiller();
     $this->templateFiller->setTemplate($this->pl_tag_settings->getTemplate());
     $this->_product_form_action = getpageurl('CartContent');
     $cols = @func_get_arg(1);
     if ($cols !== false && is_numeric($cols)) {
         $this->columns = $cols;
     } else {
         $this->columns = intval($application->getBlockOption($this->pl_tag_settings->getTemplate(), "Columns"));
     }
     //
     $this->pl = $this->getPL();
     if (NULL == $this->pl) {
         $retval = $this->templateFiller->fill("ContainerEmpty");
     } else {
         $retval = $this->templateFiller->fill("Container");
     }
     return $retval;
 }