/** * Outputs the search form. * * @return string. */ function output() { global $application; #define whether to output the view or not if ($this->NoView) { $application->outputTagErrors(true, "SearchForm", "Errors"); return ""; } else { $application->outputTagErrors(true, "SearchForm", "Warnings"); } # Register Additional tags $application->registerAttributes(array('Local_SearchFormAction', 'Local_SearchFormName', 'Local_ActionName', 'Local_ActionValue', 'Local_SearchTextFieldName', 'Local_SearchText')); $templateFiller = new TemplateFiller(); # define the template for the given view. $template = $application->getBlockTemplate('SearchForm'); $templateFiller->setTemplate($template); $result = $templateFiller->fill("Container"); return $result; }
/** * Returns the product info. * * @return string. */ function output() { global $application; #Define whether to output the view or not if ($this->NoView) { $application->outputTagErrors(true, "CustomerReviewsProductInfo", "Errors"); return ""; } else { $application->outputTagErrors(true, "CustomerReviewsProductInfo", "Warnings"); } $catalog =& $application->getInstance('Catalog'); $this->prod_id = @func_get_arg(0); if ($this->prod_id === false) { $this->prod_id = $catalog->getCurrentProductID(); } if (!$this->prod_id) { return; } modApiFunc("tag_param_stack", "push", __CLASS__, array(array("key" => TAG_PARAM_PROD_ID, "value" => $this->prod_id))); # Get current selected product info. $product_info = modApiFunc('Catalog', 'getProductInfo', $this->prod_id); # save info $this->_ProductInfo = $product_info; # Related $this->_rp_output = getRelatedProducts($this->prod_id); # $application->registerAttributes(array('Local_HiddenFields' => '', 'Local_JSfuncProductFormSubmit' => '', 'Local_ProductStockWarnings' => '', 'ProductOptionsForm' => '', 'Local_ProductFormStart' => '', 'Local_ProductFormEnd' => '', 'Local_ProductAddToCart' => '', 'Local_FormQuantityFieldName' => '', 'Local_ProductQuantityOptions' => '', 'RelatedProducts' => '')); $templateFiller = new TemplateFiller(); # define the template for the given view. $template = $application->getBlockTemplate('CustomerReviewsProductInfo'); $templateFiller->setTemplate($template); $obj_product = new CProductInfo($this->prod_id); $stock_method = $obj_product->whichStockControlMethod(); if ($stock_method == PRODUCT_OPTIONS_INVENTORY_TRACKING) { // stock , product info // $template = "Item"; } else { // OutOfStock - . // OutOfStock - . $store_show_absent = modApiFunc("Configuration", "getValue", "store_show_absent"); $qty_in_stock = $this->_ProductInfo['attributes']['QuantityInStock']['value']; $low_stock_level = $this->_ProductInfo['attributes']['LowStockLevel']['value']; $b_out_of_stock = $qty_in_stock !== "" && $qty_in_stock < 1; switch ($store_show_absent) { case STORE_SHOW_ABSENT_SHOW_BUY: // < , > - // $template = "Item"; break; case STORE_SHOW_ABSENT_SHOW_NOT_BUY: // < , > // LowStock - <Low Stock! Buy Now!> if ($b_out_of_stock === true) { $template = "ItemOutOfStock"; } else { $template = "Item"; } break; case STORE_SHOW_ABSENT_NOT_SHOW_NOT_BUY: // < , > if ($b_out_of_stock === true) { return ""; } else { $template = "Item"; } break; default: //STORE_SHOW_ABSENT_SHOW_BUY $template = "Item"; break; } } $result = $templateFiller->fill($template, $product_info['TypeID']); modApiFunc("tag_param_stack", "pop", __CLASS__); modApiFunc('EventsManager', 'throwEvent', 'ProductInfoDisplayed', $this->prod_id); return $result; }
/** * Returns the product info. * * @return string. */ function output() { global $application; #Define whether to output the view or not if ($this->NoView) { $application->outputTagErrors(true, "ProductInfo", "Errors"); return ""; } else { $application->outputTagErrors(true, "ProductInfo", "Warnings"); } $catalog =& $application->getInstance('Catalog'); $this->prod_id = @func_get_arg(0); if ($this->prod_id === false) { $this->prod_id = $catalog->getCurrentProductID(); } if (!$this->prod_id || $catalog->getBaseProductInfo($this->prod_id) == null) { $request = new Request(); $request->setView('Index'); $application->redirect($request); return; } else { $product_object = new CProductInfo($this->prod_id); $ms_vis = $product_object->getProductTagValue('MembershipVisibility'); $cur_group_id = modApiFunc('Customer_Account', 'getCurrentSignedCustomerGroupID'); if ($product_object->getProductTagValue('Available') == 'Offline' || $ms_vis != '-1' && !in_array($cur_group_id, explode('|', $ms_vis))) { $request = new Request(); $request->setView('Index'); $application->redirect($request); return; } } /* Determining the IDs of the previous and next product, relively to the current one */ $this->next_product_id = 0; $this->previous_product_id = 0; $product_ids = $catalog->getProductListByGlobalFilter(PAGINATOR_DISABLE); // in the order set in storefront $products_count = count($product_ids); for ($p = 0; $p < $products_count; $p++) { if ($product_ids[$p]['product_id'] == $this->prod_id) { if ($p - 1 >= 0) { $this->previous_product_id = $product_ids[$p - 1]['product_id']; } if ($p + 1 < $products_count) { $this->next_product_id = $product_ids[$p + 1]['product_id']; } break; } } modApiFunc("tag_param_stack", "push", __CLASS__, array(array("key" => TAG_PARAM_PROD_ID, "value" => $this->prod_id))); # Get current selected product info. $product_info = modApiFunc('Catalog', 'getProductInfo', $this->prod_id); # save info $this->_ProductInfo = $product_info; # $_template_tags = array('Local_HiddenFields' => '', 'Local_ProductID' => '', 'Local_JSfuncProductFormSubmit' => '', 'Local_ProductStockWarnings' => '', 'ProductOptionsForm' => '', 'Local_ProductFormStart' => '', 'Local_ProductFormEnd' => '', 'Local_ProductAddToCart' => '', 'Local_FormQuantityFieldName' => '', 'Local_ProductQuantityOptions' => '', 'RelatedProducts' => '', 'NextProductID' => '', 'PreviousProductID' => '', 'Local_ProductSettingsJSON' => '', 'Local_ThumbnailSide' => '', 'ProductColorSwatchImages' => ''); $application->registerAttributes($_template_tags, 'ProductInfo'); $templateFiller = new TemplateFiller(); # define the template for the given view. $template = $application->getBlockTemplate('ProductInfo'); $templateFiller->setTemplate($template); $this->_product_form_action = getpageurl('CartContent'); $obj_product = new CProductInfo($this->prod_id); $stock_method = $obj_product->whichStockControlMethod(); // OutOfStock - . // OutOfStock - . $store_show_absent = modApiFunc("Configuration", "getValue", "store_show_absent"); if ($stock_method == PRODUCT_OPTIONS_INVENTORY_TRACKING) { $qty_in_stock = modApiFunc('Product_Options', 'getQuantityInStockByInventoryTable', 'product', $this->prod_id, true); } else { $qty_in_stock = $this->_ProductInfo['attributes']['QuantityInStock']['value']; } $low_stock_level = $this->_ProductInfo['attributes']['LowStockLevel']['value']; $b_out_of_stock = $qty_in_stock !== "" && $qty_in_stock < 1; switch ($store_show_absent) { case STORE_SHOW_ABSENT_SHOW_BUY: // , - // $template = "Item"; break; case STORE_SHOW_ABSENT_SHOW_NOT_BUY: // , // LowStock - Low Stock! Buy Now! if ($b_out_of_stock === true) { $template = "ItemOutOfStock"; } else { $template = "Item"; } break; case STORE_SHOW_ABSENT_NOT_SHOW_NOT_BUY: // , if ($b_out_of_stock === true) { $request = new Request(); $request->setView('Index'); $application->redirect($request); return ""; } else { $template = "Item"; } break; default: //STORE_SHOW_ABSENT_SHOW_BUY $template = "Item"; break; } $result = $templateFiller->fill($template, $product_info['TypeID']); modApiFunc("tag_param_stack", "pop", __CLASS__); modApiFunc('EventsManager', 'throwEvent', 'ProductInfoDisplayed', $this->prod_id); return $result; }
/** * Outputs the search form. * * @return string. */ function output() { global $application; #define whether to output the view or not if ($this->NoView) { $application->outputTagErrors(true, "ProductListSorter", "Errors"); return ""; } else { $application->outputTagErrors(true, "ProductListSorter", "Warnings"); } $this->__current_category_id = modApiFunc('CProductListFilter', 'getCurrentCategoryId'); # Register Additional tags $application->registerAttributes(array('Local_LinkList', 'Local_Href', 'Local_Name')); $application->registerAttributes($this->__getSortTagsArrayWithPrefix($this->__href_tag_prefix)); $templateFiller = new TemplateFiller(); # define the template for the given view. $template = $application->getBlockTemplate('ProductListSorter'); $templateFiller->setTemplate($template); $result = $templateFiller->fill("Container"); return $result; }
function getProductsList() { // OutOfStock - . // OutOfStock - . $store_show_absent = modApiFunc("Configuration", "getValue", "store_show_absent"); global $application; $pl = $this->pl ? $this->pl : $this->getPL(); $this->pl = null; $items = ""; $col = 1; $columns = 4; $this->_Product_Info = null; reset($pl); $__templateFiller = new TemplateFiller(); $__templateFiller->setTemplate($this->pl_tag_settings->getTemplate()); $disable_trtd = $application->getAppIni('PRODUCT_LIST_DISABLE_TR_TD'); if ($disable_trtd != null && strtolower($disable_trtd) === 'yes') { $disable_trtd = true; } else { $disable_trtd = false; } $outputed_products = array(); $newrow = 0; while (!empty($pl)) { $productInfo_array = array_shift($pl); if ($newrow == 1) { if ($disable_trtd == false) { $items .= '</td></tr>'; } else { $items .= '</div></div>'; $items .= $__templateFiller->fill('Separator'); // $items .= '</div>'; } $newrow = 0; } if ($col == 1) { if ($disable_trtd == false) { $items .= '<tr><td class="hasRightBorder">'; } else { $items .= '<div class="products-grid row-fluid "><div class="span3 item">'; } $col++; } elseif ($col > 1 && $col != $columns) { if ($disable_trtd == false) { $items .= '</td><td class="hasRightBorder">'; } else { $items .= '</div><div class="span3 item">'; } $col++; } else { if ($disable_trtd == false) { $items .= '</td><td class="hasNOborder">'; } else { $items .= '</div><div class="span3 item">'; } $col++; } if ($col > $columns) { $newrow = 1; $col = 1; } $this->_Product_Info =& $application->getInstance('CProductInfo', $productInfo_array['product_id']); $outputed_products[] = $productInfo_array['product_id']; $low_stock_level = $this->_Product_Info->getProductTagValue('LowStockLevel', PRODUCTINFO_NOT_LOCALIZED_DATA); $stock_method = $this->_Product_Info->whichStockControlMethod(); if ($stock_method == PRODUCT_OPTIONS_INVENTORY_TRACKING) { $qty_in_stock = modApiFunc('Product_Options', 'getQuantityInStockByInventoryTable', 'product', $productInfo_array['product_id'], true); } else { $qty_in_stock = $this->_Product_Info->getProductTagValue('QuantityInStock', PRODUCTINFO_NOT_LOCALIZED_DATA); } $b_out_of_stock = $qty_in_stock !== "" && $qty_in_stock < 1; switch ($store_show_absent) { case STORE_SHOW_ABSENT_SHOW_BUY: // , - // $template = "Item"; break; case STORE_SHOW_ABSENT_SHOW_NOT_BUY: // , // LowStock - Low Stock! Buy Now! if ($b_out_of_stock === true) { $template = "ItemOutOfStock"; } else { $template = "Item"; } break; default: //STORE_SHOW_ABSENT_SHOW_BUY $template = "Item"; break; } modApiFunc("tag_param_stack", "push", __CLASS__, array(array("key" => TAG_PARAM_PROD_ID, "value" => $productInfo_array['product_id']))); $items .= $__templateFiller->fill($template, $this->_Product_Info->getProductTagValue('TypeId')); modApiFunc("tag_param_stack", "pop", __CLASS__); } unset($pl); modApiFunc('EventsManager', 'throwEvent', 'ProductlistDisplayed', $outputed_products); if ($disable_trtd == false) { while ($col <= $columns) { $items .= '</td><td> '; $col++; } $items .= '</td></tr>'; } else { while ($col <= $columns) { $items .= '</div><div> '; $col++; } $items .= '</div></div>'; } return $items; }