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; }