Skins | Forum Promotion – Best Webmaster, Admin and Internet Marketing Forum

Hi Guys,
As I mentioned before, I'm starting a new forum on Jcink – but I've encountered a big problem. The standard skin is literally the only good skin I've come across – and I'm not even big at it, would it be nicer if it were blue instead of red?

Anyway – is it still a faux pas to use standard skins on forums, or should it be okay provided I am always empty?

magento2 – How to create functions for the selection of products on the admin category page

I am trying to create selected products on the category page.
ui_component (category_form.xml)

true

AddProduct class:

class AddProducts extends MagentoBackendBlockTemplate
{
    /**
     * Block template
     *
     * @var string
     */
    protected $_template = 'Vendor_Module::catalog/category/edit/grid_products.phtml';

    /**
     * @var MagentoCatalogBlockAdminhtmlCategoryTabProduct
     */
    protected $blockGrid;

    /**
     * @var MagentoFrameworkRegistry
     */
    protected $registry;

    /**
     * @var MagentoFrameworkJsonEncoderInterface
     */
    protected $jsonEncoder;

    /**
     * AssignProducts constructor.
     *
     * @param MagentoBackendBlockTemplateContext $context
     * @param MagentoFrameworkRegistry $registry
     * @param MagentoFrameworkJsonEncoderInterface $jsonEncoder
     * @param array $data
     */
    public function __construct(
        MagentoBackendBlockTemplateContext $context,
        MagentoFrameworkRegistry $registry,
        MagentoFrameworkJsonEncoderInterface $jsonEncoder,
        array $data = ()
    ) {
        $this->registry = $registry;
        $this->jsonEncoder = $jsonEncoder;
        parent::__construct($context, $data);
    }

    /**
     * Retrieve instance of grid block
     *
     * @return MagentoFrameworkViewElementBlockInterface
     * @throws MagentoFrameworkExceptionLocalizedException
     */
    public function getBlockGrid()
    {
        if (null === $this->blockGrid) {
            $this->blockGrid = $this->getLayout()->createBlock(
                TabProduct::class,
                'category.product.grid'
            );
        }
        return $this->blockGrid;
    }

    /**
     * Return HTML of grid block
     *
     * @return string
     */
    public function getGridHtml()
    {
        return $this->getBlockGrid()->toHtml();
    }

    /**
     * @return string
     */
    public function getProductsJson()
    {
        $products = $this->getCategory()->getProductsPosition();
        if (!empty($products)) {
            return $this->jsonEncoder->encode($products);
        }
        return '{}';
    }

    /**
     * Retrieve current category instance
     *
     * @return array|null
     */
    public function getCategory()
    {
        return $this->registry->registry('category');
    }
class Product extends MagentoBackendBlockWidgetGridExtended
{
    /**
     * Core registry
     *
     * @var MagentoFrameworkRegistry
     */
    protected $_coreRegistry = null;

    /**
     * @var MagentoCatalogModelProductFactory
     */
    protected $_productFactory;

    /**
     * @var Status
     */
    private $status;

    /**
     * @var Visibility
     */
    private $visibility;

    /**
     * @param MagentoBackendBlockTemplateContext $context
     * @param MagentoBackendHelperData $backendHelper
     * @param MagentoCatalogModelProductFactory $productFactory
     * @param MagentoFrameworkRegistry $coreRegistry
     * @param array $data
     * @param Visibility|null $visibility
     * @param Status|null $status
     */
    public function __construct(
        MagentoBackendBlockTemplateContext $context,
        MagentoBackendHelperData $backendHelper,
        MagentoCatalogModelProductFactory $productFactory,
        MagentoFrameworkRegistry $coreRegistry,
        array $data = (),
        Visibility $visibility = null,
        Status $status = null
    ) {
        $this->_productFactory = $productFactory;
        $this->_coreRegistry = $coreRegistry;
        $this->visibility = $visibility ?: ObjectManager::getInstance()->get(Visibility::class);
        $this->status = $status ?: ObjectManager::getInstance()->get(Status::class);
        parent::__construct($context, $backendHelper, $data);
    }

    /**
     * @return void
     */
    protected function _construct()
    {
        parent::_construct();
        $this->setId('select_category_products');
        $this->setDefaultSort('entity_id');
        $this->setUseAjax(true);
    }

    /**
     * @return array|null
     */
    public function getCategory()
    {
        return $this->_coreRegistry->registry('category');
    }

    /**
     * @param Column $column
     * @return MagentoCatalogBlockAdminhtmlCategoryTabProduct
     */
    protected function _addColumnFilterToCollection($column)
    {
        // Set custom filter for in category flag
        if ($column->getId() == 'in_category') {
            $productIds = $this->_getSelectedProducts();
            if (empty($productIds)) {
                $productIds = 0;
            }
            if ($column->getFilter()->getValue()) {
                $this->getCollection()->addFieldToFilter('entity_id', ('in' => $productIds));
            } elseif (!empty($productIds)) {
                $this->getCollection()->addFieldToFilter('entity_id', ('nin' => $productIds));
            }
        } else {
            parent::_addColumnFilterToCollection($column);
        }
        return $this;
    }

    /**
     * @return Grid
     */
    protected function _prepareCollection()
    {
        if ($this->getCategory()->getId()) {
            $this->setDefaultFilter(('in_category' => 1));
        }
        $collection = $this->_productFactory->create()->getCollection()->addAttributeToSelect(
            'name'
        )->addAttributeToSelect(
            'sku'
        )->addAttributeToSelect(
            'visibility'
        )->addAttributeToSelect(
            'status'
        )->addAttributeToSelect(
            'price'
        )->joinField(
            'position',
            'catalog_category_product',
            'position',
            'product_id=entity_id',
            'category_id=' . (int)$this->getRequest()->getParam('id', 0),
            'left'
        );
        $storeId = (int)$this->getRequest()->getParam('store', 0);
        if ($storeId > 0) {
            $collection->addStoreFilter($storeId);
        }
        $visible = (
            Visibility::VISIBILITY_IN_SEARCH,
            Visibility::VISIBILITY_IN_CATALOG,
            Visibility::VISIBILITY_BOTH,
        );
        $collection->addAttributeToFilter('status', ('in' => $visible));
        $this->setCollection($collection);

        if ($this->getCategory()->getProductsReadonly()) {
            $productIds = $this->_getSelectedProducts();
            if (empty($productIds)) {
                $productIds = 0;
            }
            $this->getCollection()->addFieldToFilter('entity_id', ('in' => $productIds));
        }

        return parent::_prepareCollection();
    }

    /**
     * @return Extended
     */
    protected function _prepareColumns()
    {
        if (!$this->getCategory()->getProductsReadonly()) {
            $this->addColumn(
                'in_category',
                (
                    'type' => 'checkbox',
                    'name' => 'in_category',
                    'values' => $this->addSelected(),
                    'index' => 'entity_id',
                    'header_css_class' => 'col-select col-massaction',
                    'column_css_class' => 'col-select col-massaction'
                )
            );
        }
        $this->addColumn(
            'entity_id',
            (
                'header' => __('ID'),
                'sortable' => true,
                'index' => 'entity_id',
                'header_css_class' => 'col-id',
                'column_css_class' => 'col-id'
            )
        );
        $this->addColumn('name', ('header' => __('Name'), 'index' => 'name'));
        $this->addColumn('sku', ('header' => __('SKU'), 'index' => 'sku'));
        $this->addColumn(
            'visibility',
            (
                'header' => __('Visibility'),
                'index' => 'visibility',
                'type' => 'options',
                'options' => $this->visibility->getOptionArray(),
                'header_css_class' => 'col-visibility',
                'column_css_class' => 'col-visibility'
            )
        );

        $this->addColumn(
            'status',
            (
                'header' => __('Status'),
                'index' => 'status',
                'type' => 'options',
                'options' => $this->status->getOptionArray()
            )
        );

        $this->addColumn(
            'price',
            (
                'header' => __('Price'),
                'type' => 'currency',
                'currency_code' => (string)$this->_scopeConfig->getValue(
                    MagentoDirectoryModelCurrency::XML_PATH_CURRENCY_BASE,
                    MagentoStoreModelScopeInterface::SCOPE_STORE
                ),
                'index' => 'price'
            )
        );
        $this->addColumn(
            'position',
            (
                'header' => __('Position'),
                'type' => 'number',
                'index' => 'position',
                'editable' => !$this->getCategory()->getProductsReadonly()
            )
        );

        return parent::_prepareColumns();
    }

    /**
     * @return string
     */
    public function getGridUrl()
    {
        return $this->getUrl('catalog/*/grid', ('_current' => true));
    }

    /**
     * @return array
     */
    protected function _getSelectedProducts()
    {
        $products = $this->getRequest()->getPost('selected_products');
        if ($products === null) {
            $products = $this->getCategory()->getProductsPosition();
            return array_keys($products);
        }
        return $products;
    }

    protected function addSelected()
    {
        //custom selected products
        return (31293);
    }
}

grid_product.phtml

getBlockGrid ();
$ gridJsObjectName = $ blockGrid-> getJsObjectName ();
?>
getGridHtml ()?>




I copied this code from the manufacturer of the catalog category module. This code generates a tab with the product grid on the category page. However, when I click the Save button, the attributes from the in_category grid, but not from my grid, are filled with the "select_products" attribute. Could you please help me find my problem?

wp admin – How do I remove the Site Health Dashboard widget?

The following snippet removes the widget for the registered site integrity dashboard from the dashboard. Add the code to your plugin or functions.php File:

add_action('wp_dashboard_setup', 'remove_site_health_dashboard_widget');
function remove_site_health_dashboard_widget()
{
    remove_meta_box('dashboard_site_health', 'dashboard', 'normal');
}

Is it possible to develop topics and plugins locally while at the same time enabling content to be updated directly in the admin dashboard?

All of the similar questions I found have been asked specifically about setting up local environments and / or setting up version control. You never ask if it is possible to have a theme and plugin development workflow, while non-technical users can change content directly on a web server using the admin dashboard.

I am new to WordPress … is it possible to provide only the files necessary to update designs and plugins and not to overwrite new content on the server?

I believe that these large companies using WordPress must have found a way to enable both release management processes and quick content updates through the admin dashboard.

Thank you for any instructions!

Magento 2.3.4 xampp admin panel problem

You go to etc / di.xml file

And look for them

MagentoFrameworkAppViewAssetMaterializationStrategySymlink

And change that

MagentoFrameworkAppViewAssetMaterializationStrategyCopy

And do this: –

1. Remove pub / static

2. Remove var / cache

3.Remove var / composer_home

4. Remove var / generation

5.Remove var / page_cache

6. Remove var / view_preprocessed

7. Run the PHP Bin / Magento setup: Static content: Deploy

Add a custom admin menu item for pages using a specific template

I want to add a new custom menu item to the WordPress admin sidebar that displays pages that use a specific template. For example, a group of pages that uses the Retailer Sendout template (page-Retailer-sendout.php) is displayed under the top-level Standard Pages menu item.

I've tried the following URL combinations, but none of them have worked so far.

I've also tested some plugins to customize the admin menu, but they don't offer a way to create links to pages with a specific template name.

I'm happy with adding a custom function to the theme's functions.php file, but I don't know where to start.

Any help is greatly appreciated.

Collection – Custom Admin Grid module shows blank page in Magento 1.9

I created a simple form in the frontend sent by the customer and created a menu in the admin area to only show the grid for the same form, no form to add and edit.

When I click the menu, it redirects to a page that has a header and footer, but the content area is empty. No grid is displayed there.

app / etc / modules / Test_Formsubscribe.xml



  
    
      true
      local
      1.0.0
    
  

app / code / local / Test / Formsubscribe / etc / config.xml



    
        
            1.0.0
        
    

  
    
      
        standard
        
          Test_Formsubscribe
          formsubscribe
        
      
    

    
        
            
                
                    formsubscribe.xml
                
            
        
    
  
  
        
            
                Test_Formsubscribe_Model
                formsubscribe_resource
            
            
                Test_Formsubscribe_Model_Resource
                
                    
                        formsubscriber
Test_Formsubscribe Test_Formsubscribe_Block Test_Formsubscribe_Helper
Test_Formsubscribe_Adminhtml formsubscribe.xml Form Subscription Form Subscribers Manage Subscribers 0 Subscribers 90 Manage Subscribers adminhtml/formsubscribe/index 0
**app/code/local/Test/Formsubscribe/etc/system.xml** 80 form_sub 10 1 1 1 text 15 1 1 1 select 10 1 1 1 adminhtml/system_config_source_enabledisable text required-entry 1 20 1 1 1 Enter admin's email address like john@example.com

app / code / local / Test / Formsubscribe / Helper / Data.php

app / code / local / Test / Formsubscribe / Model / Formsubscriber.php

_init('formsubscribe/formsubscriber');
    }
}

app / code / local / Test / Formsubscribe / Model / Resource / Formsubscriber.php

_init('formsubscribe/formsubscriber', 'subscribe_id');
    }
}

app / code / local / Test / Formsubscribe / Modell / Ressource / Formsubscriber / Collection.php

_init('formsubscribe/formsubscriber');
    }
}

app / code / local / Test / Formsubscribe / Block / Index.php

getUrl('formsubscribe/index/post');
    }
}

app / code / local / Test / Formsubscribe / Block / Adminhtml / Formsubscribe.php

_blockGroup = 'test_formsubscribe';
        $this->_controller = 'adminhtml_formsubscribe';
        $this->_headerText = Mage::helper('formsubscribe')->__('Form Subscriber');
        parent::__construct();
        $this->_removeButton('add');
    }
}

app / code / local / Test / Formsubscribe / Block / Adminhtml / Formsubscribe / Grid.php

class Test_Formsubscribe_Block_Adminhtml_Formsubscribe_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
    public function __construct()
    {

        parent::__construct();
        $this->setId('formsubscribe_grid');
        $this->setDefaultSort('subscribe_id');
        $this->setDefaultDir('DESC');
        $this->setSaveParametersInSession(true);
        $this->setUseAjax(true);
    }

    protected function _prepareCollection()
    {
        $collection = Mage::getModel('formsubscribe/formsubscriber')->getCollection();
        $this->setCollection($collection);
         parent::_prepareCollection();
        return $this;
    }

    protected function _prepareColumns()
    {
        $helper = Mage::helper('formsubscribe');

        $this->addColumn('subscribe_id', array(
            'header' => $helper->__('Subscriber #'),
            'index'  => 'subscribe_id'
        ));

        $this->addColumn(
            'email',
            array(
                'header' => Mage::helper('formsubscribe')->__('Email'),
                'index'  => 'email'
            )
        );

        $this->addColumn('contact_no', array(
            'header' => $helper->__('Contact Number'),
            'index'     => 'contact_no',
        ));

        $this->addColumn('name', array(
            'header' => $helper->__('Name'),
            'index'     => 'name',
        ));

        $this->addExportType('*/*/exportCsv', $helper->__('CSV'));
        $this->addExportType('*/*/exportExcel', $helper->__('Excel'));

        return parent::_prepareColumns();
    }

    public function getGridUrl()
    {
        return $this->getUrl('*/*/grid', array('_current'=>true));
    }
}

app / code / local / Test / Formsubscribe / Adminhtml / FormsubscribeController.php

class Test_Formsubscribe_Adminhtml_FormsubscribeController extends Mage_Adminhtml_Controller_Action
{
    public function indexAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }

    public function gridAction()
    {
       $this->loadLayout()->renderLayout();
    }

    public function exportCsvAction()
    {
        $fileName = 'formsubscribe.csv';
        $grid = $this->getLayout()->createBlock('formsubscribe/adminhtml_formsubscribe_grid');
        $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
    }

    public function exportExcelAction()
    {
        $fileName = 'formsubscribe.xml';
        $grid = $this->getLayout()->createBlock('formsubscribe/adminhtml_formsubscribe_grid');
        $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
    }

    protected function _isAllowed()
    {
        return Mage::getSingleton('admin/session')->isAllowed('test_formsubscriber/formsubscribes');
    }
}

app / code / local / Test / Formsubscribe / IndexController.php

loadLayout();
        $this->renderLayout();
    }

    public function postAction()
    {

    if(Mage::getStoreConfig(self::XML_MODULE_ENABLE) == 0)
        {
            return;
        }
        $post = $this->getRequest()->getPost();

        if ($post){
            try {
                $subscriber = Mage::getModel('formsubscribe/formsubscribe');
                $fullname = strtolower(trim($post('f_name'))).' '.strtolower(trim($post('l_name')));
                $subscriber->setData('name', $fullname);
                $subscriber->setData('email', trim($post('email')));
                $subscriber->setData('contact_no', $post('contact_no'));
                if(array_key_exists('message',$post) && trim($post('message')) != ''){$subscriber->setData('message', trim($post('message')));}

        $subscriber->save();

                $name = ucwords(trim($post("f_name")." ".$post("l_name")));
                $email = trim($post("email"));
                $postcode = trim($post("contact_no")); 
                $message = (array_key_exists('message',$post) && trim($post('message')) != '')?trim($post("message")):''; 
                $to = Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT); //Admin Email Address
                $subject = "Form Subcription Request";
                $body .= "

Dear Admin,
I am requesting for you test subscription, below are my details:

"; $body .= "

Name : " . $name . "

"; $body .= "

Email : " . $email . "

"; $body .= "

Contact Number : " . $contact_no . "

"; $body .= "

Message : " . $message . "

"; $body .= "

Regards,
".$name."

"; $from = $email; $mail = Mage::getModel('core/email'); $mail->setToName(self::XML_PATH_NAME_RECIPIENT); $mail->setToEmail($to); $mail->setBody($body); $mail->setSubject($subject); $mail->setFromEmail($from); $mail->setType('html');// YOu can use Html or text as Mail format $mail->setBodyHTML($body); // your content or message $mail->send(); echo Mage::getSingleton('core/session')->addSuccess('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.'); $this->_redirect('*/*/'); return; } catch (Exception $e) { echo Mage::getSingleton('core/session')->addError('Unable to submit your request. Please, try again later');*/ this->_redirect('*/*/'); return; } } else { $this->_redirect('*/*/'); } } }

app / code / local / Test / Formsubscribe / sql / formsubscribe_setup / install-1.0.0.php

startSetup();

$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */

$installer->startSetup();

$installer->run("
DROP TABLE IF EXISTS `{$this->getTable('formsubscribe/formsubscriber')}`;
CREATE TABLE `{$this->getTable('formsubscribe/formsubscriber')}` (
  `subscribe_id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `email` varchar(80) NOT NULL,
  `contact_no` varchar(255) NOT NULL,
  `message` text NULL,
  PRIMARY KEY (`subscribe_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Subscribers';
");

$installer->endSetup();

Admin layout
app / design / adminhtml / default / default / layout / formsubscribe.xml
(I have doubts about this file)



    
        
            
                test_formsubscriber/subscribers
            
        
        
            
        
    
    
        
            
        
    

Front end layout
app / design / frontend / base / default / layout / formsubscribe.xml

page / 1column.phtml

Frontend template
app / design / frontend / sterling / default / template / formsubscribe / form_subscribe.phtml

 

__ (& # 39; registration form & # 39;)?>

<form id = "subscribe-form-validate" method = "post" action = "getFormAction ()?> ">

__ (& # 39; Information & # 39;)?>

  • * * __ (& # 39; Required fields & # 39;)?>