function outputLayoutConfigs() { global $application; $retval = ""; $config_array = LayoutConfigurationManager::static_get_cz_layouts_list(); if (sizeof($config_array) > 0) { $i = 1; foreach ($config_array as $layout_config_ini_path => $config) { LayoutConfigurationManager::static_activate_cz_layout($layout_config_ini_path); $request = new CZRequest(); $request->setView('ProductInfo'); $request->setAction('SetCurrentProduct'); $request->setKey('prod_id', "1"); $template_contents = array("LayoutN" => $i, "LayoutName" => $config["SITE_URL"], "CZStorefrontHref" => $config["SITE_URL"], "CZStorefrontProductInfoHref" => $request->getURL()); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $retval .= modApiFunc('TmplFiller', 'fill', "tools/cz_layouts/", "layout_config_item.tpl.html", array()); $i++; } } else { $retval .= modApiFunc('TmplFiller', 'fill', "tools/cz_layouts/", "layout_config_no_item.tpl.html", array()); } return $retval; }
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"); } }
function getTag($tag) { if ($tag == 'ProductInfoLink') { $cz_layouts = LayoutConfigurationManager::static_get_cz_layouts_list(); LayoutConfigurationManager::static_activate_cz_layout(array_shift(array_keys($cz_layouts))); $request = new CZRequest(); $request->setView('ProductInfo'); $request->setAction('SetCurrentProduct'); $request->setKey('prod_id', $this->product_id); $request->setProductID($this->product_id); return $request->getURL(); } return getKeyIgnoreCase($tag, $this->_Template_Contents); }
function getTag($tag) { global $application; switch ($tag) { case 'ProductInfoLink': $cz_layouts = LayoutConfigurationManager::static_get_cz_layouts_list(); LayoutConfigurationManager::static_activate_cz_layout(array_shift(array_keys($cz_layouts))); $request = new CZRequest(); $request->setView('ProductInfo'); $request->setAction('SetCurrentProduct'); $request->setKey('prod_id', $this->POST["product_id"]); $request->setProductID($this->POST["product_id"]); $value = $request->getURL(); break; case "ErrorIndex": $value = $this->_error_index; break; case "Error": $value = $this->_error; break; default: $value = getKeyIgnoreCase($tag, $this->_Template_Contents); if ($value === NULL) { $value = getKeyIgnoreCase($tag, $this->_Rate); } break; } return $value; }
/** * @ describe the function EditProductInfo->getTag. */ function getTag($tag) { global $application; $imagesUrl = $application->getAppIni('URL_IMAGES_DIR'); if ($application->getCurrentProtocol() == "https" && $application->getAppIni('HTTPS_URL_IMAGES_DIR')) { $imagesUrl = $application->getAppIni('HTTPS_URL_IMAGES_DIR'); } $value = null; switch ($tag) { case 'Items': $value = $this->getAttributes(); break; case 'InvEditorLink': $value = isset($this->_attr['InvEditorLink']) ? $this->_attr['InvEditorLink'] : ''; break; case 'Errors': $value = $this->getErrors(); break; case "Error_List": $value = $this->_error_list; break; case 'AttributeName': $value = $this->_attr['name']; break; case 'AttributeValue': $value = $this->_attr['value']; break; case 'AttributeValueEscaped': $value = $this->_attr['value_escaped']; break; case 'AttributeTag': $value = $this->_attr['tag']; break; case 'AttributeUnit': $value = $this->_attr['unit']; break; case 'AttributePatternType': $value = $this->_attr['pattern_type']; break; case 'AttributeFormat': $value = modApiFunc("Localization", "format_settings_for_js", $this->_attr['pattern_type']); break; case 'AttributeImageURL': // there appears a bug if this string is used - // $this->_attr['ImageURL']; $value = $imagesUrl . $this->ViewState['LargeImage']; break; case 'AttributeImageWidth': $value = $this->_attr['ImageWidth']; break; case 'AttributeImageHeight': $value = $this->_attr['ImageHeight']; break; case 'AttributeSize': $value = $this->_attr['size']; break; case 'AttributeMax': $value = $this->_attr['max']; break; case 'Counter': $value = $this->_counter; break; case 'AttributeSelectOptions': $value = ""; foreach ($this->_attr_options as $opt_value) { $this->_attr_option = $opt_value; $value .= $this->TemplateFiller->fill("catalog/product_edit/", "attr-select-option.tpl.html", array()); } break; case 'AttributeCheckboxes': $value = ""; foreach ($this->_attr_options as $opt_value) { $this->_attr_option = $opt_value; $value .= $this->TemplateFiller->fill("catalog/product_edit/", "attr-checkboxgroup-item.tpl.html", array()); } break; case 'AttributeNextCheckboxColumn': $value = $this->_attr_option['next_column']; break; case 'AttributeCheckedCheckbox': $value = $this->_attr_option['checked']; break; case 'AttributeDisabledCheckbox': $value = $this->_attr_option['disabled']; break; case 'AttributeWorldVisible': $value = @$this->_attr_option['world']; break; case 'AttributeCustomVisible': $value = @$this->_attr_option['custom']; break; case 'AttributeOptionValue': $value = $this->_attr_option['value']; break; case 'AttributeOptionSelected': if ($this->_attr_option['selected']) { $value = " selected"; } break; case 'AttributeOptionName': $name = $this->_attr_option['name']; $value = $this->_attr['tag'] != 'MembershipVisibility' ? prepareHTMLDisplay($name) : $name; break; case 'AddLink': $value = isset($this->_attr['additional_link']) ? $this->_attr['additional_link'] : ""; break; case 'AddLinkText': $value = isset($this->_attr['additional_link_text']) ? $this->_attr['additional_link_text'] : ""; break; case 'ViewStateLargeImage': $value = ''; if ($this->ViewState['LargeImage']) { $value = $imagesUrl . $this->ViewState['LargeImage']; } break; case 'ViewStateLargeImageWidth': $value = ''; if ($this->ViewState['LargeImage']) { $image_path = $application->getAppIni('PATH_IMAGES_DIR') . $this->ViewState['LargeImage']; $sizes = getimagesize($image_path); $value = $sizes[0]; } break; case 'ViewStateLargeImageHeight': $value = ''; if ($this->ViewState['LargeImage']) { $image_path = $application->getAppIni('PATH_IMAGES_DIR') . $this->ViewState['LargeImage']; $sizes = getimagesize($image_path); $value = $sizes[1]; } break; case 'ViewStateSmallImage': $value = ''; if ($this->ViewState['SmallImage']) { $value = $imagesUrl . $this->ViewState['SmallImage']; } break; case 'ViewStateSmallImageRelativePath': //Hidden Value $value = ''; if ($this->ViewState['SmallImage']) { $value = $imagesUrl . $this->ViewState['SmallImage']; } break; case 'ViewStateClose': $value = $this->ViewState['hasCloseScript']; break; case 'ErrorIndex': $value = $this->_error_index; break; case 'Error': $value = $this->_error; break; case 'SavedOkMessage': $value = $this->getSavedOkMessage(); break; case 'InputStyleClass': $classes = array(); if ($this->_error != '') { $classes[] = 'error'; } if ($this->allow_html) { $classes[] = 'tiny_mce'; } $value = implode(' ', $classes); break; case 'SubmitUploadImagesScript': $value = 'onclick="CatalogEditProduct.FormSubmitValue.value = \'UploadImages\';CatalogEditProduct.submit();disableButtons(new Array(\'SaveButton1\', \'SaveButton2\', \'CancelButton1\', \'CancelButton2\', \'UploadButton\'));return true;"'; break; case 'ImagesUploadErrorMessage': $value = $this->MessageResources->getMessage("SETUP_WARNING_IMAGE_FOLDER_IS_NOT_WRITABLE", array("0" => modApiFunc("Catalog", "getImagesDir"))); break; case 'UseWYSIWYGFor': $value = array(); foreach ($this->product_info['attributes'] as $view_tag => $attr) { // , PriceExcludingTaxes. if (isset($attr['allow_html'])) { if ($attr['allow_html'] && $attr['visible']) { $value[] = $view_tag; } } } $value = implode(', ', $value); break; case 'Breadcrumb': $obj =& $application->getInstance('Breadcrumb'); $value = $obj->output(false); break; case 'Local_ProductBookmarks': $value = getProductBookmarks('details', $this->prod_id, 'edit'); break; case 'CancelLink': $req = new Request(); $req->setView('Catalog_ProdInfo'); $req->setAction('SetCurrentProduct'); $req->setKey('prod_id', $this->prod_id); $value = $req->getURL(); break; case 'additionalJS': if (modApiFunc('Session', 'is_set', 'mustReloadParent')) { modApiFunc('Session', 'un_set', 'mustReloadParent'); $value = "if (window.opener && window.opener.document.ProductSearchForm && window.opener.document.ProductSearchForm.active && window.opener.document.ProductSearchForm.active.value == 'Y') window.opener.document.ProductSearchForm.submit(); else if (window.opener) window.opener.location.reload();\n"; } break; /*( case 'AutoGenSmallImageComment': $is_present_large_image = false; foreach($this->_group['attr'] as $attr_info) { if($attr_info['view_tag'] == 'LargeImage' and $attr_info['visible'] == 1) { $is_present_large_image = true; }; }; if($this->_attr['tag'] == 'SmallImage' and $is_present_large_image and $this->ViewState['LargeImage'] == '') { $pi_settings = modApiFunc('Product_Images','getSettings'); if($pi_settings['AUTO_GEN_MAIN_SMALL_IMAGE'] == 'Y' and function_exists('gd_info')) { $value = getMsg('PI','COMMENT_AUTO_GEN_SMALL_IMAGE'); }; }; */ /*( case 'AutoGenSmallImageComment': $is_present_large_image = false; foreach($this->_group['attr'] as $attr_info) { if($attr_info['view_tag'] == 'LargeImage' and $attr_info['visible'] == 1) { $is_present_large_image = true; }; }; if($this->_attr['tag'] == 'SmallImage' and $is_present_large_image and $this->ViewState['LargeImage'] == '') { $pi_settings = modApiFunc('Product_Images','getSettings'); if($pi_settings['AUTO_GEN_MAIN_SMALL_IMAGE'] == 'Y' and function_exists('gd_info')) { $value = getMsg('PI','COMMENT_AUTO_GEN_SMALL_IMAGE'); }; }; */ case 'AutoGenSmallImageComment': $is_present_large_image = false; foreach ($this->_group['attr'] as $attr_info) { if ($attr_info['view_tag'] == 'LargeImage' && $attr_info['visible'] == 1) { $is_present_large_image = true; $pi_settings = modApiFunc('Product_Images', 'getSettings'); if ($pi_settings['AUTO_GEN_MAIN_SMALL_IMAGE'] == 'Y' && function_exists('gd_info')) { $value = getMsg('PI', 'COMMENT_AUTO_GEN_SMALL_IMAGE'); } } } break; case 'ResultMessageRow': $value = $this->outputResultMessage(); break; case 'ResultMessage': $value = $this->_Template_Contents[$tag]; break; case 'ProductInfoLink': $cz_layouts = LayoutConfigurationManager::static_get_cz_layouts_list(); LayoutConfigurationManager::static_activate_cz_layout(array_shift(array_keys($cz_layouts))); $request = new CZRequest(); $request->setView('ProductInfo'); $request->setAction('SetCurrentProduct'); $request->setKey('prod_id', $this->prod_id); $request->setProductID($this->prod_id); $value = $request->getURL(); break; case 'NoImagePath': $value = $imagesUrl . 'noimage.png'; break; default: if (_ml_strpos($tag, 'Product') === 0) { // $tag = preg_replace('/_/', '', $tag); // $tag = preg_replace('/([A-Z]{1,})/', '_$1', $tag); // $arr = preg_split('/_/', $tag, -1, PREG_SPLIT_NO_EMPTY); // $entity = _ml_strtolower(array_shift($arr)); // $tag = implode('', $arr); $tag = _ml_substr($tag, _ml_strlen('Product')); if (array_key_exists($tag, $this->POST)) { $value = $this->POST[$tag]; } } if (_ml_strpos($tag, 'Group') === 0) { // $tag = preg_replace('/_/', '', $tag); // $tag = preg_replace('/([A-Z]{1,})/', '_$1', $tag); // $arr = preg_split('/_/', $tag, -1, PREG_SPLIT_NO_EMPTY); // $entity = _ml_strtolower(array_shift($arr)); // $tag = _ml_strtolower(implode('', $arr)); $tag = _ml_strtolower(_ml_substr($tag, _ml_strlen('Group'))); if (array_key_exists($tag, $this->_group)) { $value = $this->_group[$tag]; } } break; } return $value; }
/** * 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"); } }