Hide a field on changing of Ticket Status in Vtiger - vtiger

Hi I want to Hide Some Fields like Ticket solution when Ticket Status is changed to open. How to do it ?

Adding to the above comments , you can also copy Edit.js inside layouts > v7 > modules > Helpdesk > resources from some other layout. There you can write your own code inside registerEventForPicklistDependencySetup function. Dont forget to remove other unwanted functions.

I would recommend using javascript for that task. Use a jquery selector to retrieve the value of ticketstatus and hide the container of the solution field if depending on the status.

You can use jQuery to perform the task. In vTigerCRM the actual name of the ticket module is HelpDesk. So to change the detail view of ticket module you need to edit layouts/vlayout/modules/HelpDesk/DetailViewHeaderTitle.tpl
file. For your reference, I am providing you with a sample.

Related

Sitecore Glass.Mapper error when item is not available

We have a Sitecore site that's using Glass.Mapper. We also have a simple two step workflow, "Draft > Ready for publish" on all items. There are global items, which are promos that can be placed on pages. Authors create promos, then create pages and place the promos on the pages.
If a page is published but a promo hasn't been published, the page returns this error:
Constructor on type 'OurSite.Sitecore.Models.IPromo' not found.
Since the scenario of authors failing to publish new promos is a real one, I would like to prevent this error from happening, so that the page just renders without the promo. Thoughts?
Another option would be to validate the datasource of components in the getRenderer pipeline. Marek has blogged about this with a solid solution:
http://www.skillcore.net/sitecore/sitecore-automated-validation-of-mvc-rendering-datasource
This also handles the scenario where components without datasource (ie. item was deleted) break the page in PageEditor.
That being said I also believe that in addition you should have a proper exception strategy as well. The link Jim Noellsch posted is a good one. I recall this one from Charlie Turano to be a solid one as well:
http://www.hhogdev.com/blog/2015/june/mvc-rendering-exception-handler.aspx
Assuming IPromo is an interface, convert it to a class model Promo. If this is an MVC solution, you could also override the OnException method to quietly suppress missing content.

Sitecore Conditional Showing of Fields

So I am rather new to sitecore, and it's a topic that wasn't covered during my training. My questions is just to help point me to the correct term, or documentation on a method to do the following.
I have a definition item, with a ton of field groups, what I want to do is something like:
if Value of Field X is "yes" then collapse/hide Field X or Field Group X.
Does that make sense? Is it a validation rule? or some other kind of rules, is it a workflow I need to attach? Do you place it on just the field I want to hide, or the field that triggers the action?
I appreciate any guidance.
There is nothing out-of-the-box in Sitecore to achieve what you want but there is no reason you cannot create a composite custom field type to do this. The following articles will help you achieve this:
Creating a custom Sitecore Field
Getting to Know Sitecore: Custom Fields, Part 1
Create a new control, inheriting either from Droplist (if the comparison of the value is to be text based) or Droplink (for comparison of ID). You could add a parameter in the Source field of the control to specify what the values that trigger the hide should be.
The underlying control in the Content Editor is just a standard HTML select element. Add onchange events to the control and add your Javascript handler to hide the other controls. Since I could not find a way of adding additional custom css classes to the Sitecore controls, it would be best/easiest to hide all other controls in the same collapsible group after you control. This would mean you would need to group your controls better (or logically at least).
The Javascript will be something like this (the Content Editor uses the Prototype JS framework):
if ($(this).getValue() == 'no') {
// find the parent container of this control and then hide all the next siblings in the same group
$(this).up('.scEditorFieldMarker').nextSiblings('.scEditorFieldMarker').invoke('hide');
}
You can test this by running the above in the console, change out the keyword this with the id of your field, e.g. $('FIELD2292054').
What I am not sure about is how to trigger the hide on initial load, i.e. when someone returns to an existing item, it may be possible by adding to one of the pipelines, but would be better using a JS solution if possible. I'll have a think about this and get a proper code sample up over the next few days.
EDIT: You can add an event handler to sc:contenteditorupdated to handle the content editor being rel-oaded.
document.observe("sc:contenteditorupdated", myFunction);
I wrote up a blog post and put the code on GitHub if you are interested.
Not sure if you have come across Andy Uzick's this blog post.
He wisely talks about hiding fields in the Content Editor and has also created a Sitecore Module called Hide Field Template Extension which is hosted on the Sitecore Marketplace with the full source code to extend.
After reading through and trying the extension, I do feel that it will not completely resolve your issue (how you have described it in the question).
But it will give you:
A mid-term solution to hide a few unnecessary field that some content editors would not like to view.
Fields that are only required by administrators for admin purpose - to de-clutter these fields could be hidden.
Just one thing to bear in mind that it mentions in the requirements Sitecore 6.5 & 6.6. I have not tested it in Sitecore 7. If you are using Sitecore 7, which I think you are, one could modify the source code and make it work for Sitecore 7.
Have a look and share your findings.
Happy Sitecoring!

Disable product returns feature in opencart

My client doesn't accept returns. Is there any way to disable this returns feature without modifying the template files?
AFAIK the answer is no. You have to either edit the template and/or use VQmod to alter the code where returns are refered to.
But there is no option in admin where you can disable product returns
VERY Easy solution....just go to your cpanel and then: /catalog/language/english/common/footer.php
There you will find a list including: "Returns"....just delete that line and click save and it will be gone.
just add:
$this->response->redirect($this->url->link('account/account', '', 'SSL'));
In the beginning of every class method of catalog/controller/account/return
You also have to disable the links shown in the account and footer
In the newer versions of OC (3.x), this can be done by editing the footer template under the "edit themes" section in the admin control panel:
Go to the admin control panel.
Under "Design", select the theme editor.
From the list, select Common->footer.twig.
Inside "footer.twig" search for this line: <li>{{text_return }}</li> and remove it.
Save your changes.

Are workflow comments customizable?

Does anyone know of any way to customise the Workflow Comments box that appears in Sitecore if you enable the "comments" option?
I'm looking to extend this a little ... but can't see this referenced in any sitecore javascript or shell files - I'm guessing I will need to build a custom dialog in its entirety to implement the functionality I want, but not 100% where to start!
We ended up putting a solution in place that, broadly, composes of a custom action, containing the relevant form that we need. The information that the user submitted was then parsed, and passed to the workflow as comments (this particular workflow command was hidden from users, so they had to go through our custom one).
Not ideal, but works!

How can I use a content source field in tumblr custom HTML theme?

I'm trying to create a custom HTML theme in tumblr.com I'd like to use a content source field which is highlighted on image - http://i.stack.imgur.com/5xkM5.jpg
For example I want to place a custom discription below a post:
> Original post you can see <a
> href="$content_source_field">hire
Please help me with code for my theme.
The variable that use "$content_source_field" is something that tumblr will automatically determine, you don't need to set it to anything specific.
In order for tumblr to know which URL to use (either the content source or the post entry), you'll need to use {LinkURL} as the href value.
Use {block:ContentSource} variable for this. If you define it, tumblr won't override it. Dont forget to add a {block:RebloggedFrom} variable too; otherwise tumblr will add the via {some resource} automatically:
{block:ContentSource}
Original post you can see here
via {block:RebloggedFrom}{ReblogParentTitle}{/block:RebloggedFrom}
{/block:ContentSource}