show Enable/disable value on grid list magento - magento-1.9

In Magento 1.9, I have created Module and in admin grid i want to show value 0/1 as Enable/Disable title. But it is not working. Here is my script which i am using.
$this->addColumn('status',
array(
'header'=> Mage::helper('catalog')->__('Status'),
'align' =>'right',
'width' => '50px',
'index' => 'status',
'options' => array('1'=>'Enable','0'=>'Disable')
)
);
Please anybody can help me where i need to change in Grid.php file.
Thank you

$this->addColumn('is_active', [
'header'=> __('status'),
'align' => 'left',
'index' => 'is_active',
'params' => ['id'=>'getId'],
'type' => 'options',
'options' => array(
1 => 'enabled',
0 => 'disabled',
),
]);

Related

How to show Options page for editor user role

I am developing a theme, and I want the Theme Options Page, to be available for Editor, and Administrator user roles.
The options page show up fine when the user is an administrator.
My reduxt configuration file:
...
$args = array(
'display_name' => esc_html__( 'Ρυθμίσεις Θέματος', TEXT_DOMAIN ),
'display_version' => '1.0.0',
'menu_title' => esc_html__( 'Ρυθμίσεις Θέματος', TEXT_DOMAIN ),
'customizer' => false,
'page_permissions' => 'delete_pages',
'dev_mode' => true
);
Redux::setArgs( $opt_name, $args );
$sections = array(
'basic',
);
Redux::setSection( $opt_name, array(
'title' => esc_html__( 'Βασικές Ρυθμίσεις', TEXT_DOMAIN ),
'id' => $sections[0],
'desc' => esc_html__( 'Social Media, Στοιχεία Επικοινωνίας', TEXT_DOMAIN ),
'icon' => 'el el-home',
'permissions' => 'delete_pages',
'fields' => array(
...
I've found it. Line 75 in redux-framework\redux-core\inc\classes\class-redux-page-render.php, sets the page_permissions argument.
Which of course accepts any valid Wordpress capability.

Yii2 grid sorting is not correct with ArrayDataProvider

I'm using array data provider for grid view widget since the data source is an API response. It's working fine, but when I try to sort the 'Name' column, it's sorting incorrectly with the lowercase first letters. Please check the table grid screenshot. The API response which I'm receiving is correct with the current sorting.
1. Table Grid
2. Model
$provider = new ArrayDataProvider([
'allModels' => #$response->data,
'pagination' => false,
'sort' => [
'attributes' => ['id', 'name', 'shortDescription'],
],
]);
3. View
<?= GridView::widget([
' dataProvider' => $dataProvider,
'columns' => [
'id',
'name',
'shortDescription'
],
'options' => ['class' => 'content'],
'tableOptions' => ['class' => 'table table-striped table-hover'],
'summary' => Yii::t('app', 'Showing').' {begin}-{end} of '.$total.' '.Yii::t('app', 'items')
]);
?>
Please guide me to fix this. Thanks!

I want to use Jalali date in my Laravel / Angular database but I faced with this error: Whoops, looks like something went wrong

Recently I have purchased "Schoex - Ultimate school management system", a software for managing school. This software designed by Laravel 4 and AngularJS. Default date for this software is Gerigorian and I want to change it to Jalali date. I found different package from internet but not any one worked.
For example I tried to used this package: https://github.com/morilog/jalali
and It shows this error: Whoops, looks like something went wrong.
app.php
<?php
return array(
'debug' => false,
'log' => 'daily',
'url' => '',
'timezone' => 'Asia/Kabul',
'locale' => 'fa',
'key' => 'SchoexSchoolApplicationByCrHouse',
'providers' => array(
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Cache\CacheServiceProvider',
'Illuminate\Session\CommandsServiceProvider',
'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
'Illuminate\Routing\ControllerServiceProvider',
'Illuminate\Cookie\CookieServiceProvider',
'Illuminate\Database\DatabaseServiceProvider',
'Illuminate\Encryption\EncryptionServiceProvider',
'Illuminate\Filesystem\FilesystemServiceProvider',
'Illuminate\Hashing\HashServiceProvider',
'Illuminate\Html\HtmlServiceProvider',
'Illuminate\Log\LogServiceProvider',
'Illuminate\Mail\MailServiceProvider',
'Illuminate\Database\MigrationServiceProvider',
'Illuminate\Pagination\PaginationServiceProvider',
'Illuminate\Queue\QueueServiceProvider',
'Illuminate\Redis\RedisServiceProvider',
'Illuminate\Remote\RemoteServiceProvider',
'Illuminate\Auth\Reminders\ReminderServiceProvider',
'Illuminate\Database\SeedServiceProvider',
'Illuminate\Session\SessionServiceProvider',
'Illuminate\Translation\TranslationServiceProvider',
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider',
'Tappleby\AuthToken\AuthTokenServiceProvider',
'Morilog\JalaliServiceProvider',
),
'manifest' => storage_path().'/meta',
'aliases' => array(
'App' => 'Illuminate\Support\Facades\App',
'Artisan' => 'Illuminate\Support\Facades\Artisan',
'Auth' => 'Illuminate\Support\Facades\Auth',
'Blade' => 'Illuminate\Support\Facades\Blade',
'Cache' => 'Illuminate\Support\Facades\Cache',
'ClassLoader' => 'Illuminate\Support\ClassLoader',
'Config' => 'Illuminate\Support\Facades\Config',
'Controller' => 'Illuminate\Routing\Controller',
'Cookie' => 'Illuminate\Support\Facades\Cookie',
'Crypt' => 'Illuminate\Support\Facades\Crypt',
'DB' => 'Illuminate\Support\Facades\DB',
'Eloquent' => 'Illuminate\Database\Eloquent\Model',
'Event' => 'Illuminate\Support\Facades\Event',
'File' => 'Illuminate\Support\Facades\File',
'Form' => 'Illuminate\Support\Facades\Form',
'Hash' => 'Illuminate\Support\Facades\Hash',
'HTML' => 'Illuminate\Support\Facades\HTML',
'Input' => 'Illuminate\Support\Facades\Input',
'Lang' => 'Illuminate\Support\Facades\Lang',
'Log' => 'Illuminate\Support\Facades\Log',
'Mail' => 'Illuminate\Support\Facades\Mail',
'Paginator' => 'Illuminate\Support\Facades\Paginator',
'Password' => 'Illuminate\Support\Facades\Password',
'Queue' => 'Illuminate\Support\Facades\Queue',
'Redirect' => 'Illuminate\Support\Facades\Redirect',
'Redis' => 'Illuminate\Support\Facades\Redis',
'Request' => 'Illuminate\Support\Facades\Request',
'Response' => 'Illuminate\Support\Facades\Response',
'Route' => 'Illuminate\Support\Facades\Route',
'Schema' => 'Illuminate\Support\Facades\Schema',
'Seeder' => 'Illuminate\Database\Seeder',
'Session' => 'Illuminate\Support\Facades\Session',
'SSH' => 'Illuminate\Support\Facades\SSH',
'Str' => 'Illuminate\Support\Str',
'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View',
'AuthToken' => 'Tappleby\Support\Facades\AuthToken',
'AuthTokenNotAuthorizedException' => 'Tappleby\AuthToken\Exceptions\NotAuthorizedException',
'jDate' => 'Morilog\Facades\jDate',
'jDateTime' => 'Morilog\Facades\jDateTime',
),
);

Call to undefined method Varien_Db_Statement_Pdo_Mysql::addColumn()

When i try to run my upgrade script it gives Call to undefined method Varien_Db_Statement_Pdo_Mysql::addColumn() error on second addcolumn but when i remove all other column and keep only one addColumn it work fine.My upgrade script is as below
$installer->startSetup();
/**
* alter table 'savecart/savecart'
*/
$installer->getConnection()
->addColumn($installer->getTable('savecart/savecart'),'savecart_name', array(
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'nullable' => true,
'length' => 255,
'comment' => 'Savecart Name'
))
->addColumn($installer->getTable('savecart/savecart'),'savecart_comment', array(
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'nullable' => true,
'comment' => 'Savecart Comment'
))
->addColumn($installer->getTable('savecart/savecart'),'savecart_bill_id', array(
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
'nullable' => true,
'length' => 10,
'comment' => 'Billing Id'
))
->addColumn($installer->getTable('savecart/savecart'),'savecart_valid_till', array(
'type' => Varien_Db_Ddl_Table::TYPE_DATE,
'nullable' => true,
'comment' => 'Valid Till Date'
));
$installer->endSetup();
CHAINING CORRECTLY
I was looking into this and found several sites that use a different writing method:
http://magedevguide.com/challenge/chapter4/1
http://magento.ikantam.com/qa/how-setup-magento-scripts
Please try these methods with your values..
You can try copy pasting following code, but please review it for your values..
$installer->startSetup();
/**
* alter table 'savecart/savecart'
*/
$installer->getConnection()
->newTable($installer->getTable('savecart/savecart'))
->addColumn('savecart_name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array('nullable' => true), 'Savecart Name')
->addColumn('savecart_comment', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => true), 'Savecart Comment')
->addColumn('savecart_bill_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('nullable' => true), 'Billing Id')
->addColumn('savecart_valid_till', Varien_Db_Ddl_Table::TYPE_DATE, null, array('nullable' => true), 'Valid Till Date');
$installer->endSetup();
Please let me know if one of the solutions is working so I can update my answer.
Please use following upgrade script add multiple columns to the existing magento table.for detailed explanation.
https://www.pearlbells.co.uk/upgrade-script-multiple-columns-magento/
$installer->getConnection()
->addColumn($installer->getTable('imagedetail'),'filters_workshop_colour',
array(
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'nullable' => true,
'comment' => 'Filters Workshop Colour'
));
$installer->getConnection()
->addColumn($installer->getTable('imagedetail'),'splashbackcolor',
array(
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'nullable' => true,
'comment' => 'Splash Back Color'
));
$installer->getConnection()
->addColumn($installer->getTable('imagedetail'),'cabinetcolor',
array(
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'nullable' => true,
'comment' => 'Cabinet Color'
));

Zend Framework 2 - Multiple sub domains cause problems

I am writing an application in Zend Framework 2 which is going to run from a few different subdomain, and I want to have a different module for each sub domain, to keep things tidy.
My problem is when I add more than 1 sub domain to the routing, it loses one of the sub domains.
eg: This setup works
testbed.localhost (module/Application)
a.testbed.localhost (module/A)
If I add an extra one it will the route all requests for a to the Application Index Controller
eg
testbed.localhost (module/Application), a.testbed.localhost (module/A), b.testbed.localhost (module/B)
This is the module.config.php for module/A
'router' => array(
'routes' => array(
'ads' => array(
'type' => 'Hostname',
'options' => array(
'route' => 'a.testbed.localhost',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'A\Controller',
'controller' => 'A\Controller\A',
'action' => 'index',
),
),
And this is the route in module.config.php in module/B
'router' => array(
'routes' => array(
'ads' => array(
'type' => 'Hostname',
'options' => array(
'route' => 'b.testbed.localhost',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'B\Controller',
'controller' => 'B\Controller\B',
'action' => 'index',
),
),
Now the namespaces are correct in both the module.config.php files, what I have noticed is the sub domain a.testbed.localhost will work if I remove the reference to it from config/application.config.php
<?php
return array(
'modules' => array(
'Application',
'A',
'B', <--- A doesn't work if B is here
),
And if I swap A & B around in the modules array above, then B will get forwarded to the Application Module and A will work. So it seems to have problems with more than 1 sub domain. Has anyone got any ideas / come across the same thing?
This happens because your route names are the same. I would try a-ads and b-ads for route names and that should resolve your situation.
In the end the configuration is getting merged together. So it's like an array, when the last array is merged it overwrites anything before it.