First making use of PaperClip.
On the Index File i have a list of the Products in the database.
What would be the best way to check if there is a image save in the database.
Paperclips fields are standard
So i thought i would be best to do a check on the image_file_name field.
So if it is null then show one image else if not null show another icon.
Any ideas here.
Managed to Solve it
If anyone is looking for this solution.
This will check any field if it is empty then display an image/icon and display another when not
<%= product.image_file_name? ? image_tag('imagesuccess.png') : image_tag('noimage.png')%>
Hope this helps Someone
Related
I need to display the description of the field "KNB1-CESSION_KZ" in transaction FBL5N.
For that I made an extension in structure FILITEXTS_AR with the desired Field CESSION_KZ and made a foreign key to the table TCESSION as descriped in KBA 363290.
I can now add the field to the header. But if I choose TEXT on the texttype nothing appears. It only works with VALUE.
Any advice?
Thanks
I debugged the programm to find out how other texts are loaded and came across the include "LFILITEXTSF01". I made the following enhancement at the end of the form "GET_TEXT" and it worked.
I know how to get an item of the particular table. Like for user we can have
$userItem = Engine_Api::_()->getItem("user", $userId);
or for a custom table
$customItem = Engine_Api::_()->getItem("custom", $customeId);
I want to know the code or method how can I make my $customItem to work the same way as $userItem works for users table. So that I can get data or manipulate the data of custom table
Thanks for your help. :-)
You can achieve that by creating a model. Check how it's done in /application/modules/User/Model. There is User.php file that declares User_Model_User and methods available for User such as getTitle, get Href etc.
You may use similar approach for your custom item. You will also need to create a file similar to /application/modules/User/Model/DbTable/User.php to declare table for your custom items.
I have a model which contains emails with some other fields.
I want a custom filter in Yii CGridView's advance search which when applied, lists only Invalid Email IDs (using regular expression '^[A-Z0-9._%-]+#[A-Z0-9.-]+\.[A-Z]{2,4}$')
Note: I dont want to add any column in CGridView
I hope to help you out,
you will need several things
the line for filtering in the column of your choice...(i recommend you create a new attribute for this, ask me in comments if you want to know more why.) this goes in the cgridview of course:
'filter'=>CHtml::activeCheckBox($model, $attributeEmail)
the condition in your search of function that brings up the model.
Supposing you have a criteria inside your search in your model wich help you with your filtering what you need is ...
if($this->EMAIL == TRUE)
{
$criteria->addCondition("\"t\".\"EMAIL\" email NOT LIKE '%_#__%.__%'");
}
Why not to use regex and make a KISS approach ? better read this first...
Sql script to find invalid email addresses
I'd be glad to hear your comments it is interesting question for yii dev's btw
i have almost completed a plugin. It is all working.
All i need to do is save the preference of the text field in the admin panel
does anyone know how this is done
i need to save and return saved data back to text field
osc_set_preference('name', 'value', 'section'); and osc_get_preference('name', 'section');
'section' by default is 'osclass' and I suggest you to change to something like 'myplugin' so it will be unique
Is there any way to the change the summary description that is displayed when Pagination is enabled on the gridx control?
It says 'Total 100' Whereas on the enhanced grid it would say 1-20 of 100 items
Can this description be tailored?
The docs say that "the user can specify the string to use to display", but it's not shown how to do this. Maybe poking around the source can help you out.
Also here's a similar question.