Rename “my list” to “my order form” in the header and my account menu tree

Project: PAPL

_.extend(MenuTreeView.prototype, {
				getContext: _.wrap(MenuTreeView.prototype.getContext, function (fn) {
				var original_Ret = fn.apply(this, _.toArray(arguments).slice(1));
				try{				  
				  _.each(original_Ret.menuItems, function (line) {		
						
				   _.each(line.children, function (children) {							
					 if (children.id == "productlist_all") {	
											
			
					   var menuitems = line.children;

					//    console.log("menuitems", menuitems)
					//    console.log("menuitems", menuitems.length)
					var isLoggedIn = ProfileModel.ProfileModel ? ProfileModel.ProfileModel.getInstance().get('isLoggedIn'): ProfileModel.getInstance().get('isLoggedIn')
					// console.log('isLoggedIn', isLoggedIn);
					if(isLoggedIn == "T")
						{
					   var allmyListindex = _.findIndex(menuitems,
						function (num) {
							return num.id == "productlist_all";
						});
						// console.log('allmyListindex', allmyListindex)
						menuitems[allmyListindex].name = "All my order forms";
						var myListindex = _.findIndex(menuitems,
							function (num) {
								return num.id == "productlist_8";
							});
							// console.log('myListindex', myListindex)
							// console.log('myListindex', menuitems[myListindex].name)
							var changemyListname =  menuitems[myListindex].name;
							var newmyList = changemyListname.replaceAll('My list ', 'My order Form ');
							// console.log('newmyList', newmyList)
							menuitems[myListindex].name =  newmyList;
						
						  }
						}

							  })
							  })
							}
							catch (e) {
								console.log("err@menutreeView", e);
							
							}
							return original_Ret
							  })
						  });


						 

						  _.extend(HeaderMenuMyAccountView.prototype, {
							getContext: _.wrap(HeaderMenuMyAccountView.prototype.getContext, function (fn) {
							var original_Ret = fn.apply(this, _.toArray(arguments).slice(1));
							// console.log('original_Ret', original_Ret)					  
							try{				  
								_.each(original_Ret.entries, function (line) {		
								
								 _.each(line.children, function (children) {	
												
								  if (children.id == "productlist_all") {	
														  
						  
									 var menuitems = line.children;
			  
									//  console.log("menuitems", menuitems)
									//  console.log("menuitems", menuitems.length)
									 var allmyListindex = _.findIndex(menuitems,
									  function (num) {
										  return num.id == "productlist_all";
									  });
									//   console.log('allmyListindex', allmyListindex)
									  menuitems[allmyListindex].name = "All my order forms";
									  var myListindex = _.findIndex(menuitems,
										  function (num) {
											  return num.id == "productlist_8";
										  });
										//   console.log('myListindex', myListindex)
										//   console.log('myListindex', menuitems[myListindex].name)
										  var changemyListname =  menuitems[myListindex].name;
							var newmyList = changemyListname.replaceAll('My list ', 'My order Form ');
							// console.log('newmyList', newmyList)
							menuitems[myListindex].name =  newmyList;
									  
										}
									   
			  
											})
											})
										  }
										  catch (e) {
											  console.log("err@headermenutreeView", e);
											
										  }
										  return original_Ret
										})
									  });

Leave a comment

Your email address will not be published. Required fields are marked *