function onAction() { $request = new Request(); $category_id = $request->getValueByKey('category_id'); /* * : * , . * default * AZ ( AZ). * * : * Catalog::getProductListByGlobalFilter , * . * default . */ // default loadClass('CProductListFilter'); $f = new CProductListFilter(); $params = $f->getProductListParamsObject(); $params->category_id = $category_id; $params->select_mode_recursiveness = IN_CATEGORY_ONLY; // $products_array = modApiFunc('Catalog', 'getProductListByFilter', $params, RETURN_AS_ID_LIST); $products = array(); if (!empty($products_array)) { foreach ($products_array as $pinfo) { $obj = new CProductInfo($pinfo['product_id']); $products[] = array('id' => $pinfo['product_id'], 'name' => $obj->getProductTagValue('Name')); } } global $_RESULT; $_RESULT['products'] = $products; }
function out_RelatedList() { $html_code = ''; if (!empty($this->RPLinks)) { global $application; foreach ($this->RPLinks as $rp_id) { $obj = new CProductInfo($rp_id); $tags = array('RelatedID' => $rp_id, 'RelatedName' => $obj->getProductTagValue('Name'), 'jsControlPListFunc' => ' ' . str_replace(array('%PID%'), array($rp_id), $this->pb_obj->getControlPListFunction())); $this->_Template_Contents = $tags; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); $html_code .= $this->mTmplFiller->fill("related_products/rp_links_list/", "rp_item.tpl.html", array()); } } return $html_code; }
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()); }
function outputLinkedProduct($p_id) { global $application; $prod = new CProductInfo($p_id); $tags = array('ProductID' => $p_id, 'ProductName' => $prod->getProductTagValue('Name'), 'ProductImageFile' => $prod->getProductTagValue('smallimagefile'), 'ProductImage' => $prod->getProductTagValue('smallimagesrc'), 'ProductImageWidth' => $prod->getProductTagValue('smallimagewidth'), 'ProductImageHeight' => $prod->getProductTagValue('smallimageheight')); if ($tags['ProductImageFile'] == '' || $tags['ProductImageWidth'] == 0 || $tags['ProductImageHeight'] == 0) { $imagesUrl = $application->getAppIni('SITE_AZ_URL'); if ($application->getCurrentProtocol() == "https" && $application->getAppIni('SITE_AZ_HTTPS_URL')) { $imagesUrl = $application->getAppIni('SITE_AZ_HTTPS_URL'); } $tags['ProductImage'] = $this->no_image_url; $tags['ProductImageWidth'] = 100; $tags['ProductImageHeight'] = 100; } return modApiFunc('TmplFiller', 'fill', "catalog/category_review/", "linked_product.tpl.html", $tags); }
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; }
/** * 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; }
function doWork($data) { $str = new CString(); foreach ($data as $i => $product) { $product_info = $product; $prodObj = new CProductInfo($product_info["ProductID"]); /* if($prodObj->getProductTagValue('Available', PRODUCTINFO_NOT_LOCALIZED_DATA) == PRODUCT_STATUS_OFFLINE) continue; $cats = $product_info["ProductAllCategoryPath"]; if(!empty($cats) && is_array($cats) && !empty($cats[0]) && is_array($cats[0])) { foreach($cats[0] as $cat) { $objCurrentCat = new CCategoryInfo($cat["id"]); if($objCurrentCat->getCategoryTagValue('RecursiveStatus')==CATEGORY_STATUS_OFFLINE) continue 2; } } */ $product_entry = array(); // Availablity if ($prodObj->getProductTagValue('Available', PRODUCTINFO_NOT_LOCALIZED_DATA) == PRODUCT_STATUS_OFFLINE) { $product_entry[] = FG_GOOGLE_PRODUCT_STATUS_OUT_OF_STOCK; } else { $product_entry[] = FG_GOOGLE_PRODUCT_STATUS_IN_STOCK; } // id $product_entry[] = $product_info["ProductID"]; $product_entry[] = $product_info["ProductTypeName"]; // product_type // we have to delete ";"-symbol, as Google Base treats it as a delimiter if (!empty($product_info["ProductCategoryPath"])) { $categories = array(); foreach ($product_info["ProductCategoryPath"] as $cat) { $categories[] = $this->sterilizeTextField($cat["name"]); } array_shift($categories); $product_entry[] = implode(", ", $categories); } // title // we have to delete ";"-symbol, as Google Base treats it as a delimiter $product_entry[] = $this->sterilizeTextField($product_info["ProductName"]); // description // we have to delete ";"-symbol, as Google Base treats it as a delimiter $product_entry[] = $this->sterilizeTextField($product_info["ProductShortDescription"]); // price // sale price + , $options_modifiers = modApiFunc("Product_Options", "getModifiersOfDefaultCombination", "product", $product_info["ProductID"]); $price_modifier_summ = $options_modifiers['price']; $price_modifier_summ += $product_info["ProductSalePrice"]; if ($price_modifier_summ < 0) { $price_modifier_summ = 0; } $product_entry[] = number_format($price_modifier_summ, 2, ".", ""); // condition $product_entry[] = "new"; // link LayoutConfigurationManager::static_activate_cz_layout($this->_settings['froogle_storefront_link']); $request = new CZRequest(); $request->setView('ProductInfo'); $request->setAction('SetCurrentProduct'); $request->setKey('prod_id', $product_info["ProductID"]); $product_entry[] = $request->getURL("", false, 'froogle'); // image_link if (!empty($product_info["ProductLargeImageSrc"])) { $product_entry[] = $product_info["ProductLargeImageSrc"]; } // expiration_date $product_entry[] = $this->_settings["froogle_expires_date"]; // gtin $product_entry[] = $this->getGTIN($product_info); // brand $manufacturer_info = modApiFunc("Manufacturers", "getManufacturerInfo", $prodObj->getProductTagValue('Manufacturer', PRODUCTINFO_NOT_LOCALIZED_DATA)); $product_entry[] = isset($manufacturer_info["manufacturer_name"]) ? $this->sterilizeTextField($manufacturer_info["manufacturer_name"]) : ''; // mpn $product_entry[] = isset($product_info["ProductMPN"]) ? $this->sterilizeTextField($product_info["ProductMPN"]) : ''; // google_product_category $product_entry[] = isset($product_info["ProductGpc"]) && $product_info["ProductGpc"] != getMsg('SYS', 'PRTYPE_VALUE_NOT_SELECTED') ? $product_info["ProductGpc"] : ''; // gender $product_entry[] = isset($product_info["ProductGender"]) && $product_info["ProductGender"] != getMsg('SYS', 'PRTYPE_VALUE_NOT_SELECTED') ? $product_info["ProductGender"] : ''; // age_group $product_entry[] = isset($product_info["ProductAgegroup"]) && $product_info["ProductAgegroup"] != getMsg('SYS', 'PRTYPE_VALUE_NOT_SELECTED') ? $product_info["ProductAgegroup"] : ''; // apparel size $product_entry[] = isset($product_info["ProductApparelsize"]) ? $this->sterilizeTextField($product_info["ProductApparelsize"]) : ''; // Apparel color $product_entry[] = isset($product_info["ProductApparelcolor"]) ? $this->sterilizeTextField($product_info["ProductApparelcolor"]) : ''; // location if (isset($this->_settings["froogle_location"]) && $this->_settings["froogle_location"] != null) { $product_entry[] = $this->sterilizeTextField($this->_settings["froogle_location"]); } // payment_notes if (isset($this->_settings["froogle_payment_notes"]) && $this->_settings["froogle_payment_notes"] != null) { $product_entry[] = $this->sterilizeTextField($this->_settings["froogle_payment_notes"]); } // payment_accepted if (isset($this->_settings["froogle_payment_accepted"]) && $this->_settings["froogle_payment_accepted"] != null) { $product_entry[] = $this->sterilizeTextField($this->_settings["froogle_payment_accepted"]); } $result = implode("\t", $product_entry); fwrite($this->_fileForExport, $result); fwrite($this->_fileForExport, "\n"); } }
/** * Updates the product quantity in the stock after the order confirmation. */ function updateProductsQuantity($products, $mult) { $_affected_products = array(); foreach ($products as $prodInfo) { //: the attribute is used by the id, it needs to be rewritten //check if the attribute of the QuantityInStock product is visible if (!modApiFunc("Catalog", "isProductAttributeVisible", $prodInfo['storeProductID'], 3)) { continue; } $prodObj = new CProductInfo($prodInfo['storeProductID']); if ($prodObj->_fProductIDIsIncorrect === false) { // , QuantityInStock $productQuantityInStock = $prodObj->getProductTagValue('QuantityInStock', PRODUCTINFO_NOT_LOCALIZED_DATA); if (!is_numeric($productQuantityInStock)) { /* , , , QuantityInStock, . . . . */ continue; } execQuery('UPDATE_PRODUCT_QUANTITY_ATTRIBUTE', array('mult' => $mult, 'qty' => $prodInfo['qty'], 'p_id' => $prodInfo['storeProductID'])); $_affected_products[] = $prodInfo['storeProductID']; $cats_ids = $prodObj->getCategoriesIDs(); foreach ($cats_ids as $category_id) { modAPIFunc('paginator', 'resetPaginator', "Catalog_ProdsList_" . $category_id); } } } modApiFunc('EventsManager', 'throwEvent', 'ProductQuantityChanged', $_affected_products); }
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;'> {$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; }
function __info_tag_output($tag, $arg_list) { global $application, $zone; # . $view = $application->getLatestTag(); list($entity, $attr) = getTagName($tag); /* * empty($arg_list) , msg * . */ if ($view != null && is_callable(array($view, 'getTag')) && empty($arg_list)) { if (strtolower($tag) == 'viewclassname') { $alias = $application->getBlockOverride($view); echo strtolower($alias == null ? $view : $alias); return; } $view_obj =& $application->getInstance($view); $output = $view_obj->getTag($tag, $arg_list); if ($output !== null) { echo $output; return; } } if (empty($arg_list)) { # . , . $params = $application->getTemplateParameters(); $product_id = $params['product_id']; $category_id = $params['category_id']; $page_id = @$params['page_id']; } else { $product_id = $arg_list[0]; $category_id = $arg_list[0]; $page_id = $arg_list[0]; } $output = ""; switch ($entity) { case 'attribute': if (empty($arg_list) || !array_key_exists(0, $arg_list) || !array_key_exists(1, $arg_list)) { break; } $obj =& $application->getInstance('Catalog'); $attributeInfo = $obj->getAttributeInfo($arg_list[0], $arg_list[1]); $output = $attributeInfo[strtolower($attr)]; break; case 'productreviews': if ($product_id == -1) { break; } loadClass('CProductReviewInfo'); $prcrobj = new CProductReviewInfo($product_id); if ($prcrobj !== null) { $output = $prcrobj->getReviewTagValue($attr); } break; case 'cmspage': if (!$page_id) { // trying to get the page_id from the request $page_id = modApiFunc('Request', 'getValueByKey', 'page_id'); } loadClass('CCMSPageInfo'); $cmspageobj = new CCMSPageInfo($page_id); $output = $cmspageobj->getCMSPageTagValue($attr, $arg_list); break; case 'product': if ($product_id == -1) { break; } $prdobj = new CProductInfo($product_id); if ($prdobj !== null) { $output = $prdobj->getProductTagValue($attr); } break; case 'manufacturer': $mnf_id = __info_tag_output_find_tag_params($entity, $arg_list); $mnf_info = modApiFunc("Manufacturers", "getManufacturerInfo", $mnf_id); if ($mnf_id == PARAM_NOT_FOUND || $mnf_id == MANUFACTURER_NOT_DEFINED || $mnf_info === NULL) { $output = NULL; } else { $img_info = modApiFunc("Images", "getImageData", $mnf_info['manufacturer_image_id']); switch ($attr) { case 'id': $output = $mnf_info['manufacturer_id']; break; case 'name': $output = $mnf_info['manufacturer_name']; break; case 'url': $output = $mnf_info['manufacturer_site_url']; break; case 'description': $output = $mnf_info['manufacturer_descr']; break; case 'status': $output = $mnf_info['manufacturer_active'] == DB_TRUE ? getMsg('MNF', 'STATUS_ACTIVE') : getMsg('MNF', 'STATUS_INACTIVE'); break; case 'image': $output = $img_info['image_data'] === NULL ? "" : getimage_output_cz('mnf_image_' . rand(0, 32768), new image_obj($img_info['image_data']['image_id'])); break; case 'imagesrc': $output = $img_info['image_data'] === NULL || !isset($img_info['image_data']) ? "" : $img_info['image_data']['image_src']; break; case 'imagewidth': $output = $img_info['image_data'] === NULL || !isset($img_info['image_data']) ? "" : $img_info['image_data']['image_width']; break; case 'imageheight': $output = $img_info['image_data'] === NULL || !isset($img_info['image_data']) ? "" : $img_info['image_data']['image_height']; break; case 'imagealttext': $output = $img_info['image_data'] === NULL || !isset($img_info['image_data']) ? "" : $img_info['image_data']['image_alt_text']; break; case 'thumbnail': $output = $img_info['image_thumbnail_data'] === NULL || !isset($img_info['image_thumbnail_data']) ? "" : getimage_output_cz('mnf_image_' . rand(0, 32768), new image_obj($img_info['image_thumbnail_data']['image_id'])); break; case 'thumbnailsrc': $output = $img_info['image_thumbnail_data'] === NULL || !isset($img_info['image_thumbnail_data']) ? "" : $img_info['image_thumbnail_data']['image_src']; break; case 'thumbnailwidth': $output = $img_info['image_thumbnail_data'] === NULL || !isset($img_info['image_thumbnail_data']) ? "" : $img_info['image_thumbnail_data']['image_width']; break; case 'thumbnailheight': $output = $img_info['image_thumbnail_data'] === NULL || !isset($img_info['image_thumbnail_data']) ? "" : $img_info['image_thumbnail_data']['image_height']; break; case 'thumbnailalttext': $output = $img_info['image_thumbnail_data'] === NULL || !isset($img_info['image_thumbnail_data']) ? "" : $img_info['image_thumbnail_data']['image_alt_text']; break; } } break; case 'category': if ($category_id == -1) { break; } $catobj =& $application->getInstance('CCategoryInfo', $category_id); if ($catobj !== null) { $output = $catobj->getCategoryTagValue($attr); } break; case 'msg': $obj =& $application->getInstance('MessageResources'); $output = $obj->getMessage(new ActionMessage($arg_list)); break; case 'xmsg': $obj =& $application->getInstance('MessageResources', modApiFunc("Modules_Manager", "getResFileByShortName", $arg_list[0]), 'AdminZone', $arg_list[0]); array_shift($arg_list); $output = $obj->getMessage(new ActionMessage($arg_list)); break; case 'label': $obj =& $application->getInstance('MessageResources', "", 'CustomerZone', "CZ"); $output = $obj->getMessage(new ActionMessage($arg_list)); break; case 'hinttext': $obj =& $application->getInstance('Hint'); $output = $obj->getHintText($arg_list); break; case 'hintlink': $obj =& $application->getInstance('Hint'); $output = $obj->getHintLink($arg_list); break; case 'storeowner': $obj =& $application->getInstance('Configuration'); $output = $obj->getTagValue($tag); break; case 'pagehelplink': loadCoreFile('page_help_tutorial_links.php'); $obj =& $application->getInstance('HelpLinkCreator'); $output = $obj->getPageHelpLink($arg_list[0]); break; case 'videotutoriallink': loadCoreFile('page_help_tutorial_links.php'); $obj =& $application->getInstance('HelpLinkCreator'); $output = $obj->getTutorialLink($arg_list[0]); break; case 'shoppingcart': $obj =& $application->getInstance('Cart'); $output = $obj->getCartInfo($tag); break; case 'paypalproexpresscheckout': $output = ""; break; case 'paypalproukexpresscheckout': $output = ""; break; case 'pageurl': $req = new Request(); $req->setView($arg_list[0]); if (isset($arg_list[1]) and is_array($arg_list[1]) and !empty($arg_list[1])) { foreach ($arg_list[1] as $k => $v) { $req->setKey($k, $v); } } if ($arg_list[0] == 'ProductList') { if (isset($arg_list[1])) { $category_id = $arg_list[1]; } if (!$category_id) { $plf = $application->getInstance('CProductListFilter'); $category_id = $plf->getCurrentCatgoryId(); $req->setCategoryID($category_id); } } $output = $req->getURL(); break; case 'customer': if ($zone == 'CustomerZone') { $account_name = modApiFunc('Customer_Account', 'getCurrentSignedCustomer'); if ($account_name != null) { preg_match('/^customer(.+)/i', $tag, $m1); if (preg_match('/^(billing|shipping|orders)(.+)/i', $m1[1], $m2)) { $group = $m2[1]; $attr = $m2[2]; } else { if (in_array(strtolower($attr), array('id', 'status'))) { $group = 'base'; } else { $group = 'Customer'; } $attr = $m1[1]; } $obj =& $application->getInstance('CCustomerInfo', $account_name); if (strtolower($attr) == 'accountname') { $output = prepareHTMLDisplay($obj->getDisplayAccountName()); break; } if (strtolower($attr) == 'signouturl') { $r = new Request(); $r->setView(CURRENT_REQUEST_URL); $r->setAction('customer_sign_out'); $r->setKeyValList(modApiFunc('Request', 'getGETArray')); $output = $r->getURL(); break; } if (strtolower($group) != 'orders') { $attr_value = $obj->getPersonInfo($attr, $group); switch (strtolower($attr)) { case 'country': $output = modApiFunc('Location', 'getCountry', $attr_value); break; case 'state': if (modApiFunc('Location', 'getStateCode', $attr_value) != '') { $output = modApiFunc('Location', 'getState', $attr_value); } else { $output = prepareHTMLDisplay($attr_value); } break; default: $output = prepareHTMLDisplay($attr_value); break; } } else { $qstat = ORDER_STATUS_ALL; if (isset($arg_list[0]) and is_string($arg_list[0])) { if (defined('ORDER_STATUS_' . strtoupper($arg_list[0]))) { $qstat = constant('ORDER_STATUS_' . strtoupper($arg_list[0])); } } $filter = array('type' => 'quick', 'order_status' => $qstat); $obj->setOrdersHistoryFilter($filter); switch (strtolower($attr)) { case 'quantity': $output = $obj->getOrdersCount(); break; case 'totalamount': $output = modApiFunc('Localization', 'currency_format', $obj->getOrdersAmount()); break; case 'totalfullypaidamount': $output = modApiFunc('Localization', 'currency_format', $obj->getOrdersFullyPaidAmount()); break; } } } } break; case 'subscription': loadClass('Subscriptions'); switch ($attr) { case 'active': if ($zone == 'CustomerZone') { $signed_in = modApiFunc('Customer_Account', 'getCurrentSignedCustomer') !== null; $topics = modApiFunc('Subscriptions', 'getCustomerTopics', $signed_in); $output = sizeof($topics) > 0 ? 'TRUE' : 'FALSE'; } } break; case 'unknown': switch ($attr) { case 'currentlanguage': $output = modApiFunc('MultiLang', 'getLanguage'); break; case 'resourcelanguage': $output = modApiFunc('MultiLang', 'getResourceLanguage'); break; case 'defaultlanguage': $output = modApiFunc('MultiLang', 'getDefaultLanguage'); break; } break; } echo $output; }
function out_ProductList() { $html_code = ''; if (!empty($this->affected['prods'])) { global $application; foreach ($this->affected['prods'] as $pr_id) { $obj = new CProductInfo($pr_id); if ($obj->isProductIdCorrect()) { $tags = array('ProductID' => $pr_id, 'ProductName' => $obj->getProductTagValue('Name'), 'jsControlPListFunc' => ' ' . str_replace(array('%PID%'), array($pr_id), $this->pb_obj->getControlPListFunction())); $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/", "prod_item.tpl.html", array()); } } } return $html_code; }
/** * Updates the cart contents. */ function onAction() { global $application; $request = $application->getInstance('Request'); $msgres = $application->getInstance("MessageResources", "messages"); $cart_id = $request->getValueByKey('cart_id'); $quantity_in_cart = $request->getValueByKey('quantity_in_cart'); if (!is_array($cart_id)) { $cart_id = array(0 => $cart_id); } if (!is_array($quantity_in_cart)) { $quantity_in_cart = array(0 => $quantity_in_cart); } if (is_array($cart_id)) { for ($i = 0; $i < sizeof($cart_id); $i++) { $obj_cart =& $application->getInstance('Cart'); if (!isset($obj_cart->CartContent[$cart_id[$i]])) { continue; } $quantity_in_cart[$i] *= 1; if (is_int($quantity_in_cart[$i]) && $quantity_in_cart[$i] > 0 && is_string($cart_id[$i]) && _ml_strlen($cart_id[$i]) > 2) { list($prod_id) = explode('_', $cart_id[$i]); $obj_product = new CProductInfo($prod_id); if ($obj_product->isProductIdCorrect() == false) { continue; } $stock_method = $obj_product->whichStockControlMethod(); $qty_in_stock = $obj_product->getProductTagValue('QuantityInStock', PRODUCTINFO_NOT_LOCALIZED_DATA); $sum_qty = $quantity_in_cart[$i]; // - Stock. if ($stock_method == PRODUCT_QUANTITY_IN_STOCK_ATTRIBUTE) { // , , if ($qty_in_stock != '' && $qty_in_stock < $sum_qty && modApiFunc("Configuration", "getValue", SYSCONFIG_STORE_ALLOW_BUY_MORE_THAN_STOCK) === false) { modApiFunc("Session", 'set', 'ShoppingCartResultMessage', cz_getMsg("ERR_NOT_ALLOWED_TO_BUY_MORE_THAN_IN_STOCK")); } else { // , "min order" - . $min_order = $obj_product->getProductTagValue('MinQuantity', PRODUCTINFO_NOT_LOCALIZED_DATA); if ($min_order != '' && $min_order > $sum_qty) { modApiFunc("Session", 'set', 'ShoppingCartResultMessage', $msgres->getMessage("ERR_NOT_ALLOWED_TO_BUY_LESS_THAN_MIN_ORDER", array($obj_product->getProductTagValue('MinQuantity')))); } else { modApiFunc('Cart', 'updateQuantityInCart', $cart_id[$i], $quantity_in_cart[$i]); } } } else { // , , $obj_cart =& $application->getInstance('Cart'); $options = $obj_cart->CartContent[$cart_id[$i]]['options']; $inv_id = modApiFunc("Product_Options", "getInventoryIDByCombination", 'product', $prod_id, $options); if ($inv_id != null) { $options_settings = modApiFunc("Product_Options", "getOptionsSettingsForEntity", 'product', $prod_id); $inv_info = modApiFunc('Product_Options', 'getInventoryInfo', $inv_id); if ($options_settings['AANIS'] == 'N' && $inv_info['quantity'] < $sum_qty && modApiFunc("Configuration", "getValue", SYSCONFIG_STORE_ALLOW_BUY_MORE_THAN_STOCK) === false) { modApiFunc("Session", 'set', 'ShoppingCartResultMessage', cz_getMsg("ERR_NOT_ALLOWED_TO_BUY_MORE_THAN_IN_STOCK", $obj_product->getProductTagValue('MinQuantity'))); } else { modApiFunc('Cart', 'updateQuantityInCart', $cart_id[$i], $quantity_in_cart[$i]); } } else { $options_settings = modApiFunc("Product_Options", "getOptionsSettingsForEntity", 'product', $prod_id); if ($options_settings['AANIC'] == 'Y') { modApiFunc('Cart', 'updateQuantityInCart', $cart_id[$i], $quantity_in_cart[$i]); } } } } } } $request = new Request(); $request->setView(CURRENT_REQUEST_URL); $application->redirect($request); }
/** * Adds the product to the cart. */ function onAction() { global $application; $request = $application->getInstance('Request'); $msgres = $application->getInstance("MessageResources", "messages"); // checking if wishlist product is being added $wl_id = $request->getValueByKey('wl_id'); if ($wl_id > 0) { $data = modApiFunc('Wishlist', 'getWishlistRecordCartData', $wl_id); if (!$data) { // invalid wishlist record... $request = new Request(); $request->setView('Wishlist'); $application->redirect($request); $this->setStatusError(); $this->setMessage('Invalid wishlist record'); } $options_sent = $data['options_sent']; $prod_id = $data['entity_id']; } else { $prod_id = $request->getValueByKey('prod_id'); $data = array('parent_entity' => 'product', 'entity_id' => $prod_id, 'options' => $request->getValueByKey('po'), 'qty' => $request->getValueByKey('quantity_in_cart'), 'colorname' => $request->getValueByKey('colorname')); $options_sent = $request->getValueByKey('options_sent'); } // setting qty=1 if quantity_in_stock is not specified if (!$data['qty'] && $data['qty'] !== 0) { $data['qty'] = 1; } if ($data['options'] == null) { $data['options'] = array(); } $result = modApiFunc('Cart', 'processPostedProductData', $data, $options_sent); if (!$result['is_error']) { if (!empty($result['stock_discarded_by_warning'])) { modApiFunc('Session', 'set', 'StockDiscardedBy', $result['stock_discarded_by_warning']); } $added = modApiFunc('Cart', 'addToCart', $result['data']); $cc = modApiFunc('Cart', 'getCartContent'); $cartPrice = ''; $cart_id = $prod_id . "_" . modApiFunc("Product_Options", "getCombinationHash", $result['data']['options']); if (!empty($cc)) { foreach ($cc as $product) { if ($product["CartID"] == $cart_id) { $cartPrice = modApiFunc("Localization", "format", $product["CartItemSalePrice"], "currency"); } } } $this->setStatusSuccess(); $p = new CProductInfo($prod_id); $message = array("<h2>" . $msgres->getMessage('CATALOG_PRODUCT_ADDED') . "</h2>" . "<div class='ajax_message_cart_prod_link'><a href='" . $p->getProductInfoLink($prod_id, $p->chooseCategoryID()) . "'>" . $p->getProductTagValue('name') . "</a></div>" . "<div class='ajax_message_cart_prod_qty'>" . $data['qty'] . " " . $msgres->getMessage('CATALOG_X') . " " . $cartPrice . "</div>"); // if a wishlist product is being added... if ($wl_id > 0 && $added) { modApiFunc('Wishlist', 'removeFromWishlist', $wl_id); $message[] = 'This product was removed from your Wishlist'; } $this->setMessage($message); $request = new Request(); $request->setView(CURRENT_REQUEST_URL); $application->redirect($request); } else { $this->setStatusError(); $message = array(); if ($result['discard_by'] != 'none') { modApiFunc('Session', 'set', 'OptionsDiscardedBy', $result['discard_by']); $message[] = $msgres->getMessage($result['discard_by']); } if ($result['stock_discarded_by'] != 'none') { modApiFunc('Session', 'set', 'StockDiscardedBy', $result['stock_discarded_by']); $message[] = $msgres->getMessage($result['stock_discarded_by']); } modApiFunc('Session', 'set', 'sentCombination', $result['data']['options']); $this->setMessage($message); $request = new Request(); $request->setView('ProductInfo'); $request->setAction('SetCurrentProduct'); $request->setKey('prod_id', $prod_id); $request->setProductID($prod_id); $p = new CProductInfo($prod_id); $request->setCategoryID($p->chooseCategoryID()); $application->redirect($request); } }
function processPostedProductData($data, $options_sent, $use_current_cart = true) { global $application; $prod_id = $data['entity_id']; $msgres = $application->getInstance("MessageResources", "messages"); // // , multiple select // : array_flip $for_for = array_keys($data['options']); for ($i = 0; $i < count($for_for); $i++) { if (is_array($data['options'][$for_for[$i]]) and !empty($data['options'][$for_for[$i]]) and isset($data['options'][$for_for[$i]][0]) and is_numeric($data['options'][$for_for[$i]][0])) { $new_arr = array(); for ($j = 0; $j < count($data['options'][$for_for[$i]]); $j++) { $new_arr[$data['options'][$for_for[$i]][$j]] = 'on'; } $data['options'][$for_for[$i]] = $new_arr; } } $is_error = false; $discard_by = 'none'; $stock_discarded_by = 'none'; $stock_discarded_by_warning = ''; $options_settings = modApiFunc("Product_Options", "getOptionsSettingsForEntity", 'product', $prod_id); $product_has_options = count(modApiFunc("Product_Options", "getOptionsList", 'product', $prod_id, USED_FOR_INV)) > 0; $add_to_cart_add_not_replace = modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_ADD_TO_CART_ADD_NOT_REPLACE); $obj_product = new CProductInfo($prod_id); $stock_method = $obj_product->whichStockControlMethod(); if ($stock_method == PRODUCT_QUANTITY_IN_STOCK_ATTRIBUTE) { // Quantity In Stock Attribute. $qty_in_stock = $obj_product->getProductTagValue('QuantityInStock', PRODUCTINFO_NOT_LOCALIZED_DATA); $qty_already_in_cart = modApiFunc('Cart', 'getProductQuantity', $prod_id); // $sum_qty , if ($add_to_cart_add_not_replace === true && $use_current_cart) { $sum_qty = $qty_already_in_cart + $data['qty']; } else { $sum_qty = $data['qty']; } if ($qty_in_stock != '' && $qty_in_stock < $sum_qty && $use_current_cart && modApiFunc("Configuration", "getValue", SYSCONFIG_STORE_ALLOW_BUY_MORE_THAN_STOCK) === false) { $is_error = true; $stock_discarded_by = $msgres->getMessage("ERR_NOT_ALLOWED_TO_BUY_MORE_THAN_IN_STOCK"); } elseif ($qty_in_stock != '' && $qty_in_stock < $sum_qty && $use_current_cart && modApiFunc("Configuration", "getValue", SYSCONFIG_STORE_ALLOW_BUY_MORE_THAN_STOCK) === true) { $stock_discarded_by_warning = $msgres->getMessage("WARNING_NOT_ALLOWED_TO_BUY_MORE_THAN_IN_STOCK"); } // , "min order" - . $min_order = $obj_product->getProductTagValue('MinQuantity', PRODUCTINFO_NOT_LOCALIZED_DATA); if ($min_order != '' && $min_order > $sum_qty) { $is_error = true; $stock_discarded_by = $msgres->getMessage("ERR_NOT_ALLOWED_TO_BUY_LESS_THAN_MIN_ORDER", array($obj_product->getProductTagValue('MinQuantity'))); } } $colorswatchvalue = modApiFunc('ColorSwatch', 'getColorSwatchInfo', $prod_id); if ($colorswatchvalue != '') { $datacolor = $data['colorname']; if ($datacolor == '') { $is_error = true; $discard_by = 'CLR_SWTCH_ERR_MSG'; } } // // if (!$is_error) { if ($options_sent != "yes") { if ($options_settings['AAWD'] == 'Y') { $data['options'] = modApiFunc("Product_Options", "getDefaultCombinationForEntity", 'product', $prod_id); $check_result = array(); } else { $check_result = array('WRN_ONS'); } } else { list($check_result, $data) = modApiFunc("Product_Options", "checkCombination", $data); } #_print($check_result);die; // if (!empty($check_result)) { $is_error = true; $discard_by = 'WRN_INVALID_OPTIONS'; foreach ($data['options'] as $oinf) { if (is_array($oinf) and array_key_exists('is_file', $oinf) and $oinf['val'] != '') { modApiFunc('Shell', 'removeDirectory', dirname($oinf['val'])); } } } else { $is_error = !modApiFunc("Product_Options", "checkByCRules", 'product', $prod_id, $data['options']); if ($is_error) { $discard_by = 'WRN_CI_CR'; } } //check if the file option can be uploaded (by allowed extensions) See Admin->FILE UPLOAD SETTINGS in admin area if (!$is_error) { $settings = modApiFunc("Settings", "getParamListByGroup", "FILE_UPLOAD_SETTINGS", "SETTINGS_WITH_DESCRIPTION"); $allowed = false; foreach ($data['options'] as $oinf) { if (is_array($oinf) && array_key_exists('is_file', $oinf) && $oinf['val'] != '') { $file_info = pathinfo($oinf['val']); foreach ($settings as $i => $s) { if ($s['param_current_value'] == "YES") { $exts = preg_replace("/, /", "|", $s['description']); $exts = preg_replace("/[.]/", "\\.", $exts); $res = preg_match("/{$exts}/", strtolower($file_info['basename']), $m); if ($res) { // file extension is alowed $allowed = true; break; } else { // not allowed extension $allowed = false; } } } if (!$allowed) { $is_error = true; $discard_by = 'WRN_CI_EXT'; } } } } // Inventory // AANIC - Allow Add the product to the cart Not in Inventory Control if (!$is_error && $options_settings['AANIC'] == 'N' && $stock_method == PRODUCT_OPTIONS_INVENTORY_TRACKING) { $inv_id = modApiFunc("Product_Options", "getInventoryIDByCombination", 'product', $prod_id, $data['options']); if ($inv_id == null) { $is_error = true; $discard_by = 'WRN_CI_INV'; } } // // AANIS - Allow Add the product to the cart Not In Stock if (!$is_error && $options_settings['AANIS'] == 'N' && $stock_method == PRODUCT_OPTIONS_INVENTORY_TRACKING) { $inv_id = modApiFunc("Product_Options", "getInventoryIDByCombination", 'product', $prod_id, $data['options']); if ($inv_id != null) { // , inventory $inv_info = modApiFunc('Product_Options', 'getInventoryInfo', $inv_id); if ($inv_info['quantity'] <= 0 && $use_current_cart) { $is_error = true; $discard_by = 'WRN_CI_INV'; } } } // , , inventory tracking if (!$is_error && $stock_method == PRODUCT_OPTIONS_INVENTORY_TRACKING && $use_current_cart && modApiFunc("Configuration", "getValue", SYSCONFIG_STORE_ALLOW_BUY_MORE_THAN_STOCK) === false) { $inv_id = modApiFunc("Product_Options", "getInventoryIDByCombination", 'product', $prod_id, $data['options']); if ($inv_id != null) { // , $cart_id = $prod_id . "_" . modApiFunc("Product_Options", "getCombinationHash", $data['options']); $obj_cart =& $application->getInstance('Cart'); if (isset($obj_cart->CartContent[$cart_id])) { $qty_already_in_cart = $obj_cart->CartContent[$cart_id]['quantity']; } else { $qty_already_in_cart = 0; } // if ($add_to_cart_add_not_replace === true) { $sum_qty = $qty_already_in_cart + $data['qty']; } else { $sum_qty = $data['qty']; } if ($options_settings['AANIS'] == 'Y') { $inv_info = modApiFunc('Product_Options', 'getInventoryInfo', $inv_id); } if ($options_settings['AANIS'] == 'N' && $inv_info['quantity'] < $sum_qty) { $is_error = true; $stock_discarded_by = $msgres->getMessage("ERR_NOT_ALLOWED_TO_BUY_MORE_THAN_IN_STOCK"); } } } } return array('data' => $data, 'is_error' => $is_error, 'discard_by' => $discard_by, 'stock_discarded_by' => $stock_discarded_by, 'stock_discarded_by_warning' => $stock_discarded_by_warning); }
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; } }
/** * Prepares an email text and the subject to send. */ function prepareEmailTextAndSubject() { global $application; $this->customerEmail = null; $this->product_obj = null; $pushedCurrency = false; switch ($this->actionId) { case '1': case '2': case '3': case '4': case '5': case '16': $pushedCurrency = true; $currencyId = modApiFunc("Localization", "whichCurrencyToDisplayOrderIn", $this->orderId); $orderInfo = modApiFunc("Checkout", "getOrderInfo", $this->orderId, $currencyId); modApiFunc("Localization", "pushDisplayCurrency", $currencyId, $currencyId); $customer_id = $orderInfo['PersonId']; $account_name = modApiFunc('Customer_Account', 'getCustomerAccountNameByCustomerID', $customer_id); $this->customer_obj =& $application->getInstance('CCustomerInfo', $account_name); // $this->customerEmail = $this->customer_obj->getPersonInfo('Email','Customer'); $taxExemptEnabled = modApiFunc('Settings', 'getParamValue', 'TAXES_PARAMS', 'ALLOW_FULL_TAX_EXEMPTS'); $taxExemptInfo = modApiFunc("TaxExempts", "getOrderFullTaxExempts", $this->orderId, false); break; case '6': // if(array_key_exists('Email',$this->customerRegData['info'])) // $this->customerEmail = $this->customerRegData['info']['Email']; $this->customer_obj =& $application->getInstance('CCustomerInfo', $this->customerRegData['account']); break; case '7': case '8': case '9': case '10': case '11': case '12': case '13': $this->customer_obj =& $application->getInstance('CCustomerInfo', $this->customerAccount); // $this->customerEmail = $this->customer_obj->getPersonInfo('Email','Customer'); break; case '14': $this->product_obj =& $application->getInstance('CProductInfo', $this->inventory_info['entity_id']); break; case '15': $this->product_obj =& $application->getInstance('CProductInfo', $this->review_data['product_id']); break; case '18': $this->customer_obj =& $application->getInstance('CCustomerInfo', $this->customerAccount); $this->product_obj =& $application->getInstance('CProductInfo', $this->review_data['product_id']); break; } // reloading the notification info since it may be different for each language $this->getNotificationInfo($this->notificationId); $tagsList = modApiFunc("Notifications", "getAvailableTagsList", array('0' => array('Id' => $this->actionId))); //initialize infotags $infotags = array(); foreach ($tagsList[$this->actionId]['InfoTags'] as $infotag) { if (_ml_strpos($infotag, "Order") == 1) { $tag = _ml_substr($infotag, 6, _ml_strlen($infotag) - 7); switch ($tag) { case 'Date': $infotags[$infotag] = modApiFunc("Localization", "date_format", $orderInfo[$tag]); break; case 'GlobalDiscount': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo['Price']['SubtotalGlobalDiscount']); break; case 'PromoCodeDiscount': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo['Price']['SubtotalPromoCodeDiscount']); break; case 'QuantityDiscount': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo['Price']['QuantityDiscount']); break; case 'DiscountedSubtotal': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo['Price']['DiscountedSubtotal']); break; case 'TotalShippingAndHandlingCost': $ShippingCost = $orderInfo['Price']['TotalShippingAndHandlingCost'] == PRICE_N_A ? 0.0 : $orderInfo['Price']['TotalShippingAndHandlingCost']; $infotags[$infotag] = modApiFunc("Localization", "currency_format", $ShippingCost); break; case 'Tax': $infotags[$infotag] = ""; $taxes = array(); foreach ($orderInfo['Price'] as $key => $value) { $tax_name_patern = "/^Taxes\\['(.+)'\\]\$/"; $matches = array(); if (preg_match($tax_name_patern, $key, $matches)) { $taxes[$matches[1]] = $value; } } foreach ($taxes as $name => $value) { $infotags[$infotag] .= $name . " " . modApiFunc("Localization", "currency_format", $value) . "\n"; } break; case 'OldStatus': if ($this->actionId == '2') { $infotags[$infotag] = $this->OrderOldStatus; } break; case 'OldPaymentStatus': if ($this->actionId == '3') { $infotags[$infotag] = $this->OrderOldPaymentStatus; } break; case 'Total': case 'Subtotal': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo[$tag]); break; case 'PaymentMethodText': $pm_uid = $orderInfo['PaymentModuleId']; $infotags[$infotag] = modApiFunc("Checkout", "getPaymentMethodText", $pm_uid); break; case "PromoCode": $couponInfo = modApiFunc("PromoCodes", "getOrderCoupons", $this->orderId); if (isset($couponInfo[0]["coupon_promo_code"])) { $infotags[$infotag] = $couponInfo[0]["coupon_promo_code"]; } else { $infotags[$infotag] = ""; } break; case "TaxExptMark": if ($taxExemptEnabled == "true" && isset($taxExemptInfo[0]["exempt_status"]) && $taxExemptInfo[0]["exempt_status"] == "true") { $infotags[$infotag] = getMsg("SYS", "FULL_TAX_EXEMPT_YES_MSG"); } else { $infotags[$infotag] = getMsg("SYS", "FULL_TAX_EXEMPT_NO_MSG"); } break; case "TaxExptAmount": if ($taxExemptEnabled == "true" && isset($taxExemptInfo[0]["exempt_status"]) && $taxExemptInfo[0]["exempt_status"] == "true") { $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo["Price"]["OrderTaxTotal"]); } else { $infotags[$infotag] = modApiFunc("Localization", "currency_format", "0.0000"); } break; case "TaxExptInput": if ($taxExemptEnabled == "true" && isset($taxExemptInfo[0]["exempt_status"]) && $taxExemptInfo[0]["exempt_status"] == "true") { $infotags[$infotag] = $taxExemptInfo[0]["exempt_reason_customer_input"]; } else { $infotags[$infotag] = ''; } break; case 'OrderTotalToPay': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo['Price']['OrderTotalToPay']); break; case 'OrderTotalPrepaidByGC': $infotags[$infotag] = modApiFunc("Localization", "currency_format", $orderInfo['Price']['OrderTotalPrepaidByGC']); break; default: $infotags[$infotag] = $orderInfo[$tag]; break; } } elseif (_ml_strpos($infotag, 'CustomerReview') == 1) { $tag = _ml_substr($infotag, 15, _ml_strlen($infotag) - 16); $tag_value = ''; if ($this->review_data) { switch ($tag) { case 'Date': $tag_value = $this->review_data['date']; break; case 'Time': $tag_value = $this->review_data['time']; break; case 'Author': $tag_value = _ml_substr($this->review_data['author'], 0, 56) . (_ml_strlen($this->review_data['author']) > 56 ? '...' : ''); break; case 'IP': $tag_value = $this->review_data['ip_address']; break; case 'Status': if ($this->review_data['status'] == 'A') { $tag_value = getMsg('CR', 'CR_STATUS_APPROVED'); } elseif ($this->review_data['status'] == 'P') { $tag_value = getMsg('CR', 'CR_STATUS_PENDING'); } else { $tag_value = getMsg('CR', 'CR_STATUS_NOTAPPROVED'); } break; case 'Text': $tag_value = $this->review_data['review']; break; case 'OverallRating': $tag_value = getMsg('CR', 'CR_RECORD_NO_RATE'); if (is_array($this->review_data['rating']) && !empty($this->review_data['rating'])) { $sum = 0; foreach ($this->review_data['rating'] as $v) { $sum += $v['rate']; } $tag_value = sprintf("%.2f", $sum / count($this->review_data['rating'])); } break; } } $infotags[$infotag] = $tag_value; } elseif (_ml_strpos($infotag, "Customer") == 1) { $tag = _ml_substr($infotag, 9, _ml_strlen($infotag) - 10); $infotags[$infotag] = $this->customer_obj->getPersonInfo($tag, 'Customer'); switch (_ml_strtolower($tag)) { case 'country': $infotags[$infotag] = modApiFunc('Location', 'getCountry', $infotags[$infotag]); break; case 'state': if (modApiFunc('Location', 'getStateCode', $infotags[$infotag]) != '') { $infotags[$infotag] = modApiFunc('Location', 'getState', $infotags[$infotag]); } else { $infotags[$infotag] = $infotags[$infotag]; } break; } } elseif (_ml_strpos($infotag, "Shipping") == 1) { $tag = _ml_substr($infotag, 9, _ml_strlen($infotag) - 10); $infotags[$infotag] = isset($orderInfo['Shipping']['attr'][$tag]['value']) ? $orderInfo['Shipping']['attr'][$tag]['value'] : (isset($orderInfo['Shipping']['attr'][$tag . "NULL"]['value']) ? $orderInfo['Shipping']['attr'][$tag . "NULL"]['value'] : ""); } elseif (_ml_strpos($infotag, "Billing") == 1) { $tag = _ml_substr($infotag, 8, _ml_strlen($infotag) - 9); $infotags[$infotag] = isset($orderInfo['Billing']['attr'][$tag]['value']) ? $orderInfo['Billing']['attr'][$tag]['value'] : ""; } elseif (_ml_strpos($infotag, "StoreOwner") == 1) { $tag = _ml_substr($infotag, 11, _ml_strlen($infotag) - 12); switch ($tag) { case "StreetLine1": $infotags[$infotag] = modApiFunc("Configuration", "getValue", "store_owner_street_line_1"); break; case "StreetLine2": $infotags[$infotag] = modApiFunc("Configuration", "getValue", "store_owner_street_line_2"); break; case "SiteAdministratorEmail": $infotags[$infotag] = modApiFunc("Configuration", "getValue", "store_owner_site_administrator_email"); break; case "OrdersDepartmentEmail": $infotags[$infotag] = modApiFunc("Configuration", "getValue", "store_owner_orders_department_email"); break; case "Country": $infotags[$infotag] = modApiFunc("Location", "getCountry", modApiFunc("Configuration", "getValue", "store_owner_country")); break; case "State": $state = modApiFunc("Configuration", "getValue", "store_owner_state"); $states_in_country = modApiFunc("Location", "getStates", modApiFunc("Configuration", "getValue", "store_owner_country")); if (array_key_exists($state, $states_in_country)) { $infotags[$infotag] = modApiFunc("Location", "getState", $state); } else { $infotags[$infotag] = $state; } break; default: $infotags[$infotag] = modApiFunc("Configuration", "getValue", "store_owner_" . _ml_strtolower($tag)); break; } } elseif (_ml_strpos($infotag, "TrackingNumber") == 1) { $infotags[$infotag] = $orderInfo["TrackId"]; } elseif (_ml_strpos($infotag, 'AccountActivationLink') == 1) { $r = new Request(); $r->setView('AccountActivation'); $r->setAction('activate_account'); $r->setKey('key', modApiFunc('Customer_Account', 'getActivationKey', $this->customerAccount)); $infotags[$infotag] = $r->getURL(); } elseif (_ml_strpos($infotag, 'AccountName') == 1) { $infotags[$infotag] = $this->customerAccount; } elseif (_ml_strpos($infotag, 'AccountNewPasswordLink') == 1) { $cz_layouts = LayoutConfigurationManager::static_get_cz_layouts_list(); LayoutConfigurationManager::static_activate_cz_layout(array_shift(array_keys($cz_layouts))); $r = new CZRequest(); $r->setView('CustomerNewPassword'); $r->setKey('key', modApiFunc('Customer_Account', 'getActivationKey', $this->customerAccount)); $infotags[$infotag] = $r->getURL(); } elseif (preg_match('/^\\{combination(.+)\\}$/i', $infotag, $matches)) { $tag_value = ''; switch (_ml_strtolower($matches[1])) { case 'sku': $tag_value = $this->inventory_info['sku']; break; case 'quantityinstock': $tag_value = $this->inventory_info['quantity']; break; case 'description': $tag_value = modApiFunc('Product_Options', 'convertCombinationToString', modApiFunc('Product_Options', '_unserialize_combination', $this->inventory_info['combination']), '; '); break; default: $tag_value = ''; break; } $infotags[$infotag] = $tag_value; } elseif (preg_match('/^\\{product(.+)\\}$/i', $infotag, $matches) and $this->product_obj != null) { $infotags[$infotag] = $this->product_obj->getProductTagValue($matches[1], PRODUCTINFO_LOCALIZED_DATA); } elseif (_ml_strpos($infotag, 'GiftCertificateRecipient') == 1) { if ($this->gift_cert != null) { $infotags[$infotag] = $this->gift_cert->to; } } } //initialize blocktags foreach ($tagsList[$this->actionId]['BlockTags'] as $blocktagId => $blocktagInfo) { $infotags[$blocktagInfo['BlockTag']] = ""; switch ($blocktagInfo['BlockTag']) { case '{OrderContentBlock}': foreach ($orderInfo['Products'] as $productInfo) { # settings default values for all infotags foreach ($blocktagInfo['BlockInfoTags'] as $t) { $t = strtr($t, array('{' => '\\{', '}' => '\\}')); $init_productInfoTags[$t] = ""; } $productInfoTags = array("{ProductID}" => $productInfo['storeProductID'], "{ProductName}" => $productInfo['name'], "{ProductQuantity}" => $productInfo['qty'], "{ProductPrice}" => modApiFunc("Localization", "currency_format", $productInfo['SalePrice']), "{ProductAmount}" => modApiFunc("Localization", "currency_format", $productInfo['qty'] * $productInfo['SalePrice']), "{ProductOptions}" => modApiFunc("Product_Options", "prepareTextForNotificaton", $productInfo['options'])); $productInfoTags = array_merge($init_productInfoTags, $productInfoTags); foreach ($productInfo['attr'] as $attr => $attr_value) { if ($attr == "SalePrice" || $attr == "ListPrice" || $attr == "PerItemShippingCost" || $attr == "PerItemHandlingCost") { $productInfoTags["{Product" . $attr . "}"] = modApiFunc("Localization", "currency_format", $attr_value["value"]); } elseif ($attr == "FreeShipping" || $attr == "NeedShipping") { $productInfoTags["{Product" . $attr . "}"] = $attr_value["value"] == PRODUCT_FREESHIPPING_YES ? $this->MessageResources->getMessage("NTFCTN_INFO_YES_LABEL") : $this->MessageResources->getMessage("NTFCTN_INFO_NO_LABEL"); } else { $productInfoTags["{Product" . $attr . "}"] = $attr_value["value"]; } } foreach ($productInfo['custom_attributes'] as $custom_attr_info) { $productInfoTags["{Product" . $custom_attr_info["tag"] . "Custom}"] = $custom_attr_info["value"]; } $blocktag_body = $this->getNotificationBlockBody($blocktagId); foreach ($productInfoTags as $tag => $val) { $blocktag_body = str_ireplace($tag, $val, $blocktag_body); } $infotags[$blocktagInfo['BlockTag']] .= $blocktag_body . "\n"; } break; case '{LowLevelProductsBlock}': foreach ($orderInfo['Products'] as $productInfo) { if (!in_array($productInfo['storeProductID'], $this->_LowLevelProducts)) { continue; } $_productInfo = new CProductInfo($productInfo['storeProductID']); if ($_productInfo->whichStockControlMethod() == PRODUCT_OPTIONS_INVENTORY_TRACKING) { $productQuantityInStock = modApiFunc('Product_Options', 'getQuantityInStockByInventoryTable', 'product', $productInfo['storeProductID']); } else { $productQuantityInStock = $_productInfo->getProductTagValue('QuantityInStock', PRODUCTINFO_NOT_LOCALIZED_DATA); } $productLowLevelInStock = $_productInfo->getProductTagValue('LowStockLevel', PRODUCTINFO_NOT_LOCALIZED_DATA); $productInfoTags = array("{ProductID}" => $productInfo['storeProductID'], "{ProductName}" => $productInfo['name'], "{ProductPrice}" => modApiFunc("Localization", "currency_format", $productInfo['SalePrice']), "{ProductQuantityInStock}" => (string) $productQuantityInStock); foreach ($productInfo['attr'] as $attr => $attr_value) { if ($attr == "SalePrice" || $attr == "ListPrice" || $attr == "PerItemShippingCost" || $attr == "PerItemHandlingCost") { $productInfoTags["{Product" . $attr . "}"] = modApiFunc("Localization", "currency_format", $attr_value["value"]); } elseif ($attr == "FreeShipping" || $attr == "NeedShipping") { $productInfoTags["{Product" . $attr . "}"] = $attr_value["value"] == PRODUCT_FREESHIPPING_YES ? $this->MessageResources->getMessage("NTFCTN_INFO_YES_LABEL") : $this->MessageResources->getMessage("NTFCTN_INFO_NO_LABEL"); } else { if ($attr != "QuantityInStock") { $productInfoTags["{Product" . $attr . "}"] = $attr_value["value"]; } } } foreach ($productInfo['custom_attributes'] as $custom_attr_info) { $productInfoTags["{Product" . $custom_attr_info["tag"] . "Custom}"] = $custom_attr_info["value"]; } $blocktag_body = $this->getNotificationBlockBody($blocktagId); foreach ($productInfoTags as $tag => $val) { $blocktag_body = str_ireplace($tag, $val, $blocktag_body); } $infotags[$blocktagInfo['BlockTag']] .= $blocktag_body . "\n"; } break; case '{OrderDiscountsBlock}': $promoInfo = modApiFunc("PromoCodes", "getOrderCoupons", $this->orderId); $promoCode = isset($promoInfo[0]["coupon_promo_code"]) ? $promoInfo[0]["coupon_promo_code"] : ""; $discountsInfoTags = array("{OrderGlobalDiscount}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['SubtotalGlobalDiscount']), "{OrderPromoCode}" => $promoCode, "{OrderPromoCodeDiscount}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['SubtotalPromoCodeDiscount']), "{OrderQuantityDiscount}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['QuantityDiscount']), "{OrderDiscountedSubtotal}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['DiscountedSubtotal']), "{OrderSubtotal}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['OrderSubtotal']), "{OrderTotalToPay}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['OrderTotalToPay']), "{OrderTotalPrepaidByGC}" => modApiFunc("Localization", "currency_format", $orderInfo['Price']['OrderTotalPrepaidByGC'])); $blocktag_body = $this->getNotificationBlockBody($blocktagId); foreach ($discountsInfoTags as $tag => $val) { $blocktag_body = str_ireplace($tag, $val, $blocktag_body); } $infotags[$blocktagInfo['BlockTag']] .= $blocktag_body; break; case '{OrderDownloadLinksBlock}': $hotlinks = modApiFunc('Product_Files', 'getHotlinksListForOrder', $this->orderId); foreach ($hotlinks as $k => $hotlink_info) { $file_info = modApiFunc('Product_Files', 'getPFileInfo', $hotlink_info['file_id']); $HotlinkInfoTags = array("{DownloadLink}" => $hotlink_info['hotlink_value'], "{DownloadLinkExpiryDate}" => date("d M Y, H:i", $hotlink_info['expire_date']), "{DownloadLinkAttempts}" => $hotlink_info['max_try'], "{DownloadFilename}" => $file_info['file_name'], "{DownloadFileDescription}" => $file_info['file_descr']); $blocktag_body = $this->getNotificationBlockBody($blocktagId); foreach ($HotlinkInfoTags as $tag => $val) { $blocktag_body = str_ireplace($tag, $val, $blocktag_body); } $infotags[$blocktagInfo['BlockTag']] .= $blocktag_body; } break; case '{OrderedGiftCertificateBlock}': $gcs = array(); if ($this->gift_cert) { $gcs = array(modApiFunc("GiftCertificateApi", "getGiftCertificate", $this->gift_cert->code)); } else { if ($this->orderId) { $gcs = modApiFunc("GiftCertificateApi", "getGiftCertificatesForOrderId", $this->orderId); } } if (sizeof($gcs) > 0) { foreach ($gcs as $gc) { $GCInfoTags = array("{PurchasedGiftCertificateCode}" => $gc["gc_code"], "{PurchasedGiftCertificateMessage}" => $gc["gc_message"], "{PurchasedGiftCertificateAmount}" => modApiFunc("Localization", "currency_format", $gc["gc_amount"]), "{PurchasedGiftCertificateFrom}" => $gc["gc_from"], "{PurchasedGiftCertificateTo}" => $gc["gc_to"], "{PurchasedGiftCertificateType}" => $gc["gc_sendtype"]); $blocktag_body = $this->getNotificationBlockBody($blocktagId); foreach ($GCInfoTags as $tag => $val) { $blocktag_body = str_replace($tag, $val, $blocktag_body); } $infotags[$blocktagInfo['BlockTag']] .= $blocktag_body; } } break; case '{AppliedGiftCertificateBlock}': $gcs = modApiFunc("GiftCertificateApi", "getOrderGCs", $this->orderId); if (!empty($gcs) && is_array($gcs)) { foreach ($gcs as $i => $gc_data) { $gc = new GiftCertificate($gc_data['gc_code']); $GCInfoTags = array("{AppliedGiftCertificateCode}" => $gc->code, "{AppliedGiftCertificateMessage}" => $gc->message, "{AppliedGiftCertificateAmount}" => modApiFunc("Localization", "currency_format", $gc->amount), "{AppliedGiftCertificateFrom}" => $gc->from, "{AppliedGiftCertificateTo}" => $gc->to, "{AppliedGiftCertificateType}" => $gc->sendtype); $blocktag_body = $this->getNotificationBlockBody($blocktagId); foreach ($GCInfoTags as $tag => $val) { $blocktag_body = str_replace($tag, $val, $blocktag_body); } $infotags[$blocktagInfo['BlockTag']] .= $blocktag_body; } } break; } } $this->EmailText = $this->getNotificationBody(); $this->EmailSubject = $this->subject; foreach ($infotags as $tag => $val) { $this->EmailText = str_ireplace($tag, $val, $this->EmailText); $this->EmailSubject = str_ireplace($tag, $val, $this->EmailSubject); } $this->EmailText = $this->html_replace($this->EmailText); $this->EmailSubject = $this->html_replace($this->EmailSubject); if ($pushedCurrency) { modApiFunc("Localization", "popDisplayCurrency"); } }