/**
  * 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;
 }
 /**
  * Processes tags in the templates for the given view.
  *
  * @return string tag value, if tag has been processed. NULL, otherwise.
  */
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'Local_ProductID':
             $value = $this->_ProductInfo['ID'];
             break;
         case 'Local_JSfuncProductFormSubmit':
             $value = "<script type=\"text/javascript\">" . "function ProductFormSubmit_" . $this->_ProductInfo['ID'] . "()" . "{" . " document.forms['ProductForm_" . $this->_ProductInfo['ID'] . "'].submit();" . "};" . "</script>";
             break;
         case 'Local_ProductStockWarnings':
             if (!modApiFunc('Session', 'is_set', 'StockDiscardedBy')) {
                 $value = '';
             } else {
                 $stock_discarded_by = modApiFunc('Session', 'get', 'StockDiscardedBy');
                 modApiFunc('Session', 'un_set', 'StockDiscardedBy');
                 $value = $stock_discarded_by;
                 //cz_getMsg($stock_discarded_by);
             }
             break;
         case 'Local_ProductFormStart':
             $skin = modApiFunc('Look_Feel', 'getCurrentSkin');
             if ($skin == 'digiCenter' || $skin == 'foodCourt' || $skin == 'flowers') {
                 if (empty($this->_product_form_action)) {
                     $this->_product_form_action = getpageurl('CartContent');
                 }
                 $redirect = modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_SHOW_CART);
                 $script = $redirect ? $this->_product_form_action : $_SERVER["PHP_SELF"];
                 $value = '<form action="' . $script . '" name="ProductForm_' . $this->_ProductInfo['ID'] . '" id="product_addtocart_form" method="post" enctype="multipart/form-data">
                       ';
             } else {
                 if (empty($this->_product_form_action)) {
                     $this->_product_form_action = getpageurl('CartContent');
                 }
                 $redirect = modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_SHOW_CART);
                 $script = $redirect ? $this->_product_form_action : $_SERVER["PHP_SELF"];
                 $value = '<form action="' . $script . '" name="ProductForm_' . $this->_ProductInfo['ID'] . '" id="ProductForm_' . $this->_ProductInfo['ID'] . '" method="post" enctype="multipart/form-data">
                       <input type="hidden" name="asc_action" value="AddToCart" />
                       <input type="hidden" name="prod_id" value="' . $this->_ProductInfo['ID'] . '" />
                     <script type="text/javascript">
                     function ProductFormSubmit_' . $this->_ProductInfo['ID'] . '()
                     {
                         document.forms[\'ProductForm_' . $this->_ProductInfo['ID'] . '\'].submit();
                     };
                     </script>';
             }
             break;
         case 'Local_ProductFormEnd':
             $value = '</form>';
             break;
         case 'Local_ProductAddToCart':
             $value = 'javascript: ProductFormSubmit_' . $this->_ProductInfo['ID'] . '();';
             break;
         case 'ProductOptionsForm':
             $value = getOptionsChoice($this->_ProductInfo['ID']);
             break;
         case 'Local_FormQuantityFieldName':
             $value = 'quantity_in_cart';
             break;
         case 'NextProductID':
             $value = $this->next_product_id;
             break;
         case 'PreviousProductID':
             $value = $this->previous_product_id;
             break;
         case 'Local_ProductQuantityOptions':
             $force_quantity = false;
             if (modApiFunc('Request', 'getValueByKey', 'presetCombination') != '') {
                 list($type, $customer_id, $wl_id) = explode('_', modApiFunc('Request', 'getValueByKey', 'presetCombination'));
                 if ($type == 'wl') {
                     $wl_info = modApiFunc('Wishlist', 'getWishlistRecordCartData', $wl_id, $customer_id);
                     if ($wl_info && @$wl_info['parent_entity'] == 'product' && @$wl_info['entity_id'] == $this->_ProductInfo['ID']) {
                         $qty_in_cart = $wl_info['qty'];
                         $force_quantity = true;
                     }
                 }
             } else {
                 $qty_in_cart = modApiFunc("Cart", "getProductQuantity", $this->_ProductInfo['ID']);
             }
             $value = modApiFunc("Cart", "getProductQuantityOptions", $qty_in_cart, $this->_ProductInfo['ID'], false, false, $force_quantity);
             break;
         case 'Local_ProductSettingsJSON':
             $product_object = new CProductInfo($this->_ProductInfo['ID']);
             $options_settings = modApiFunc('Product_Options', 'getOptionsSettingsForEntity', 'product', $this->_ProductInfo['ID']);
             $settings = array('product_id' => (int) $this->_ProductInfo['ID'], 'sale_price' => (double) getValProductSalePrice(), 'list_price' => (double) getValProductListPrice(), 'currency_settings' => modApiFunc('Localization', 'getCurrencySettings'), 'aanic' => $options_settings['AANIC'], 'aanis' => $options_settings['AANIS'], 'labels' => array('comb_unavailable' => $options_settings['WRN_CI_CR'], 'inv_unavailable' => $options_settings['WRN_CI_INV'], 'comb_limit_stock' => $options_settings['WRN_CI_INV'], 'comb_out_of_stock' => $options_settings['WRN_CI_INV']));
             $json = new Services_JSON();
             $value = $json->encode($settings);
             break;
         case 'Local_ThumbnailSide':
             $pi_settings = modApiFunc('Product_Images', 'getSettings');
             $value = $pi_settings['MAIN_IMAGE_SIDE'];
             break;
         case 'ProductColorSwatchImages':
             $value = getColorSwatchImages($this->_ProductInfo['ID']);
             break;
         default:
             list($entity, $tag) = getTagName($tag);
             if ($entity == 'product') {
                 //$value = getKeyIgnoreCase($tag, $this->_ProductInfo);
                 //               ,               default               switch' .
                 //           ,               $this->_ProductInfo                                          (            ),
                 //                                   getValProduct*,                ,
                 //                .                                             .
                 $product_object = new CProductInfo($this->_ProductInfo['ID']);
                 $value = $product_object->getProductTagValue($tag);
             }
             break;
     }
     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)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'Local_JSfuncProductFormSubmit':
             $value = "<script type=\"text/javascript\">" . "function ProductFormSubmit_" . $this->_ProductInfo['ID'] . "()" . "{" . " document.forms['ProductForm_" . $this->_ProductInfo['ID'] . "'].submit();" . "};" . "</script>";
             break;
         case 'Local_ProductStockWarnings':
             if (!modApiFunc('Session', 'is_set', 'StockDiscardedBy')) {
                 $value = '';
             } else {
                 $stock_discarded_by = modApiFunc('Session', 'get', 'StockDiscardedBy');
                 modApiFunc('Session', 'un_set', 'StockDiscardedBy');
                 $value = $stock_discarded_by;
                 //cz_getMsg($stock_discarded_by);
             }
             break;
         case 'Local_ProductFormStart':
             $value = '<form action="cart.php" name="ProductForm_' . $this->_ProductInfo['ID'] . '" id="ProductForm_' . $this->_ProductInfo['ID'] . '" method="post" enctype="multipart/form-data">
                       <input type="hidden" name="asc_action" value="AddToCart" />
                       <input type="hidden" name="prod_id" value="' . $this->_ProductInfo['ID'] . '" />
                     <script type="text/javascript">
                     function ProductFormSubmit_' . $this->_ProductInfo['ID'] . '()
                     {
                         document.forms[\'ProductForm_' . $this->_ProductInfo['ID'] . '\'].submit();
                     };
                     </script>';
             break;
         case 'Local_ProductFormEnd':
             $value = '</form>';
             break;
         case 'Local_ProductAddToCart':
             $value = 'javascript: ProductFormSubmit_' . $this->_ProductInfo['ID'] . '();';
             break;
         case 'ProductOptionsForm':
             $value = getOptionsChoice($this->_ProductInfo['ID']);
             break;
         case 'Local_FormQuantityFieldName':
             $value = 'quantity_in_cart';
             break;
         case 'Local_ProductQuantityOptions':
             $qty_in_cart = modApiFunc("Cart", "getProductQuantity", $this->_ProductInfo['ID']);
             $value = modApiFunc("Cart", "getProductQuantityOptions", $qty_in_cart, $this->_ProductInfo['ID']);
             break;
         case 'RelatedProducts':
             $value = $this->_rp_output;
             //                           output
             break;
         default:
             list($entity, $tag) = getTagName($tag);
             if ($entity == 'product') {
                 $value = getKeyIgnoreCase($tag, $this->_ProductInfo);
             }
             break;
     }
     return $value;
 }
Пример #4
0
 /**
  * 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_Items':
             $skin = modApiFunc('Look_Feel', 'getCurrentSkin');
             if ($skin == 'digiCenter' || $skin == 'foodCourt' || $skin == 'flowers') {
                 $value = $this->getProductsList();
             } else {
                 $value = $this->getDefaultProductsList();
             }
             break;
         case 'Local_Columns':
             $value = $this->columns;
             break;
         case 'Local_ItemCount':
             $value = $this->getProductsListCount();
             break;
             # override the PaginatorRows tag behavior
         # override the PaginatorRows tag behavior
         case 'PaginatorLine':
             $value = getPaginatorLine($this->getPagName(), $this->getBlockName(), $this->getPagParam());
             break;
             # override the PaginatorRows tag behavior
         # override the PaginatorRows tag behavior
         case 'PaginatorDropdown':
             $value = getPaginatorDropdown($this->getPagName(), $this->getBlockName());
             break;
         case 'CategoryName':
             $catobj =& $application->getInstance('CCategoryInfo', $this->pl_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':
             if (empty($this->_product_form_action)) {
                 $this->_product_form_action = getpageurl('CartContent');
             }
             $buy_link = $this->_Product_Info->getProductTagValue('BuyLink');
             $redirect = modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_SHOW_CART);
             $script = $redirect ? $this->_product_form_action : $_SERVER["PHP_SELF"];
             $pid = $this->_Product_Info->getProductTagValue('ID');
             $value = '<form action="' . $script . '" name="ProductForm_' . $pid . '" id="ProductForm_' . $pid . '" method="post">
                       <input type="hidden" name="asc_action" value="AddToCart" />
                       <input type="hidden" name="prod_id" value="' . $pid . '" />
                     <script type="text/javascript">
                     function ProductFormSubmit_' . $pid . '()
                     {
                         document.forms[\'ProductForm_' . $pid . '\'].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;
         case 'Local_Thumbnail':
             break;
         case 'Local_ThumbnailSide':
             $pi_settings = modApiFunc('Product_Images', 'getSettings');
             $value = $pi_settings['MAIN_IMAGE_SIDE'];
             break;
         case 'ProductColorSwatchImages':
             $value = getColorSwatchImages($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;
 }