Date field do not display dropdown in popup of SugarCRM - php

Hy Guys!
I am facing a problem regarding datetime field display in Popup. If i add a datetime field to Advanced Search of ProspectLists it get displayed as shown below and works perfectly:
in the custom modules ProspectLists searchdefs advanced_search array it is defined as :
array (
'type' => 'datetime',
'label' => 'LBL_DATE_ENTERED',
'width' => '10%',
'default' => true,
'name' => 'date_entered', ),
but when i try to select a ProspectList from a Prospect List subpanel in Campaigns, the popup that gets displayed render the date field with out dropdown as shown below:
The other problem is this that when i perform search from popup for a specific date it displays nothing.
I am using SugarCRM CE 6.5.11.
Any idea how to display dropdown with date field.?

In method SugarFieldBase::isRangeSearchView you should check condition
$_REQUEST['action']!='Popup'
File include/SugarFields/Fields/Base/SugarFieldBase.php
I remove it from conditions.
protected function isRangeSearchView($vardef)
{
//return !empty($vardef['enable_range_search']) && !empty($_REQUEST['action']) && $_REQUEST['action']!='Popup';
return !empty($vardef['enable_range_search']) && !empty($_REQUEST['action']);
}

I think what you're looking for is the "Ranged Search" attribute.
You can enable it in studio by going to the custom field and checking the "Enable Range Search" checkbox.
Or, you can edit the custom/modules/{module}/metadata/SearchFields.php and add the following to the field in question:
'enable_range_search' => true

Related

Wordpress page title fxn in echo p

This is probably super simple but I just cant seem to figure it out.
How can I pass the current Wordpress page title into this code?
Below is a snippet from Formidable Forms WP plug-in which basically prints statistics from forms within my website.
In this case, the # of entries for a specific form (55jqi) and a specific field(50) are displayed on the pages, showing how many other people also submitted that form.
Im trying to skip needing to update each page (4,380 pages) with the stats output snippet.. and instead call the current page into the stats display code, to show stats for that particular page being viewed.. using an elementor custom post type template.
I need this:
echo FrmProStatisticsController::stats_shortcode(array('id' => '55jqi', 'type' => 'count', 50 => 'runtz'));
To work like this:
echo FrmProStatisticsController::stats_shortcode(array('id' => '55jqi', 'type' => 'count', 50 => 'single_post_title();'));
Replace the input area ‘Runts’ with the current page title, using
single_post_title()
Or similar.
Any help would be amazing!!
There is also a short code available which works the similarly.
[frm-stats id=55jqi type=count 50="Runtz"]
Formidable Forms Plugin shortcode and php page for reference: https://formidableforms.com/knowledgebase/add-field-totals-and-statistics/#kb-field-filters
You are using single_post_title function in a wrong way. By default, this function will echo the output but in the shortcode, you need to return the output.
This function accepts 2 param: 1: $prefix 2: $display
You need to pass $display as false, which will tell the function to return the value.
so you'll have to make a call like this `single_post_title( '', false )``
and your shortcode call will be like this:
echo FrmProStatisticsController::stats_shortcode(
array(
'id' => '55jqi',
'type' => 'count',
'50' => single_post_title( '', false ),
)
);

Show/Hide Grid View Action Column Based On Condition - Yii2

I was trying to show/hide ActionColumn based on some condition.
In my system, 2 roles are defined : Primary & Secondary. I wanted to hide ActionColumn for Role Secondary and to show ActionColumn for Role Primary.
I got one visible attribute option from $visible. Where, 'visible'=> true and 'visible'=> false are working properly.
<?
[
'class' => 'yii\grid\ActionColumn',
'visible' => false,
.
.
.
]
But, Problem is: I wanted to set visible option as True / False dynamically based on some condition.
<?
[
'class' => 'yii\grid\ActionColumn',
'visible' => function ($data) {
if (Yii::$app->userinfo->hasRole([AR::ROLE_PRIMARY])) {
return true;
}
if (Yii::$app->userinfo->hasRole([AR::ROLE_SECONDARY])) {
return false;
}
},
.
.
.
]
I tried in this way too. But, didn't got luck. Any help/hint/suggestion is appreciable.
I searched Yii2 GridView hide column conditionally.
You can't set visible to a callable, although there is nothing to stop you setting a variable before calling the gridview.
In this case though, visibility is only dependant on whether they have the primary role, you can just use:
'visible' => Yii::$app->userinfo->hasRole([AR::ROLE_PRIMARY])
You can use conditional statement to hide particular checkbox in grid view
Here is simple code which works for me
[
'class' => 'yii\grid\CheckboxColumn',
'checkboxOptions' => function($dataProvider) {
return ["value" => ($dataProvider['tiIsPaid'] == 0)?$dataProvider['iDriverEarningId']:'',"style"=>($dataProvider['tiIsPaid'] == 0)?'':'display:none'];},
]
Here i have used simple logic to hide checkbox for particular column
Set value null or blank so it can not be selected when you click on select all checkbox
Hide check box using display none property of css
Hope this help you in hiding particular column based on your conditions.

how to display customly added attribute columns value in the frontend of magento

I recently added a 'tooltip description' column to an attribute. I used this following code
$fieldset->addField('tooltip', 'text', array(
'name' => 'tooltip',
'label' => Mage::helper('catalog')->__('Tooltip'),
'title' => Mage::helper('catalog')->__('Tooltip')
));
to add a field in my app\code\core\Mage\Adminhtml\Block\Catalog\Product\Attribute\Edit\Tab\Main.php. This adds the extra field to the attribute-edit screen. I also added a column with type TEXT in the eav_attribute table to make sure the property gets saved when editing your attribute. And it worked perfectly in the backend. See the following Image:
Now I want to show the Tooltip Description value in frontend where the attributes value are shown....say in attributes.phtml page. So what is the code to dispaly it in frontend.
Try following
<?php
foreach ($this->getAttributes() as $_attribute){
echo $_attribute->getTooltip();
}
?>
UPDATE
$attribute_code = $_data['code'];
$attribute_details = Mage::getSingleton("eav/config")->getAttribute('catalog_product', $attribute_code);
$attribute = $attribute_details->getData(); // returns array
echo "<pre>";
print_r($attribute);

Add product selection widget to custom attribute in Magento

Does anyone know how can I add a custom product attribute with a widget renderer?
You can see this in Promo rules if you select SKU you'll got an Ajax popup with product selection.
so how would I go about it?
in :
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY...
In other words, how can I use a widget to select custom attribute values?
EDIT:
The scenario is as follows:
I would like to create a product attribute that will, upon a button click, open a product selection widget.
After the selection, the selected SKU's will go in in a comma delimited format.
This behavior can be seen in the catalog and shopping cart price rules.
If you filter the rule by SKU (SKU attribute must be enabled to "apply to rules"), you'll get a field and a button that will open the product selection widget.
Here is some thoughts that should get you going on the right track:
First, in a setup script, create your entity:
$installer->addAttribute('catalog_product', 'frontend_display', array(
'label' => 'Display Test',
'type' => 'varchar',
'frontend_model' => 'Test_Module/Entity_Attribute_Frontend_CsvExport',
'input' => 'select',
'required' => 0,
'user_defined' => false,
'group' => 'General'
));
Make sure to set the frontend_model to the model that you are going to use. The frontend model affects the display of the attribute (both in the frontend and the adminhtml sections).
Next, create yourself the class, and override one or both of the following functions:
public function getInputType()
{
return parent::getInputType();
}
public function getInputRendererClass()
{
return "Test_Module_Block_Adminhtml_Entity_Renderer_CsvExport";
}
The first (getInputType()) is used to change the input type to a baked in input type (see Varien_Data_Form_Element_* for the options). However, to set your own renderer class, use the latter function - getInputRendererClass(). That is what I am going to demonstrate below:
public function getElementHtml()
{
return Mage::app()->getLayout()->createBlock('Test_Module/Adminhtml_ExportCsv', 'export')->toHtml();
}
Here, to clean things up, I am instantiating another block, as the element itself doesn't have the extra functions to display buttons and the like.
Then finally, create this file:
class Test_Module_Block_Adminhtml_ExportCsv extends Mage_Adminhtml_Block_Widget
{
protected function _prepareLayout()
{
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
->setData(array(
'label' => $this->__('Generate CSV'),
'onclick' => '',
'class' => 'ajax',
));
$this->setChild('generate', $button);
}
protected function _toHtml()
{
return $this->getChildHtml();
}
}
This doesn't cover the AJAX part, but will get you very close to getting the rest to work.

Magento: Price Field in Adminhtml product form

I would like to add a price field into my admin form under my product edit page, but I cannot add a “price” type into my fieldset.
$fieldset->addField($attribute->getAttributeCode(), 'price', array(
'label' => Mage::helper('mymod')->__($attribute->getFrontendLabel()),
'class' => $attribute->getIsRequired()?'required-entry':'',
'required' => $attribute->getIsRequired()?true:false,
'name' => $attribute->getAttributeCode(),
'note' => Mage::helper('mymod')->__($attribute->getNote()),
));
it is giving the following error.
Fatal error: Class 'Varien_Data_Form_Element_Price' not found in .. /lib/Varien/Data/Form/Abstract.php on line 144
PS.
I am digging the code in
Mage_Adminhtml_Block_Widget_Form
where in function
_setFieldset
It can use the price as fieldType.
Edit # 11/6:
Digging into _setFieldset(), from the first line
$this->_addElementTypes($fieldset);
will invoke an implementable function
function _getAdditionalElementTypes()
to add additional data type (such as price, gallary..) not in the given list.
I think you just just have to do text because these are the available options:
Button
Checkbox
Checkboxes
Collection
Column
Date
Editor
Fieldset
File
Gallery
Hidden
Image
Imagefile
Label
Link
Multiline
Multiselect
Note
Obscure
Password
Radio
Radios
Reset
Select
Submit
Text
Textarea
Time

Categories