Skip to content

Instantly share code, notes, and snippets.

View magevision's full-sized avatar

MageVision magevision

View GitHub Profile
@magevision
magevision / customer_listing.xml
Created February 26, 2018 21:57
Add a Mass Action in Admin Grid
<?xml version="1.0"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<listingToolbar name="listing_top">
<massaction name="listing_massaction">
<action name="mass_email_customer">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="type" xsi:type="string">mass_email_customer</item>
<item name="label" xsi:type="string" translate="true">Email to Customers</item>
<item name="url" xsi:type="url" path="massemailcustomers/email/massSend"/>
@magevision
magevision / View.php
Created March 7, 2018 15:14
Add a Custom Button to Admin Sales Order View
<?php
namespace MageVision\Blog27\Plugin\Sales\Block\Adminhtml\Order;
use Magento\Sales\Block\Adminhtml\Order\View as OrderView;
class View
{
public function beforeSetLayout(OrderView $subject)
{
$subject->addButton(
@magevision
magevision / Data.php
Created July 24, 2018 10:05
Get the Base Url
<?php
/**
* MageVision Blog29
*
* @category MageVision
* @package MageVision_Blog29
* @author MageVision Team
* @copyright Copyright (c) 2018 MageVision (https://www.magevision.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@magevision
magevision / CurrencySymbolChangePositionObserver.php
Last active September 18, 2018 08:24
HowToChangeCurrencySymbolPosition
<?php
namespace MageVision\Blog30\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Event\Observer;
use Magento\Framework\Currency;
class CurrencySymbolChangePositionObserver implements ObserverInterface
{
/**
@magevision
magevision / RemoveBlockOnConditionObserver.php
Created September 30, 2018 16:55
RemoveALayoutBlockOnCondition
<?php
namespace MageVision\Blog31\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Event\Observer;
class RemoveBlockOnConditionObserver implements ObserverInterface
{
/**
* Remove block block
@magevision
magevision / ValidateCartObserver.php
Created October 1, 2018 08:46
ValidateCartBeforeCheckout
<?php
namespace MageVision\Blog32\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Checkout\Model\Cart as CustomerCart;
use Magento\Framework\Message\ManagerInterface;
use Magento\Framework\App\Response\RedirectInterface;
use Magento\Framework\Event\Observer;
class ValidateCartObserver implements ObserverInterface
@magevision
magevision / LayoutProcessor.php
Last active October 29, 2018 15:33
ChangeOrderOfAddressFieldsInCheckout
<?php
namespace MageVision\Blog33\Plugin\Checkout\Block;
class LayoutProcessor {
/**
* Position the telephone field after address fields
*
* @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject
@magevision
magevision / customer_account_create.xml
Last active November 30, 2018 15:50
ShowAddressfieldsonCustomerRegistration
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="customer_form_register">
<action method="setShowAddressFields">
<argument name="show.address.fields" xsi:type="boolean">true</argument>
</action>
</referenceBlock>
</body>
</page>
@magevision
magevision / View.php
Created January 8, 2019 14:47
UpdateLayoutOnAttributeSet
<?php
namespace MageVision\Blog37\Plugin\Catalog\Helper\Product;
use Magento\Catalog\Model\Product;
use Magento\Framework\View\Result\Page as ResultPage;
class View
{
public function beforeInitProductLayout(
\Magento\Catalog\Helper\Product\View $subject,
@magevision
magevision / Mode.php
Created February 20, 2019 10:05
AddCustomCategoryDisplayMode
<?php
namespace MageVision\Blog38\Plugin\Catalog\Model\Category\Attribute\Source;
class Mode
{
/**
* @param \Magento\Catalog\Model\Category\Attribute\Source\Mode $subject
* @param $result
* @return array
*/