Ejemplo n.º 1
0
 /**
  * Set up the shop page with products and discounts
  *
  * @param   array       $product_ids    The optional array of Product IDs.
  *                                      Overrides any URL parameters if set
  * @return  boolean                     True on success, false otherwise
  * @global  ADONewConnection  $objDatabase    Database connection object
  * @global  array       $_ARRAYLANG     Language array
  * @global  array       $_CONFIG        Core configuration array, see {@link /config/settings.php}
  * @global  string(?)   $themesPages    Themes pages(?)
  */
 static function view_product_overview($product_ids = null)
 {
     global $_ARRAYLANG;
     // activate javascript shadowbox
     \JS::activate('shadowbox');
     $flagSpecialoffer = intval(\Cx\Core\Setting\Controller\Setting::getValue('show_products_default', 'Shop'));
     if (isset($_REQUEST['cmd']) && $_REQUEST['cmd'] == 'discounts') {
         $flagSpecialoffer = Products::DEFAULT_VIEW_DISCOUNTS;
     }
     $flagLastFive = isset($_REQUEST['lastFive']);
     $product_id = isset($_REQUEST['productId']) ? intval($_REQUEST['productId']) : null;
     $cart_id = null;
     if (isset($_REQUEST['referer']) && $_REQUEST['referer'] == 'cart') {
         $cart_id = $product_id;
         $product_id = Cart::get_product_id($cart_id);
     }
     $manufacturer_id = isset($_REQUEST['manufacturerId']) ? intval($_REQUEST['manufacturerId']) : null;
     $term = isset($_REQUEST['term']) ? trim(contrexx_input2raw($_REQUEST['term'])) : null;
     $category_id = isset($_REQUEST['catId']) ? intval($_REQUEST['catId']) : null;
     if (!($product_id || $category_id || $manufacturer_id || $term || $cart_id)) {
         // NOTE: This is different from NULL
         // in that it enables listing the subcategories
         $category_id = 0;
     }
     // Validate parameters
     if ($product_id && empty($category_id)) {
         $objProduct = Product::getById($product_id);
         if ($objProduct) {
             $category_id = $objProduct->category_id();
         }
         if (isset($_SESSION['shop']['previous_category_id'])) {
             $category_id_previous = $_SESSION['shop']['previous_category_id'];
             foreach (preg_split('/\\s*,\\s*/', $category_id) as $id) {
                 if ($category_id_previous == intval($id)) {
                     $category_id = $category_id_previous;
                 }
             }
         }
     }
     // Remember visited Products
     if ($product_id) {
         self::rememberVisitedProducts($product_id);
     }
     $objCategory = null;
     if ($category_id && empty($product_id)) {
         $objCategory = ShopCategory::getById($category_id);
         if (!$objCategory) {
             $category_id = null;
         }
     }
     $shopMenu = '<form method="post" action="' . \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', '') . '">' . '<input type="text" name="term" value="' . htmlentities($term, ENT_QUOTES, CONTREXX_CHARSET) . '" style="width:150px;" />&nbsp;' . '<select name="catId" style="width:150px;">' . '<option value="0">' . $_ARRAYLANG['TXT_ALL_PRODUCT_GROUPS'] . '</option>' . ShopCategories::getMenuoptions($category_id) . '</select>&nbsp;' . Manufacturer::getMenu('manufacturerId', $manufacturer_id, true) . '<input type="submit" name="bsubmit" value="' . $_ARRAYLANG['TXT_SEARCH'] . '" style="width:66px;" />' . '</form>';
     self::$objTemplate->setGlobalVariable($_ARRAYLANG + array('SHOP_MENU' => $shopMenu, 'SHOP_SEARCH_TERM' => htmlentities($term, ENT_QUOTES, CONTREXX_CHARSET), 'SHOP_CATEGORIES_MENUOPTIONS' => ShopCategories::getMenuoptions($category_id, true, 0, true), 'SHOP_MANUFACTURER_MENUOPTIONS' => Manufacturer::getMenuoptions($manufacturer_id, true)));
     // Only show the cart info when the JS cart is not active!
     global $_CONFIGURATION;
     if (empty($_CONFIGURATION['custom']['shopJsCart'])) {
         self::$objTemplate->setVariable(array('SHOP_CART_INFO' => self::cart_info()));
     }
     // Exclude Category list from search results
     if ($term == '') {
         self::showCategories($category_id);
     }
     if (self::$objTemplate->blockExists('shopNextCategoryLink')) {
         $nextCat = ShopCategory::getNextShopCategoryId($category_id);
         $objCategory = ShopCategory::getById($nextCat);
         if ($objCategory) {
             self::$objTemplate->setVariable(array('SHOP_NEXT_CATEGORY_ID' => $nextCat, 'SHOP_NEXT_CATEGORY_TITLE' => str_replace('"', '&quot;', $objCategory->name())));
         }
     }
     $pagingCmd = !empty($_REQUEST['cmd']) ? '&amp;cmd=' . contrexx_input2raw($_REQUEST['cmd']) : '';
     $pagingCatId = '';
     $pagingManId = '';
     $pagingTerm = '';
     // TODO: This probably breaks paging in search results!
     // Should only reset the flag conditionally, but add the URL parameters in
     // any case, methinks!
     if ($category_id > 0 && $term == '') {
         $flagSpecialoffer = false;
         $pagingCatId = "&amp;catId={$category_id}";
     }
     if ($manufacturer_id > 0) {
         $flagSpecialoffer = false;
         $pagingManId = "&amp;manufacturer_id={$manufacturer_id}";
     }
     if ($term != '') {
         $flagSpecialoffer = false;
         $pagingTerm = '&amp;term=' . htmlentities($term, ENT_QUOTES, CONTREXX_CHARSET);
     }
     // The Product count is passed by reference and set to the total
     // number of records, though only as many as specified by the core
     // paging limit are returned in the array.
     $limit = \Cx\Core\Setting\Controller\Setting::getValue('numof_products_per_page_frontend', 'Shop');
     //\DBG::activate(DBG_ERROR_FIREPHP);
     // Use Sorting class for the Product order
     $uri = \Html::getRelativeUri_entities();
     $arrOrder = array('product.ord' => $_ARRAYLANG['TXT_SHOP_ORDER_PRODUCT_ORD'], 'name' => $_ARRAYLANG['TXT_SHOP_ORDER_PRODUCT_TITLE'], 'code' => $_ARRAYLANG['TXT_SHOP_ORDER_PRODUCT_CODE'], 'price' => $_ARRAYLANG['TXT_SHOP_ORDER_PRODUCT_PRICE'], 'id' => $_ARRAYLANG['TXT_SHOP_ORDER_PRODUCT_DATE'], 'bestseller' => $_ARRAYLANG['TXT_SHOP_ORDER_PRODUCT_BESTSELLER']);
     $defaultOrder = \Sorting::getFieldindex(Products::$arrProductOrder[\Cx\Core\Setting\Controller\Setting::getValue('product_sorting', 'Shop')]);
     $objSorting = new \Sorting($uri, $arrOrder, true, 'shop_order_products', $defaultOrder);
     //\DBG::log("Sorting headers: ".var_export($objSorting->getHeaderArray(), true));
     $count = $limit;
     $arrProduct = array();
     if ($product_ids) {
         $arrProduct = self::getValidProducts($product_ids);
         $product_id = null;
         // Suppress meta title from single Product
     } elseif ($product_id) {
         $arrProduct = self::getValidProducts(array($product_id));
     } else {
         $arrProduct = Products::getByShopParams($count, \Paging::getPosition(), $product_id, $category_id, $manufacturer_id, $term, $flagSpecialoffer, $flagLastFive, $objSorting->getOrder(), self::$objCustomer && self::$objCustomer->is_reseller());
     }
     // Only show sorting when there's enough to be sorted
     if ($count > 1) {
         $objSorting->parseHeaders(self::$objTemplate, 'shop_product_order');
     }
     if ($count == 0 && !ShopCategories::getChildCategoryIdArray($category_id)) {
         //if ($term != '' || $manufacturer_id != 0 || $flagSpecialoffer) {
         if (self::$objTemplate->blockExists('no_product')) {
             self::$objTemplate->touchBlock('no_product');
         }
         return true;
     }
     if ($objCategory) {
         // Only indicate the category name when there are products
         if ($count) {
             self::$objTemplate->setVariable(array('SHOP_CATEGORY_CURRENT_NAME' => contrexx_raw2xhtml($objCategory->name()), 'SHOP_PRODUCTS_IN_CATEGORY' => sprintf($_ARRAYLANG['TXT_SHOP_PRODUCTS_IN_CATEGORY'], contrexx_raw2xhtml($objCategory->name()))));
         }
     } else {
         // TODO: There are other cases of flag combinations that are not indivuidually
         // handled here yet.
         if ($term == '') {
             if ($flagSpecialoffer == Products::DEFAULT_VIEW_DISCOUNTS) {
                 self::$objTemplate->setVariable('SHOP_PRODUCTS_IN_CATEGORY', $_ARRAYLANG['TXT_SHOP_PRODUCTS_SPECIAL_OFFER']);
             } else {
                 if (self::$objTemplate->blockExists('products_in_category')) {
                     self::$objTemplate->hideBlock('products_in_category');
                 }
             }
         } else {
             self::$objTemplate->setVariable('SHOP_PRODUCTS_IN_CATEGORY', sprintf($_ARRAYLANG['TXT_SHOP_PRODUCTS_SEARCH_RESULTS'], contrexx_raw2xhtml($term)));
         }
     }
     $uri = '&amp;section=Shop' . MODULE_INDEX . $pagingCmd . $pagingCatId . $pagingManId . $pagingTerm;
     self::$objTemplate->setVariable(array('SHOP_PRODUCT_PAGING' => \Paging::get($uri, '', $count, $limit, $count > 0), 'SHOP_PRODUCT_TOTAL' => $count));
     // Global microdata: Seller information
     $seller_url = \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', '')->toString();
     $seller_name = \Cx\Core\Setting\Controller\Setting::getValue('company', 'Shop');
     if (empty($seller_name)) {
         $seller_name = $seller_url;
     }
     self::$objTemplate->setVariable(array('SHOP_SELLER_NAME' => $seller_name, 'SHOP_SELLER_URL' => $seller_url));
     $formId = 0;
     $arrDefaultImageSize = $arrSize = null;
     foreach ($arrProduct as $objProduct) {
         if (!empty($product_id)) {
             self::$pageTitle = $objProduct->name();
         }
         $id = $objProduct->id();
         $productSubmitFunction = '';
         $arrPictures = Products::get_image_array_from_base64($objProduct->pictures());
         $havePicture = false;
         $arrProductImages = array();
         foreach ($arrPictures as $index => $image) {
             $thumbnailPath = $pictureLink = '';
             if (empty($image['img']) || $image['img'] == ShopLibrary::noPictureName) {
                 // We have at least one picture on display already.
                 // No need to show "no picture" three times!
                 if ($havePicture) {
                     continue;
                 }
                 $thumbnailPath = self::$defaultImage;
                 $pictureLink = '#';
                 //"javascript:alert('".$_ARRAYLANG['TXT_NO_PICTURE_AVAILABLE']."');";
                 if (empty($arrDefaultImageSize)) {
                     $arrDefaultImageSize = getimagesize(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsitePath() . self::$defaultImage);
                     self::scaleImageSizeToThumbnail($arrDefaultImageSize);
                 }
                 $arrSize = $arrDefaultImageSize;
             } else {
                 $thumbnailPath = \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteImagesShopWebPath() . '/' . \ImageManager::getThumbnailFilename($image['img']);
                 if ($image['width'] && $image['height']) {
                     $pictureLink = contrexx_raw2encodedUrl(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteImagesShopWebPath() . '/' . $image['img']) . '" rel="shadowbox[' . ($formId + 1) . ']';
                     // Thumbnail display size
                     $arrSize = array($image['width'], $image['height']);
                 } else {
                     $pictureLink = '#';
                     if (!file_exists(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsitePath() . $thumbnailPath)) {
                         continue;
                     }
                     $arrSize = getimagesize(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsitePath() . $thumbnailPath);
                 }
                 self::scaleImageSizeToThumbnail($arrSize);
                 // Use the first available picture in microdata, if any
                 if (!$havePicture) {
                     $picture_url = \Cx\Core\Routing\Url::fromCapturedRequest(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteImagesShopWebPath() . '/' . $image['img'], \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteOffsetPath(), array());
                     self::$objTemplate->setVariable('SHOP_PRODUCT_IMAGE', $picture_url->toString());
                     //\DBG::log("Set image to ".$picture_url->toString());
                 }
             }
             $arrProductImages[] = array('THUMBNAIL' => contrexx_raw2encodedUrl($thumbnailPath), 'THUMBNAIL_SIZE' => $arrSize[3], 'THUMBNAIL_LINK' => $pictureLink, 'POPUP_LINK' => $pictureLink, 'POPUP_LINK_NAME' => $_ARRAYLANG['TXT_SHOP_IMAGE'] . ' ' . $index);
             $havePicture = true;
         }
         $i = 1;
         foreach ($arrProductImages as $arrProductImage) {
             // TODO: Instead of several numbered image blocks, use a single one repeatedly
             self::$objTemplate->setVariable(array('SHOP_PRODUCT_THUMBNAIL_' . $i => $arrProductImage['THUMBNAIL'], 'SHOP_PRODUCT_THUMBNAIL_SIZE_' . $i => $arrProductImage['THUMBNAIL_SIZE']));
             if (!empty($arrProductImage['THUMBNAIL_LINK'])) {
                 self::$objTemplate->setVariable(array('SHOP_PRODUCT_THUMBNAIL_LINK_' . $i => $arrProductImage['THUMBNAIL_LINK'], 'TXT_SEE_LARGE_PICTURE' => $_ARRAYLANG['TXT_SEE_LARGE_PICTURE']));
             } else {
                 self::$objTemplate->setVariable('TXT_SEE_LARGE_PICTURE', contrexx_raw2xhtml($objProduct->name()));
             }
             if ($arrProductImage['POPUP_LINK']) {
                 self::$objTemplate->setVariable('SHOP_PRODUCT_POPUP_LINK_' . $i, $arrProductImage['POPUP_LINK']);
             }
             self::$objTemplate->setVariable('SHOP_PRODUCT_POPUP_LINK_NAME_' . $i, $arrProductImage['POPUP_LINK_NAME']);
             ++$i;
         }
         $stock = $objProduct->stock_visible() ? $_ARRAYLANG['TXT_STOCK'] . ': ' . intval($objProduct->stock()) : '';
         $price = $objProduct->get_custom_price(self::$objCustomer, 0, 1, true);
         // If there is a discountprice and it's enabled
         $discountPrice = '';
         if ($objProduct->discountprice() > 0 && $objProduct->discount_active()) {
             $price = '<s>' . $price . '</s>';
             $discountPrice = $objProduct->get_custom_price(self::$objCustomer, 0, 1, false);
         }
         $groupCountId = $objProduct->group_id();
         $groupArticleId = $objProduct->article_id();
         $groupCustomerId = 0;
         if (self::$objCustomer) {
             $groupCustomerId = self::$objCustomer->group_id();
         }
         self::showDiscountInfo($groupCustomerId, $groupArticleId, $groupCountId, 1);
         /* OLD
                     $price = Currency::getCurrencyPrice(
                         $objProduct->getCustomerPrice(self::$objCustomer)
                     );
                     $discountPrice = '';
                     $discount_active = $objProduct->discount_active();
                     if ($discount_active) {
                         $discountPrice = $objProduct->discountprice();
                         if ($discountPrice > 0) {
                             $price = "<s>$price</s>";
                             $discountPrice =
                                 Currency::getCurrencyPrice($discountPrice);
                         }
                     }
         */
         $short = $objProduct->short();
         $longDescription = $objProduct->long();
         $detailLink = null;
         // Detaillink is required for microdata (even when longdesc
         // is empty)
         $detail_url = \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'details', FRONTEND_LANG_ID, array('productId' => $objProduct->id()))->toString();
         self::$objTemplate->setVariable('SHOP_PRODUCT_DETAIL_URL', $detail_url);
         if (!$product_id && !empty($longDescription)) {
             $detailLink = '<a href="' . $detail_url . '"' . ' title="' . $_ARRAYLANG['TXT_MORE_INFORMATIONS'] . '">' . $_ARRAYLANG['TXT_MORE_INFORMATIONS'] . '</a>';
             self::$objTemplate->setVariable('SHOP_PRODUCT_DETAILLINK', $detailLink);
         }
         // Check Product flags.
         // Only the meter flag is currently implemented and in use.
         $flagMeter = $objProduct->testFlag('__METER__');
         // Submit button name and function.
         // Calling productOptions() also sets the $flagMultipart variable
         // to the appropriate encoding type for the form if
         // any upload fields are in use.
         $flagMultipart = false;
         $productSubmitName = $productSubmitFunction = '';
         if (isset($_GET['cmd']) && $_GET['cmd'] == 'details' && isset($_GET['referer']) && $_GET['referer'] == 'cart') {
             $productSubmitName = "updateProduct[{$cart_id}]";
             $productSubmitFunction = self::productOptions($id, $formId, $cart_id, $flagMultipart);
         } else {
             $productSubmitName = 'addProduct';
             $productSubmitFunction = self::productOptions($id, $formId, $cart_id, $flagMultipart);
         }
         $shopProductFormName = "shopProductForm{$formId}";
         $row = $formId % 2 + 1;
         self::$objTemplate->setVariable(array('SHOP_ROWCLASS' => 'row' . $row, 'SHOP_PRODUCT_ID' => $objProduct->id(), 'SHOP_PRODUCT_TITLE' => contrexx_raw2xhtml($objProduct->name()), 'SHOP_PRODUCT_DESCRIPTION' => $short, 'SHOP_PRODUCT_DETAILDESCRIPTION' => $longDescription ? $longDescription : $short, 'SHOP_PRODUCT_FORM_NAME' => $shopProductFormName, 'SHOP_PRODUCT_SUBMIT_NAME' => $productSubmitName, 'SHOP_PRODUCT_SUBMIT_FUNCTION' => $productSubmitFunction, 'SHOP_FORM_ENCTYPE' => $flagMultipart ? ' enctype="multipart/form-data"' : '', 'TXT_SHOP_PRODUCT_COUNT' => $flagMeter ? $_ARRAYLANG['TXT_SHOP_PRODUCT_METER'] : $_ARRAYLANG['TXT_SHOP_PRODUCT_COUNT'], 'SHOP_CURRENCY_CODE' => Currency::getActiveCurrencyCode()));
         if ($objProduct->code()) {
             self::$objTemplate->setVariable('SHOP_PRODUCT_CUSTOM_ID', htmlentities($objProduct->code(), ENT_QUOTES, CONTREXX_CHARSET));
         }
         $manufacturer_name = $manufacturer_url = $manufacturer_link = '';
         $manufacturer_id = $objProduct->manufacturer_id();
         if ($manufacturer_id) {
             $manufacturer_name = Manufacturer::getNameById($manufacturer_id, FRONTEND_LANG_ID);
             $manufacturer_url = Manufacturer::getUrlById($manufacturer_id, FRONTEND_LANG_ID);
         }
         if (!empty($manufacturer_url) || !empty($manufacturer_name)) {
             if (empty($manufacturer_name)) {
                 $manufacturer_name = $manufacturer_url;
             }
             if (!empty($manufacturer_url)) {
                 $manufacturer_link = '<a href="' . $manufacturer_url . '">' . $manufacturer_name . '</a>';
             }
             // TODO: Test results for any combination of name and url
             self::$objTemplate->setVariable(array('SHOP_MANUFACTURER_NAME' => $manufacturer_name, 'SHOP_MANUFACTURER_URL' => $manufacturer_url, 'SHOP_MANUFACTURER_LINK' => $manufacturer_link, 'TXT_SHOP_MANUFACTURER_LINK' => $_ARRAYLANG['TXT_SHOP_MANUFACTURER_LINK']));
         }
         // This is the old Product field for the Manufacturer URI.
         // This is now extended by the Manufacturer table and should thus
         // get a new purpose.  As it is product specific, it could be
         // renamed and reused as a link to individual Products!
         $externalLink = $objProduct->uri();
         if (!empty($externalLink)) {
             self::$objTemplate->setVariable(array('SHOP_EXTERNAL_LINK' => '<a href="' . $externalLink . '" title="' . $_ARRAYLANG['TXT_SHOP_EXTERNAL_LINK'] . '" target="_blank">' . $_ARRAYLANG['TXT_SHOP_EXTERNAL_LINK'] . '</a>'));
         }
         if ($price) {
             self::$objTemplate->setGlobalVariable(array('SHOP_PRODUCT_PRICE' => $price, 'SHOP_PRODUCT_PRICE_UNIT' => Currency::getActiveCurrencySymbol()));
         }
         // Only show the discount price if it's actually in use,
         // avoid an "empty <font> tag" HTML warning
         if ($discountPrice) {
             self::$objTemplate->setGlobalVariable(array('SHOP_PRODUCT_DISCOUNTPRICE' => $discountPrice, 'SHOP_PRODUCT_DISCOUNTPRICE_UNIT' => Currency::getActiveCurrencySymbol()));
             if (self::$objTemplate->blockExists('price_discount')) {
                 self::$objTemplate->touchBlock('price_discount');
             }
         } else {
             if (self::$objTemplate->blockExists('price')) {
                 self::$objTemplate->touchBlock('price');
             }
         }
         // Special outlet ShopCategory with discounts varying daily.
         // This should be implemented in a more generic way, in the
         // Discount class maybe.
         if ($objProduct->is_outlet()) {
             self::$objTemplate->setVariable(array('TXT_SHOP_DISCOUNT_TODAY' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_TODAY'], 'SHOP_DISCOUNT_TODAY' => $objProduct->getOutletDiscountRate() . '%', 'TXT_SHOP_PRICE_TODAY' => $_ARRAYLANG['TXT_SHOP_PRICE_TODAY'], 'SHOP_PRICE_TODAY' => Currency::getCurrencyPrice($objProduct->getDiscountedPrice()), 'SHOP_PRICE_TODAY_UNIT' => Currency::getActiveCurrencySymbol()));
         }
         if ($objProduct->stock_visible()) {
             self::$objTemplate->setVariable(array('SHOP_PRODUCT_STOCK' => $stock));
         }
         if ($detailLink) {
             self::$objTemplate->setVariable(array('SHOP_PRODUCT_DETAILLINK' => $detailLink));
         }
         $distribution = $objProduct->distribution();
         $weight = '';
         if ($distribution == 'delivery') {
             $weight = $objProduct->weight();
         }
         // Hide the weight if it is zero or disabled in the configuration
         if ($weight > 0 && \Cx\Core\Setting\Controller\Setting::getValue('weight_enable', 'Shop')) {
             self::$objTemplate->setVariable(array('TXT_SHOP_PRODUCT_WEIGHT' => $_ARRAYLANG['TXT_SHOP_PRODUCT_WEIGHT'], 'SHOP_PRODUCT_WEIGHT' => Weight::getWeightString($weight)));
         }
         if (Vat::isEnabled()) {
             self::$objTemplate->setVariable(array('SHOP_PRODUCT_TAX_PREFIX' => Vat::isIncluded() ? $_ARRAYLANG['TXT_SHOP_VAT_PREFIX_INCL'] : $_ARRAYLANG['TXT_SHOP_VAT_PREFIX_EXCL'], 'SHOP_PRODUCT_TAX' => Vat::getShort($objProduct->vat_id())));
         }
         // Add flag images for flagged Products
         $strImage = '';
         $strFlags = $objProduct->flags();
         $arrVirtual = ShopCategories::getVirtualCategoryNameArray(FRONTEND_LANG_ID);
         foreach (explode(' ', $strFlags) as $strFlag) {
             if (in_array($strFlag, $arrVirtual)) {
                 $strImage .= '<img src="images/content/' . $strFlag . '.jpg" alt="' . $strFlag . '" />';
             }
         }
         if ($strImage) {
             self::$objTemplate->setVariable('SHOP_PRODUCT_FLAG_IMAGE', $strImage);
         }
         $minimum_order_quantity = $objProduct->minimum_order_quantity();
         //Activate Quantity-Inputfield when minimum_order_quantity exists
         if (self::$objTemplate->blockExists('orderQuantity') && $minimum_order_quantity > 0) {
             self::$objTemplate->setVariable('SHOP_PRODUCT_MINIMUM_ORDER_QUANTITY', contrexx_raw2xhtml($objProduct->minimum_order_quantity()));
         } elseif (self::$objTemplate->blockExists('orderQuantity') && !$minimum_order_quantity) {
             self::$objTemplate->hideBlock('orderQuantity');
         }
         if (self::$objTemplate->blockExists('shopProductRow')) {
             self::$objTemplate->parse('shopProductRow');
         }
         ++$formId;
     }
     return true;
 }