function getTag($tag)
 {
     global $application;
     $value = null;
     $curr_id = modApiFunc("Localization", "getMainStoreCurrency");
     switch ($tag) {
         case 'Local_Items':
             $value = $this->outputCartContent();
             break;
         case 'Local_ProductOptionsSelected':
             $value = getOptionsCombination($this->_Cart_Item['Options'], 'Order', $this->order_mode_enabled);
             break;
         case 'Local_Subtotal':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "Subtotal", $curr_id));
             break;
         case 'Local_GlobalDiscount':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "SubtotalGlobalDiscount", $curr_id));
             break;
         case 'Local_PromoCodeDiscount':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "SubtotalPromoCodeDiscount", $curr_id));
             break;
         case 'Local_QuantityDiscount':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "QuantityDiscount", $curr_id));
             break;
         case 'Local_ShippingCost':
         case 'Local_TotalShippingAndHandlingCost':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "TotalShippingAndHandlingCost", $curr_id));
             break;
         case 'Local_FreeHandlingForOrdersOver':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "FreeHandlingForOrdersOver", $curr_id));
             break;
         case 'Local_PerItemShippingCostSum':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "PerItemShippingCostSum", $curr_id));
             break;
         case 'Local_ShippingMethodCost':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "ShippingMethodCost", $curr_id));
             break;
         case 'Local_FreeShippingForOrdersOver':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "FreeShippingForOrdersOver", $curr_id));
             break;
         case 'Local_MinimumShippingCost':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "MinimumShippingCost", $curr_id));
             break;
         case 'Local_PerOrderShippingFee':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "PerOrderShippingFee", $curr_id));
             break;
         case 'Local_TotalShippingCharge':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "TotalShippingCharge", $curr_id));
             break;
         case 'Local_ShippingMethodName':
             $shipping_module_id = modApiFunc("Checkout", "getChosenShippingModuleIdCZ");
             if ($shipping_module_id === NULL) {
                 //                               ,
                 return '---';
             }
             $shipping_method_id = modApiFunc("Checkout", "getChosenShippingMethodIdCZ");
             $shipping_module_info = modApiFunc("Checkout", "getShippingModuleInfo", $shipping_module_id);
             if ($shipping_module_info["GlobalUniqueShippingModuleID"] == "6F82BA03-C5B1-585B-CE2E-B8422A1A19F6") {
                 $mRes =& $application->getInstance('MessageResources', "messages");
                 $value = $mRes->getMessage('ALL_SM_ARE_INACTIVE');
                 unset($mRes);
             } else {
                 $ShippingMethodInfo = modApiFunc("Shipping_Cost_Calculator", "getCalculatedMethod", $shipping_module_info["APIClassName"], $shipping_method_id);
                 $value = $ShippingMethodInfo['method_name'];
             }
             break;
         case 'Local_PerItemHandlingCostSum':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "PerItemHandlingCostSum", $curr_id));
             break;
         case 'Local_PerOrderHandlingFee':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "PerOrderHandlingFee", $curr_id));
             break;
         case 'Local_TotalHandlingCharge':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "TotalHandlingCharge", $curr_id));
             break;
         case 'Local_Taxes':
             $value = $this->outputTax();
             break;
         case 'Local_Total':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "Total", $curr_id));
             break;
         case 'Local_GiftCertificatePrepaidAmount':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "TotalPrepaidByGC", $curr_id));
             break;
         case 'Local_TotalToPay':
             $value = modApiFunc("Localization", "currency_format", modApiFunc("Checkout", "getOrderPrice", "TotalToPay", $curr_id));
             break;
         case 'Local_SwatchColorSelected':
             $colname = $this->_Cart_Item['Colorname'];
             $value = "";
             if (!($colname == "")) {
                 $value = "<div style='clear:both;float:left; padding-left: 10px;'>Chosen colors : </div><div style='font-weight:normal;float: left;'>&nbsp;{$colname}</div>";
             }
             break;
         default:
             list($entity, $tag) = getTagName($tag);
             if ($entity == 'product' || $entity == 'unknown') {
                 //                        "                             Subtotal",
                 //                                                    .
                 if (getKeyIgnoreCase($tag, $this->_Cart_Item)) {
                     $value = getKeyIgnoreCase($tag, $this->_Cart_Item);
                 } else {
                     $value = isset($this->_Tax_Item) ? getKeyIgnoreCase($tag, $this->_Tax_Item) : null;
                     if ($value == null && $entity == 'product') {
                         $po = new CProductInfo($this->_Cart_Item['ID']);
                         if ($tag == "infolink" && $this->_Cart_Item['TypeID'] == GC_PRODUCT_TYPE_ID) {
                             $request = new Request();
                             $request->setView("GiftCertificate");
                             return $request->getURL();
                         }
                         $value = $po->getProductTagValue($tag);
                     }
                 }
             }
             break;
     }
     return $value;
 }
 /**
  * Returns the wishlist products
  */
 function getWishlistContent()
 {
     global $application;
     $wc = modApiFunc('Wishlist', 'getWishlistContent');
     $disable_trtd = $application->getAppIni('PRODUCT_LIST_DISABLE_TR_TD');
     if ($disable_trtd != null && strtolower($disable_trtd) === 'yes') {
         $disable_trtd = true;
     } else {
         $disable_trtd = false;
     }
     $items = "";
     $col = 1;
     $columns = intval($application->getBlockOption($this->template, 'Columns'));
     $this->_Item = null;
     $i = 0;
     foreach ($wc as $productInfo) {
         $Info = array();
         $Info['Local_ProductLargeImageSrc'] = $productInfo['LargeImageSrc'];
         $Info['Local_ProductName'] = $productInfo['Name'];
         $Info['Local_ProductSmallImageSrc'] = $productInfo['SmallImageSrc'];
         $Info['Local_ProductSmallImageWidth'] = $productInfo['SmallImageWidth'];
         $Info['Local_ProductLargeImageWidth'] = $productInfo['LargeImageWidth'];
         $Info['Local_ProductInfoLink'] = $productInfo['InfoLink'];
         $request = new Request();
         $request->setView('Wishlist');
         $request->setAction('RemoveProductFromWishlist');
         $request->setKey('wl_id', $productInfo['wl_id']);
         $Info['Local_RemoveProductLink'] = $request->getURL();
         $request = new Request();
         $request->setView('Wishlist');
         $Info['Local_FormAction'] = $request->getURL();
         $request = new Request();
         $request->setView('CartContent');
         $request->setAction('AddToCart');
         $request->setKey('wl_id', $productInfo['wl_id']);
         $Info['Local_AddToCartLink'] = $request->getURL();
         $Info['Local_FormId'] = "Product_Quan_" . $productInfo['ID'];
         $Info['Local_FormActionFieldName'] = 'asc_action';
         $Info['Local_FormActionFieldValue'] = 'UpdateWishlist';
         $Info['Local_FormWLIdArrayFieldName'] = 'wl_id[' . $i . ']';
         $Info['Local_WLID'] = $productInfo['wl_id'];
         $Info['Local_WLItemSalePrice'] = modApiFunc("Localization", "currency_format", $productInfo['CartItemSalePrice']);
         $Info['Local_WLItemWeight'] = modApiFunc("Localization", "format", $productInfo['CartItemWeight'], "weight") . " " . modApiFunc("Localization", "getUnitTypeValue", "weight");
         $Info['Local_WLItemPerItemShippingCost'] = modApiFunc("Localization", "currency_format", $productInfo['CartItemPerItemShippingCost']);
         $Info['Local_WLItemPerItemHandlingCost'] = modApiFunc("Localization", "currency_format", $productInfo['CartItemPerItemHandlingCost']);
         $unit_values = $productInfo['attributes']['SalePrice']['unit_type_values'];
         $unit_id = $productInfo['attributes']['SalePrice']['unit_type_value'];
         $Info['Local_ProductSubtotal'] = modApiFunc("Localization", "currency_format", $productInfo['Total']);
         $Info['Local_FormQuantityFieldName'] = 'quantity[' . $productInfo['wl_id'] . ']';
         $Info['Local_ProductQuantity'] = $productInfo['Quantity_In_Cart'];
         $Info['ImageSize'] = 'width="' . $productInfo['SmallImageWidth'] . '" height="' . $productInfo['SmallImageHeight'] . '"';
         $Info['Local_ProductOptionsSelected'] = getOptionsCombination($productInfo['Options']);
         $Info['Local_ProductQuantityOptions'] = modApiFunc('Cart', 'getProductQuantityOptions', $productInfo['Quantity_In_Cart'], $productInfo['ID'], true, true);
         if ($col == 1) {
             if ($disable_trtd == false) {
                 $items .= '<tr><td>';
             }
             $col++;
         } else {
             if ($disable_trtd == false) {
                 $items .= '<td>';
             }
             $col++;
         }
         if ($col > $columns) {
             $col = 1;
         }
         $this->_Template_Contents = $Info;
         $application->registerAttributes($this->_Template_Contents);
         modApiFunc("tag_param_stack", "push", __CLASS__, array(array('key' => 'prod_id', 'value' => $productInfo['ID'])));
         $items .= $this->templateFiller->fill('Item', $productInfo['TypeID']);
         modApiFunc("tag_param_stack", "pop", __CLASS__);
         $i++;
     }
     return $items;
 }
예제 #3
0
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'Local_FormAction':
             $request = new Request();
             $request->setView('CartContent');
             $request->setAction('UpdateCartContent');
             $value = $request->getURL();
             break;
         case 'Local_FormId':
             $value = "Product_Quan";
             break;
         case 'Local_FormActionFieldName':
             $value = 'asc_action';
             break;
         case 'Local_FormActionFieldValue':
             $value = 'UpdateCartContent';
             break;
         case 'Local_Items':
             $value = $this->getCartContent();
             break;
         case 'Local_ClearLink':
             $request = new Request();
             $request->setView('CartContent');
             $request->setAction('ClearCart');
             $value = $request->getURL();
             break;
         case 'Local_ProductOptionsSelected':
             $value = getOptionsCombination($this->_Cart_Item['Options']);
             break;
         case 'Local_PriceName':
             if (isset($this->_Local_PriceName)) {
                 return $this->_Local_PriceName;
             } else {
                 return "";
             }
         case 'Local_PriceAmount':
             if (isset($this->_Local_PriceAmount)) {
                 return $this->_Local_PriceAmount;
             } else {
                 return "";
             }
         case 'Local_ShoppingCartPrices':
             $value = $this->outputShoppingCartPrices();
             break;
         case 'Local_ProductQuantityOptions':
             if ($this->_Cart_Item["TypeID"] == GC_PRODUCT_TYPE_ID) {
                 $value = '<option value="1">1</option>';
             } else {
                 $qty_in_cart = $this->_Cart_Item['Quantity_In_Cart'];
                 $value = modApiFunc("Cart", "getProductQuantityOptions", $qty_in_cart, $this->_Cart_Item['ID'], true);
             }
             break;
         case 'Local_ShoppingCartResultMessage':
             if ($this->ShoppingCartResultMessage === NULL) {
                 $value = "";
             } else {
                 $value = $this->ShoppingCartResultMessage;
             }
             break;
         case 'Local_HideCheckoutLink':
             $value = $this->hide_checkout_link;
             break;
         case 'Local_ThumbnailSide':
             $pi_settings = modApiFunc('Product_Images', 'getSettings');
             $value = $pi_settings['MAIN_IMAGE_SIDE'];
             break;
         case 'Local_ColorSwatchName':
             $colname = $this->_Cart_Item['Colorname'];
             $value = "";
             if (!($colname == "")) {
                 $value = "<div style='clear:both;float:left; padding-left: 10px;'>Chosen colors : </div><div style='font-weight:normal;float: left;'>&nbsp;{$colname}</div>";
             }
             break;
         default:
             list($entity, $tag) = getTagName($tag);
             if ($entity == 'product' || $entity == 'unknown') {
                 $value = getKeyIgnoreCase($tag, $this->_Cart_Item) ? getKeyIgnoreCase($tag, $this->_Cart_Item) : null;
             }
             break;
     }
     return $value;
 }