assign id to select box magento admin custom grid - php

I have custom grid on my magento admin panel where I want to add product id as a css id to every select box I have tried 'column_css_class' => 'id' but this add class to every select box with id word not its value how can i do this
$this->addColumn('icon',
array(
'header' => 'Icon',
'width' => '100px',
'type' => 'action',
'getter' => 'getId',
'index' => 'stores',
'column_css_class' => 'id',
'actions' => array(
array(
'caption' => 'Enable',
'url' => array(
'base'=>'*/*/enable'
),'field' => 'id'
),
array(
'caption' => 'Disable',
'url' => array(
'base'=>'*/*/disable'
),
'field' => 'id'
)
)
));

If you have a product object says $oProduct,
You can change your code so that instead of
'column_css_class' => 'id'
You would have:
'column_css_class' => $oProduct->getId()
Also using product id is not a good idea, use SKU instead.

Related

Modifying metabox custom field through myphpadmin causing wordpress to show blank

so basically on my wordpress site, i link images and i recently changed my image domain name, so i went into phpmyadmin and typed:
UPDATE `wp_postmeta` SET `meta_value` = replace(meta_value, 'old-domain.com', 'new-domain.com')
and my mysql/phpmyadmin, its all updated to the new domain, but on wordpress, the custom field hasnt picked up the new details and is left blank.
this is my array for the custom field:
'title' => 'Embed Image',
'pages' => array( 'post' ),
'tabs' => array(
'input-version' => array(
'label' => 'Input Version',
'icon' => 'dashicons-admin-customizer',
),
'tab_style' => 'default',
'fields' => array(
array(
'id' => 'ab_embedgroup',
'type' => 'group',
'clone' => true,
'sort_clone' => true,
'save_state' => true,
'desc' => '<b style="color:red;">Insert embed code</b>',
'tab' => 'input-version',
'fields' => array(
array(
'name' => 'Host Name',
'id' => 'ab_hostname',
'type' => 'text',
),
array(
'name' => 'IMEmbed',
'id' => 'ab_embed',
'type' => 'textarea',
'sanitize_callback' => 'none',```
cleared cache, restarted VPS, tried it all, just cant understand why it wont pick it up.
am i editing it incorrectly? Cant do it one by one because its a few thousand images.

How to show a grid / table in a tab section that will be displayed in in the admin section of prestashop 1.6.x

I want to show a grid or editable table in my tab in the admin section
I managed to do the module and three tabs are been displayed .In one of the tab i want to show a editable grid i.e in the CHECKS tab
As shown in the below image,in the chek tab section i want to show a grid
In the constructor of my admin controller of my module ()
ie in addhealthcheckconfig\controllers\admin\HealthCheckConfigController.php
I am setting the field options to populate the tab ,below is my code:
$this->fields_options = array(
'appearance' => array(
'title' => $this->l('Manage your Health Check '),
'icon' => 'icon-html5',
'tabs' => array(
'TAB1' => $this->l('SUPPORT_GROUPS'),
'TAB2' => $this->l('CHECKS'),
'TAB3' => $this->l('REPORT RECIPIENTS'),
),
'fields' => array(
'SUPPORT_GROUPS' => array(
'title' => $this->l('SUPPORT GROUPS'),
'hint' => $this->l('Manage your Support Groups here'),
'type' => 'fields_list',
'name' => 'PS_LOGO',
'tab' => 'TAB1'
),
'CHECKS' => array(
'title' => $this->l('LIST OF AVAILABLE CHECKS '),
'hint' => $this->l('List of Available checks will be displayed here !!'),
'type' => 'text',
'list' => $this->fields_list = array(
'code' => array(
'title' => $this->l('code'),
'align' => 'text-center',
'remove_onclick' => true,
'search' => false,
),
'description' => array(
'title' => $this->l('description'),
'align' => 'text-center',
'remove_onclick' => true,
'search' => false,
),
'category' => array(
'title' => $this->l('category'),
'align' => 'text-center',
'remove_onclick' => true,
'search' => false,
),
),
'tab' => 'TAB2'
),
'REPORT_RECIPIENTS' => array(
'title' => $this->l('REPORT RECIPIENTS '),
'hint' => $this->l('List of Available checks will be displayed here !!'),
'tab' => 'TAB3'
),
) ));
In the TAB2 Section i am not sure what i need to put in the 'type' section , I tried with list , but yet I can not achieve what I am trying to do , also i am not sure how to assign the $this->fields_list to that type correctly
How to achieve this editable db grid in my tab ?

Magento Custom Grid delete action not working

I have Magento custom grid that is showing my list of products I want to remove my product when someone click on delete action. I have written my action code that is below but it is not working everytime when I click on delete it shows me 404 page when using url (*/*/delete) and when I changed the url to (*/*/../../admin/catalog_product/delete) it will go to dashboard page but didn't delete my product:
$this->addColumn('action',
array(
'header' => 'Action',
'width' => '100px',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'url' => array('base'=> '*/*/edit'),
'field' => 'id'
)
)
)
)
Any solution for my this problem will really helpfull for me.
I think problem is on url making,try to make url as follow in actions.
Note : Replace param_id as per your url perameter and module name as per your module name in helper.
'actions' => array(
array(
'caption' => Mage::helper('module_name')->__('Edit'),
'url' => array(
'base'=>'*/*/edit',
'params'=> array('id'=>$this->getRequest()->getParam('param_id'))
),'field' => 'id'
),
array(
'caption' => Mage::helper('module_name')->__('Delete'),
'url' => array(
'base'=>'*/*/delete',
'params'=> array('id'=>$this->getRequest()->getParam('param_id'))
),'field' => 'id'
)
),
You haven't created a delete action, try modify the above code to:
$this->addColumn('action',
array(
'header' => 'Action',
'width' => '100px',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'url' => array('base'=> '*/*/edit'),
'field' => 'id'
),
array(
'url' => array('base'=> '*/*/delete'),
'field' => 'id'
)
)

Yii bootstrap, adding id and class to TbBootstrap

i'm using PHP Yii framework, and came across a problem regarding adding Id and other attributes to a tab. I'm using yii bootstrap by the way as extension:
$tabs = array(
'item1' => array(
'label' => 'label1',
'content' => $content1,
),
'preview' => array(
'label' => 'Preview',
),
);
$this->widget('bootstrap.widgets.TbWizard',
array(
'id' => 'harvest-tabs',
'type' => 'tabs',
'tabs' => $tabs,
'pagerContent' => false,
));
How do i add an 'id' and 'class' property to each of the tab 'item1' and 'preview'?
i tried:
'item1' => array(
'label' => 'label1',
'content' => $content1,
'id' => 'some id'
'class' => 'some class'
),
'preview' => array(
'label' => 'Preview',
'id' => 'some other id'
'class' => 'some other class'
),
But this doesn't add a class to it. I only see <li>'s
that serves as the container for the tabs. Sorry i'm a newbie here. I'd appreciate any help Thanks!
You should try this:
'item1' => array(
'label' => 'label1',
'content' => $content1,
'htmlOptions'=>array(
'id' => 'some id'
'class' => 'some class'
),
),
I haven't tried it but I'm following yii bootstrap logic here. Tell me if it's not working.

How do I deal with drupal hook_views_tables?

For the title field,I want to return node.title,but what I tried is not working:
return array('og' => array('name' => 'og',
'join' => array('left' => array('table' => 'node',
'field' => 'nid'
),
'right' => array('field' => 'nid'
),
),
'fields' => array(
'title' => array('name' => t('OG: Group: Group name'),
'table' => 'node',
'handler' => 'og_handler_field_title',
'help' => t('show group name.'),
'sortable' => true,
'sort_handler' => 'views_og_query_ogname',
'notafield' => false,
),
I haven't used views for Drupal 5, so I might be a bit off. But when you make a join on the node, you shouldn't actually need to create the node title field yourself. You should instead be able get it directly from the node table like you would for a normal node.
Your field declarations should only be for the fields you have in the table you want to integrate into views.

Categories