├── AdminProductLinks
├── Block
│ └── Adminhtml
│ │ ├── Category
│ │ └── Tab
│ │ │ └── Product.php
│ │ └── ProductNameUrlRenderer.php
├── Helper
│ └── Data.php
├── Plugin
│ └── Backend
│ │ └── Magento
│ │ └── Bundle
│ │ └── Ui
│ │ └── DataProvider
│ │ └── Product
│ │ └── Form
│ │ └── Modifier
│ │ ├── BundlePanel.php
│ │ └── Composite.php
├── README.md
├── Ui
│ ├── Component
│ │ └── Listing
│ │ │ └── Column
│ │ │ └── UrlRenderer.php
│ └── DataProvider
│ │ └── Product
│ │ └── Form
│ │ └── Modifier
│ │ ├── Grouped.php
│ │ └── Related.php
├── etc
│ ├── adminhtml
│ │ └── di.xml
│ └── module.xml
├── registration.php
└── view
│ └── adminhtml
│ ├── layout
│ └── sales_order_view.xml
│ ├── templates
│ └── items
│ │ └── column
│ │ └── name.phtml
│ └── ui_component
│ ├── crosssell_product_listing.xml
│ ├── related_product_listing.xml
│ └── upsell_product_listing.xml
├── Adminlogo
├── README.md
├── etc
│ ├── adminhtml
│ │ ├── menu.xml
│ │ └── system.xml
│ └── module.xml
├── registration.php
└── view
│ └── adminhtml
│ ├── layout
│ ├── admin_login.xml
│ └── default.xml
│ └── web
│ ├── css
│ └── theshreyas.less
│ └── images
│ ├── logo-square.png
│ ├── logo-wide.png
│ ├── logo.svg
│ └── theshreyas_logo.png
├── CatalogDeleteACL
├── Helper
│ └── Data.php
├── Plugin
│ ├── AclTreeDisplay.php
│ ├── CategoryDeleteAction.php
│ ├── CategoryDeleteBefore.php
│ ├── ProductDeleteBefore.php
│ └── ProductDeleteMassAction.php
├── etc
│ ├── acl.xml
│ ├── adminhtml
│ │ ├── di.xml
│ │ └── system.xml
│ ├── config.xml
│ ├── di.xml
│ └── module.xml
└── registration.php
├── CmsImage
├── Block
│ └── View.php
├── Controller
│ └── Adminhtml
│ │ └── Cms
│ │ ├── Featuredimage
│ │ └── Upload.php
│ │ └── Page
│ │ └── Save.php
├── Model
│ ├── Cms
│ │ └── Page
│ │ │ └── DataProvider.php
│ └── Resolver
│ │ └── FeaturedImage.php
├── Plugin
│ └── Magento
│ │ └── CmsGraphQl
│ │ └── Model
│ │ └── Resolver
│ │ └── DataProvider
│ │ └── Page.php
├── README.md
├── etc
│ ├── adminhtml
│ │ ├── di.xml
│ │ └── routes.xml
│ ├── db_schema.xml
│ ├── di.xml
│ ├── module.xml
│ └── schema.graphqls
├── registration.php
└── view
│ ├── adminhtml
│ ├── ui_component
│ │ └── cms_page_form.xml
│ └── web
│ │ └── template
│ │ └── image-preview.html
│ └── frontend
│ ├── layout
│ └── cms_page_view.xml
│ └── templates
│ └── ogimage.phtml
├── CustomerDataSync
├── Helper
│ └── AddressDataSync.php
├── Plugin
│ ├── CreateAccountPlugin.php
│ └── CustomerRepositoryPlugin.php
├── README.md
├── Setup
│ └── Patch
│ │ └── Data
│ │ ├── AddDataSyncCustomerAddressAttribute.php
│ │ └── AddDataSyncCustomerAttribute.php
├── etc
│ ├── di.xml
│ └── module.xml
├── registration.php
└── view
│ ├── adminhtml
│ └── ui_component
│ │ └── customer_address_form.xml
│ └── base
│ └── ui_component
│ └── customer_form.xml
├── CustomerImportDisableEmail
├── Plugin
│ └── EmailNotificationPlugin.php
├── README.md
├── etc
│ ├── adminhtml
│ │ └── system.xml
│ ├── di.xml
│ └── module.xml
└── registration.php
├── FormatIncrementId
├── etc
│ ├── di.xml
│ └── module.xml
└── registration.php
├── FrontendDisable
├── Helper
│ └── Data.php
├── Model
│ └── Config
│ │ └── Source
│ │ └── Custom.php
├── Observer
│ └── FrontendDisable.php
├── etc
│ ├── adminhtml
│ │ └── system.xml
│ ├── frontend
│ │ └── events.xml
│ └── module.xml
└── registration.php
├── GraphQLTester
├── README.md
├── graphql.php
└── graphqlQueries.php
├── GraphQl
├── Amazonpay
│ ├── Model
│ │ └── Resolver
│ │ │ ├── AmazonBillingAddress.php
│ │ │ ├── AmazonPayConfig.php
│ │ │ ├── AmazonPlaceOrder.php
│ │ │ └── AmazonShippingAddress.php
│ ├── Plugin
│ │ ├── ConfirmOrderReference.php
│ │ └── ShippingInformationManagement.php
│ ├── README.md
│ ├── Rewrite
│ │ └── Amazon
│ │ │ └── Payment
│ │ │ └── Gateway
│ │ │ ├── Data
│ │ │ └── Order
│ │ │ │ └── OrderAdapter.php
│ │ │ └── Response
│ │ │ ├── CompleteAuthHandler.php
│ │ │ └── CompleteSaleHandler.php
│ ├── composer.json
│ ├── etc
│ │ ├── graphql
│ │ │ └── di.xml
│ │ ├── module.xml
│ │ └── schema.graphqls
│ └── registration.php
├── DynamicAttributesGraphql
│ ├── Model
│ │ └── Resolver
│ │ │ └── Product
│ │ │ └── DynamicAttributes.php
│ ├── README.md
│ ├── etc
│ │ ├── module.xml
│ │ └── schema.graphqls
│ └── registration.php
├── FetchProductById
│ ├── Model
│ │ └── Resolver
│ │ │ ├── Product
│ │ │ ├── DataProvider
│ │ │ │ ├── ProductDataProvider.php
│ │ │ │ └── ProductDataProviderInterface.php
│ │ │ └── ProductIdIdentity.php
│ │ │ └── ProductId.php
│ ├── etc
│ │ ├── di.xml
│ │ ├── module.xml
│ │ └── schema.graphqls
│ └── registration.php
├── Razorpay
│ └── Magento
│ │ ├── Controller
│ │ ├── BaseController.php
│ │ └── Payment
│ │ │ ├── Order.php
│ │ │ └── Webhook.php
│ │ ├── Model
│ │ ├── CheckoutFactory.php
│ │ ├── Config.php
│ │ ├── ConfigProvider.php
│ │ ├── LogHandler.php
│ │ ├── OrderLink.php
│ │ ├── PaymentAction.php
│ │ ├── PaymentMethod.php
│ │ ├── Resolver
│ │ │ ├── CreateRazorpayOrder.php
│ │ │ └── SetRzpPaymentDetailsOnCart.php
│ │ ├── ResourceModel
│ │ │ ├── OrderLink.php
│ │ │ └── OrderLink
│ │ │ │ └── Collection.php
│ │ └── WebhookUrl.php
│ │ ├── Observer
│ │ └── AfterPlaceOrderObserver.php
│ │ ├── Plugin
│ │ └── CsrfValidatorSkip.php
│ │ ├── README.md
│ │ ├── Setup
│ │ └── UpgradeSchema.php
│ │ ├── composer.json
│ │ ├── etc
│ │ ├── adminhtml
│ │ │ └── system.xml
│ │ ├── config.xml
│ │ ├── csp_whitelist.xml
│ │ ├── di.xml
│ │ ├── events.xml
│ │ ├── frontend
│ │ │ ├── di.xml
│ │ │ └── routes.xml
│ │ ├── module.xml
│ │ ├── payment.xml
│ │ └── schema.graphqls
│ │ ├── registration.php
│ │ └── view
│ │ └── frontend
│ │ ├── layout
│ │ └── checkout_index_index.xml
│ │ ├── requirejs-config.js
│ │ └── web
│ │ ├── js
│ │ └── view
│ │ │ └── payment
│ │ │ ├── method-renderer
│ │ │ └── razorpay-method.js
│ │ │ └── razorpay-payments.js
│ │ └── template
│ │ └── payment
│ │ └── razorpay-form.html
└── RequestedQtyGraphQlBug
│ ├── Plugin
│ └── Graphql
│ │ └── Magento
│ │ └── QuoteGraphQl
│ │ └── Model
│ │ └── Resolver
│ │ └── Cart.php
│ ├── README.md
│ ├── etc
│ ├── graphql
│ │ └── di.xml
│ └── module.xml
│ └── registration.php
├── GuestStockAlert
├── Model
│ └── Resolver
│ │ ├── SaveStockAlert.php
│ │ └── UnsubscribeStockAlert.php
├── README.md
├── Rewrite
│ └── Magento
│ │ ├── Catalog
│ │ └── Block
│ │ │ └── Adminhtml
│ │ │ └── Product
│ │ │ └── Edit
│ │ │ └── Tab
│ │ │ └── Alerts
│ │ │ └── Stock.php
│ │ └── ProductAlert
│ │ └── Model
│ │ ├── Email.php
│ │ └── Observer.php
├── etc
│ ├── db_schema.xml
│ ├── di.xml
│ ├── module.xml
│ └── schema.graphqls
└── registration.php
├── MassProductUpdate
├── Controller
│ └── Adminhtml
│ │ ├── Massaction.php
│ │ └── Massaction
│ │ └── Index.php
├── Helper
│ └── Data.php
├── Model
│ ├── Command.php
│ ├── Command
│ │ ├── Addspecial.php
│ │ ├── Modifyprice.php
│ │ └── Modifyspecial.php
│ └── CustomException.php
├── Plugin
│ └── Ui
│ │ └── Model
│ │ ├── AbstractReader.php
│ │ ├── Manager.php
│ │ └── Reader.php
├── README.md
├── etc
│ ├── adminhtml
│ │ └── routes.xml
│ ├── di.xml
│ └── module.xml
├── registration.php
└── view
│ ├── adminhtml
│ ├── layout
│ │ └── catalog_product_index.xml
│ ├── ui_component
│ │ └── product_listing.xml
│ └── web
│ │ └── css
│ │ └── styles.css
│ └── base
│ ├── requirejs-config.js
│ └── web
│ ├── js
│ └── grid
│ │ ├── massactions.js
│ │ └── tree-massactions.js
│ └── templates
│ └── grid
│ ├── submenu.html
│ └── tree-massactions.html
├── MoveOutofStockToLast
├── Model
│ └── Adapter
│ │ └── BatchDataMapper
│ │ └── CustomDataProvider.php
├── Plugin
│ └── Sort.php
├── README.md
├── etc
│ ├── di.xml
│ ├── frontend
│ │ └── di.xml
│ └── module.xml
└── registration.php
├── OrderGridExport
├── Controller
│ └── Adminhtml
│ │ └── Export
│ │ ├── GridToCustomcsv.php
│ │ └── GridToXls.php
├── Model
│ └── Export
│ │ ├── ConvertToCustomCsv.php
│ │ └── ConvertToXls.php
├── README.md
├── etc
│ ├── adminhtml
│ │ └── routes.xml
│ └── module.xml
├── registration.php
└── view
│ └── adminhtml
│ └── ui_component
│ └── sales_order_grid.xml
├── ProductGridExport
├── Controller
│ └── Adminhtml
│ │ └── Export
│ │ ├── GridToCsv.php
│ │ ├── GridToXls.php
│ │ └── GridToXml.php
├── Model
│ ├── Export
│ │ ├── ConvertToCsv.php
│ │ ├── ConvertToXls.php
│ │ ├── ConvertToXml.php
│ │ └── MetadataProvider.php
│ └── LazySearchResultIterator.php
├── etc
│ ├── adminhtml
│ │ ├── di.xml
│ │ └── routes.xml
│ └── module.xml
├── registration.php
└── view
│ └── adminhtml
│ └── ui_component
│ └── product_listing.xml
├── README.md
├── RenameCountry
├── Plugin
│ └── Magento
│ │ └── Framework
│ │ └── Locale
│ │ └── TranslatedLists.php
├── etc
│ ├── di.xml
│ └── module.xml
└── registration.php
├── SetupDataWithCSV
├── LICENSE.txt
├── Setup
│ └── Patch
│ │ └── Data
│ │ ├── AddData.php
│ │ └── US_zipcodes.csv
├── composer.json
├── etc
│ ├── db_schema.xml
│ └── module.xml
└── registration.php
├── ShowHeaderFooteronCheckout
├── README.md
├── etc
│ └── module.xml
├── registration.php
└── view
│ └── frontend
│ └── layout
│ └── checkout_index_index.xml
├── SnippetsNotes
├── AllDataBaseOperations.md
├── DeveloperDebuggingScripts.md
├── FindCommands.md
├── GraphQl.md
├── InterviewQuestions.md
├── Linux.md
├── MagentoSQLReport.md
├── Misc.md
├── ObjectManagerOrRootScripts.md
├── Phpcs.md
├── TODO -- Replace Deprecated Functions.md
├── TODO--DateTime.md
├── TODO--DbSchema.md
├── TODO--PHPShortHand.md
├── TODO-File-Directory.md
├── TODO-Plugin-Preference.md
├── TerminalCommands.md
└── m2Install.md
├── SystemXML
├── Block
│ └── Adminhtml
│ │ ├── Form
│ │ └── Field
│ │ │ ├── ColorPicker.php
│ │ │ ├── DatePicker.php
│ │ │ ├── DeliveryTime.php
│ │ │ ├── Ranges.php
│ │ │ ├── TaxColumn.php
│ │ │ └── TimeSlider.php
│ │ └── System
│ │ └── Config
│ │ └── CheckUrl.php
├── Model
│ ├── Adminhtml
│ │ └── System
│ │ │ └── Config
│ │ │ ├── Backend
│ │ │ └── ReindexCron.php
│ │ │ └── Source
│ │ │ └── CronFrequencyTypes.php
│ └── Config
│ │ ├── FrontendModel
│ │ ├── DeliveryTime.php
│ │ └── TimeSlider.php
│ │ └── Source
│ │ ├── DynamicComment.php
│ │ └── Own.php
├── README.md
├── etc
│ ├── acl.xml
│ ├── adminhtml
│ │ └── system.xml
│ ├── config.xml
│ └── module.xml
├── registration.php
└── view
│ └── adminhtml
│ ├── layout
│ └── adminhtml_system_config_edit.xml
│ ├── templates
│ └── form
│ │ └── renderer
│ │ └── timeslider.phtml
│ └── web
│ └── css
│ └── style.css
├── WPPasswordConverter
├── Helper
│ └── Data.php
├── Observer
│ └── UpgradeCustomerPasswordObserver.php
├── Plugin
│ └── Graphql
│ │ └── Magento
│ │ └── Integration
│ │ └── Model
│ │ └── CustomerTokenService.php
├── README.md
├── etc
│ ├── di.xml
│ ├── events.xml
│ ├── graphql
│ │ └── di.xml
│ └── module.xml
└── registration.php
├── WidgetFeaturedCategories
├── Block
│ └── Widget
│ │ └── FeaturedCategories.php
├── composer.json
├── etc
│ ├── module.xml
│ └── widget.xml
├── registration.php
└── view
│ └── frontend
│ └── templates
│ └── widget
│ └── categories.phtml
└── media
├── AdminProductLinksBundleProductView.png
├── AdminProductLinksCategoryView.png
├── AdminProductLinksCrosssellUpsellRelated.png
├── AdminProductLinksOrderView.png
├── ChangeLogo.gif
├── MagentoGraphQlOrderFlowTester.gif
├── MassProductUpdate.png
└── OrderGridExport.png
/AdminProductLinks/Block/Adminhtml/Category/Tab/Product.php:
--------------------------------------------------------------------------------
1 | addColumnAfter(
35 | 'name',
36 | [
37 | 'header' => __('Name'),
38 | 'renderer' => \Theshreyas\AdminProductLinks\Block\Adminhtml\ProductNameUrlRenderer::class,
39 | 'index' => 'name'
40 | ],
41 | 'entity_id'
42 | );
43 | $this->addColumnsOrder('name', 'entity_id')->sortColumnsByOrder();
44 | return $this;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/AdminProductLinks/Block/Adminhtml/ProductNameUrlRenderer.php:
--------------------------------------------------------------------------------
1 | helper->getProductUrl($row->getEntityId());
27 | return ''.$row->getName().'';
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/AdminProductLinks/Helper/Data.php:
--------------------------------------------------------------------------------
1 | helper->getUrl('catalog/product/edit', ['id' => $productId]);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/AdminProductLinks/Plugin/Backend/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php:
--------------------------------------------------------------------------------
1 | $v) {
31 | if (empty($v['bundle_options']['bundle_options'])) {
32 | continue;
33 | }
34 |
35 | foreach ($v['bundle_options']['bundle_options'] as $k2 => $v2) {
36 | if (empty($v2['bundle_selections']) || !is_array($v2['bundle_selections'])) {
37 | continue;
38 | }
39 |
40 | foreach ($v2['bundle_selections'] as $k3 => $child) {
41 | if (isset($child['product_id'])) {
42 | $url = $this->helper->getProductUrl($child['product_id']);
43 | $urlHtml = '' . $child['name']. '';
44 | $result[$k]['bundle_options']['bundle_options'][$k2]['bundle_selections'][$k3]['name'] = $urlHtml;
45 | }
46 | }
47 | }
48 | }
49 | return $result;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/AdminProductLinks/README.md:
--------------------------------------------------------------------------------
1 | # Mage2 Module Admin Product Links
2 |
3 | ## Tested on 2.4.7-p2
4 |
5 | This module adds product links in the following sections at the backend panel:
6 |
7 | 1. Under Category, category products grid
8 | 2. On Order view page, in order items table
9 | 3. On Product view page, for Bundle Product & Grouped Product children items (For configurable its already there)
10 | 4. On Product View page, for Related Products, UpSell Products, CrossSell Products
11 |
12 | No need to search the product manually.
13 |
14 | Raise issue for any bug/feature request.
15 |
16 | ## Screenshots
17 | 
18 |
19 | 
20 |
21 | 
22 |
--------------------------------------------------------------------------------
/AdminProductLinks/Ui/Component/Listing/Column/UrlRenderer.php:
--------------------------------------------------------------------------------
1 | helper->getProductUrl($item['entity_id']);
37 | $item['name'] = ''.$item['name'].'';
38 | }
39 | }
40 |
41 | return $dataSource;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/AdminProductLinks/etc/adminhtml/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/AdminProductLinks/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/AdminProductLinks/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/AdminProductLinks/view/adminhtml/ui_component/crosssell_product_listing.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | true
7 | ui/grid/cells/html
8 | text
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/AdminProductLinks/view/adminhtml/ui_component/related_product_listing.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | true
7 | ui/grid/cells/html
8 | text
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/AdminProductLinks/view/adminhtml/ui_component/upsell_product_listing.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | true
7 | ui/grid/cells/html
8 | text
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Adminlogo/README.md:
--------------------------------------------------------------------------------
1 | # Magento 2 Admin Logo
2 | This module is used for adding custom logos in the admin
3 |
4 |
5 | # Features
6 | - Change admin login page logo
7 | - Change admin dashboard logo
8 | - Add logo to custom menu
9 | - Add logo to the system configuration section
10 |
11 |
12 | # Installation Instruction
13 | ```
14 | - Copy the content of the repo to the Magento 2 app/code/Theshreyas/Adminlogo
15 | - Run command: php bin/magento setup:upgrade
16 | - Run command: php bin/magento setup:di:compile
17 | - Run Command: php bin/magento setup:static-content:deploy
18 | - Now Flush Cache: php bin/magento cache:flush
19 | ```
20 | 
21 |
22 |
23 | If you want to change the default hexagonal icon for custom modules check this :
24 | https://webkul.com/blog/magento-2-change-default-icon-in-menu-for-custom-module/
25 |
--------------------------------------------------------------------------------
/Adminlogo/etc/adminhtml/menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
11 |
26 |
27 |
--------------------------------------------------------------------------------
/Adminlogo/etc/adminhtml/system.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | new
10 | Theshreyas_Adminlogo::config_theshreyas_adminlogo
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Adminlogo/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Adminlogo/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Theshreyas_Adminlogo/images/logo-wide.png
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Adminlogo/view/adminhtml/layout/default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Theshreyas_Adminlogo/images/logo-square.png
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Adminlogo/view/adminhtml/web/css/theshreyas.less:
--------------------------------------------------------------------------------
1 | .admin__menu .item-theshreyas > a:before {
2 | content: '' !important;
3 | background: url(../images/theshreyas_logo.png) no-repeat 50% 50%;
4 | background-size: 35px auto;
5 | height:40px !important;
6 | }
7 | .config-nav-block.adminlogonew strong:before {
8 | background: url(../images/logo.svg) no-repeat;
9 | width: 16px;
10 | height: 16px;
11 | content: '';
12 | display: inline-block;
13 | margin-right: 12px;
14 | vertical-align: bottom;
15 | }
16 |
--------------------------------------------------------------------------------
/Adminlogo/view/adminhtml/web/images/logo-square.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/theshreyas/magento-2-quickies/e307ac61d46266d07e3d05d5b381c54b65d43e43/Adminlogo/view/adminhtml/web/images/logo-square.png
--------------------------------------------------------------------------------
/Adminlogo/view/adminhtml/web/images/logo-wide.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/theshreyas/magento-2-quickies/e307ac61d46266d07e3d05d5b381c54b65d43e43/Adminlogo/view/adminhtml/web/images/logo-wide.png
--------------------------------------------------------------------------------
/Adminlogo/view/adminhtml/web/images/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Adminlogo/view/adminhtml/web/images/theshreyas_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/theshreyas/magento-2-quickies/e307ac61d46266d07e3d05d5b381c54b65d43e43/Adminlogo/view/adminhtml/web/images/theshreyas_logo.png
--------------------------------------------------------------------------------
/CatalogDeleteACL/Helper/Data.php:
--------------------------------------------------------------------------------
1 | getStoreId();
33 | }
34 | return $this->scopeConfig->getValue($path, ScopeInterface::SCOPE_STORE, $storeId);
35 | }
36 |
37 | /**
38 | * @return string
39 | * @throws \Magento\Framework\Exception\NoSuchEntityException
40 | */
41 | public function getProductDeleteConfig()
42 | {
43 | return $this->getStoreConfig(self::PRODUCT_DELETE_ACCESS);
44 | }
45 |
46 | /**
47 | * @return string
48 | * @throws \Magento\Framework\Exception\NoSuchEntityException
49 | */
50 | public function getCategoryDeleteConfig()
51 | {
52 | return $this->getStoreConfig(self::CATEGORY_DELETE_ACCESS);
53 | }
54 |
55 | /**
56 | * @return int
57 | * @throws \Magento\Framework\Exception\NoSuchEntityException
58 | */
59 | public function getStoreId()
60 | {
61 | return $this->storeManager->getStore()->getId();
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/CatalogDeleteACL/Plugin/AclTreeDisplay.php:
--------------------------------------------------------------------------------
1 | helper->getProductDeleteConfig();
30 | $CategoryDeleteAccess = $this->helper->getCategoryDeleteConfig();
31 | if (!$ProductDeleteAccess) {
32 | $this->findAndRemoveAcl($result, self::PRODUCT_DELETE);
33 | }
34 | if (!$CategoryDeleteAccess) {
35 | $this->findAndRemoveAcl($result, self::CATEGORY_DELETE);
36 | }
37 | return $result;
38 | }
39 |
40 | /**
41 | * @param array $result
42 | * @param string $unwantedKey
43 | * @return bool
44 | */
45 | public function findAndRemoveAcl(&$result, $unwantedKey)
46 | {
47 | try {
48 | foreach ($result as $key => &$child) {
49 | if ($child['id'] === $unwantedKey) {
50 | unset($result[$key]);
51 | return true;
52 | }
53 | $this->findAndRemoveAcl($child['children'], $unwantedKey);
54 | }
55 | } catch (\Exception $e) {
56 | return false;
57 | }
58 | return false;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/CatalogDeleteACL/Plugin/CategoryDeleteAction.php:
--------------------------------------------------------------------------------
1 | helper->getCategoryDeleteConfig();
33 | if ($CategoryDeleteAccess && !$this->authorization->isAllowed(self::ACL_RESOURCE)) {
34 | return [];
35 | }
36 | return $result;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/CatalogDeleteACL/Plugin/CategoryDeleteBefore.php:
--------------------------------------------------------------------------------
1 | helper->getCategoryDeleteConfig();
34 | if ($CategoryDeleteAccess && !$this->authorization->isAllowed(self::ACL_RESOURCE)) {
35 | throw new LocalizedException(__('You don\'t have permission for this operation.'));
36 | }
37 | return [$categoryId];
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/CatalogDeleteACL/Plugin/ProductDeleteBefore.php:
--------------------------------------------------------------------------------
1 | helper->getProductDeleteConfig();
33 | if ($productDeleteAccess && !$this->authorization->isAllowed(self::ACL_RESOURCE)) {
34 | throw new \Magento\Framework\Exception\AuthorizationException(__('You don\'t have permission for this operation.'));
35 | }
36 | return [$sku];
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/CatalogDeleteACL/Plugin/ProductDeleteMassAction.php:
--------------------------------------------------------------------------------
1 | helper->getProductDeleteConfig();
37 | if ($productDeleteAccess && !$this->authorization->isAllowed(self::ACL_RESOURCE)) {
38 | return false;
39 | }
40 | }
41 | return $result;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/CatalogDeleteACL/etc/acl.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/CatalogDeleteACL/etc/adminhtml/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/CatalogDeleteACL/etc/adminhtml/system.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Theshreyas
10 | Theshreyas_AdvancedImport::config_Theshreyas_CatalogDeleteACL
11 |
12 |
13 |
14 |
15 | Magento\Config\Model\Config\Source\Yesno
16 |
17 |
18 |
19 | Magento\Config\Model\Config\Source\Yesno
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/CatalogDeleteACL/etc/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 0
7 | 0
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/CatalogDeleteACL/etc/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CatalogDeleteACL/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/CatalogDeleteACL/registration.php:
--------------------------------------------------------------------------------
1 | pageDataProvider = $pageDataProvider;
26 | $this->_storeManager = $storeManager;
27 | parent::__construct($context, $data);
28 | }
29 |
30 | protected function _prepareLayout()
31 | {
32 | return parent::_prepareLayout();
33 | }
34 |
35 | public function getOgImageUrl()
36 | {
37 | $page_id = $this->getRequest()->getParam('page_id');
38 | $_ogimage = "";
39 | if ($page_id) {
40 | $pageData = $this->pageDataProvider->getDataByPageId((int) $page_id);
41 | $_ogimage = $pageData['featured_image'];
42 | if ($_ogimage != "") {
43 | $media_url = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
44 | $_ogimage = $media_url . "cms/featuredimage/" . $_ogimage;
45 | }
46 | }
47 |
48 | return $_ogimage;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/CmsImage/Controller/Adminhtml/Cms/Featuredimage/Upload.php:
--------------------------------------------------------------------------------
1 | imageUploader = $imageUploader;
26 | }
27 |
28 | /**
29 | * Upload file controller action
30 | *
31 | * @return \Magento\Framework\Controller\ResultInterface
32 | */
33 | public function execute()
34 | {
35 | try {
36 | $this->imageUploader->setBaseTmpPath('cms/featuredimage');
37 | // $this->imageUploader->setBasePath('cms/featuredimage');
38 | $result = $this->imageUploader->saveFileToTmpDir('featured_image');
39 |
40 | $result['cookie'] = [
41 | 'name' => $this->_getSession()->getName(),
42 | 'value' => $this->_getSession()->getSessionId(),
43 | 'lifetime' => $this->_getSession()->getCookieLifetime(),
44 | 'path' => $this->_getSession()->getCookiePath(),
45 | 'domain' => $this->_getSession()->getCookieDomain(),
46 | ];
47 | } catch (\Exception $e) {
48 | $result = ['error' => $e->getMessage(), 'errorcode' => $e->getCode()];
49 | }
50 | return $this->resultFactory->create(ResultFactory::TYPE_JSON)->setData($result);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/CmsImage/Model/Resolver/FeaturedImage.php:
--------------------------------------------------------------------------------
1 | resourceConnection = $resourceConnection;
42 | $this->_storeManager = $storeManager;
43 | }
44 | /**
45 | * @inheritdoc
46 | */
47 | public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
48 | {
49 | $connection = $this->resourceConnection->getConnection();
50 |
51 | $tableName = $connection->getTableName(self::CMS_TABLE);
52 |
53 | $query = $connection->select()
54 | ->from($tableName, ['featured_image'])
55 | ->where('identifier = ?', $value['identifier']);
56 | // ->where('page_id = ?', (int) $value['page_id']);//page_id deprecated
57 |
58 | $fetchData = $connection->fetchRow($query);
59 | if (isset($fetchData['featured_image']) && $fetchData['featured_image'] != "") {
60 |
61 | $FeaturedImage = $fetchData['featured_image'];
62 | return $FeaturedImage;
63 | // $media_url = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
64 | // return $media_url.'cms/featuredimage/'.$FeaturedImage;
65 | } else {
66 | return "";
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/CmsImage/Plugin/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php:
--------------------------------------------------------------------------------
1 | pageRepository = $pageRepository;
24 | }
25 |
26 | public function afterGetDataByPageIdentifier(
27 | \Magento\CmsGraphQl\Model\Resolver\DataProvider\Page $subject,
28 | $result
29 | ) {
30 | if ($result && isset($result[PageInterface::PAGE_ID])) {
31 | $page = $this->pageRepository->getById($result[PageInterface::PAGE_ID]);
32 | $result['featured_image'] = $page->getFeaturedImage();
33 | }
34 | return $result;
35 | }
36 |
37 | public function afterGetDataByPageId(
38 | \Magento\CmsGraphQl\Model\Resolver\DataProvider\Page $subject,
39 | $result
40 | ) {
41 | if ($result && isset($result[PageInterface::PAGE_ID])) {
42 | $page = $this->pageRepository->getById($result[PageInterface::PAGE_ID]);
43 | $result['featured_image'] = $page->getFeaturedImage();
44 | }
45 | return $result;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/CmsImage/README.md:
--------------------------------------------------------------------------------
1 | # Theshreyas CmsImage OG Image Attribute
2 |
3 | Add Image attribute in cms page edit, and use it in magento frontend/pwa.
--------------------------------------------------------------------------------
/CmsImage/etc/adminhtml/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/CmsImage/etc/adminhtml/routes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CmsImage/etc/db_schema.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
--------------------------------------------------------------------------------
/CmsImage/etc/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/CmsImage/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/CmsImage/etc/schema.graphqls:
--------------------------------------------------------------------------------
1 | type CmsPage @doc(description: "CMS page defines all CMS page information") {
2 | featured_image : String
3 | }
--------------------------------------------------------------------------------
/CmsImage/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/CmsImage/view/adminhtml/web/template/image-preview.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
14 |
22 |
23 |
24 |
25 |
26 |
27 | x
28 |
29 |
--------------------------------------------------------------------------------
/CmsImage/view/frontend/layout/cms_page_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/CmsImage/view/frontend/templates/ogimage.phtml:
--------------------------------------------------------------------------------
1 | getOgImageUrl();
4 | if ($_ogimage != ""):
5 | ?>
6 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/CustomerDataSync/Helper/AddressDataSync.php:
--------------------------------------------------------------------------------
1 | appState->getAreaCode();
30 | if ($areaCode === 'webapi_rest' || $areaCode === 'global') {
31 | $addresses = $customer->getAddresses();
32 | $currentTimestamp = $this->timezone->date()->format('Y-m-d H:i:s');
33 | $customer->setCustomAttribute(self::DATA_SYNC, $currentTimestamp);
34 | if ($addresses) {
35 | $addressList = [];
36 | foreach ($addresses as $address) {
37 | $addressList[] = $address->setCustomAttribute(self::DATA_SYNC, $currentTimestamp);
38 | }
39 | $customer->setAddresses($addressList);
40 | }
41 | }
42 | return $customer;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/CustomerDataSync/Plugin/CreateAccountPlugin.php:
--------------------------------------------------------------------------------
1 | addressDataSync->setDataSync($customer);
30 | return [$customer];
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/CustomerDataSync/Plugin/CustomerRepositoryPlugin.php:
--------------------------------------------------------------------------------
1 | addressDataSync->setDataSync($customer);
32 | return [$customer];
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/CustomerDataSync/README.md:
--------------------------------------------------------------------------------
1 | # CustomerDataSync
2 |
3 | This module adds `data_sync` fields in customer and customer_address, and updates it with timestamp values whenever customer or address is created or updated via APIs.
--------------------------------------------------------------------------------
/CustomerDataSync/etc/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
10 |
11 |
--------------------------------------------------------------------------------
/CustomerDataSync/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/CustomerDataSync/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/CustomerDataSync/view/base/ui_component/customer_form.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/CustomerImportDisableEmail/README.md:
--------------------------------------------------------------------------------
1 | # Disable Customer Welcome Email
2 | ## Tested on 2.4.7-p2
3 |
4 | This module disables customer welcome email based on custom backend settings
5 | (Customers -> Customer Configuration -> Create New Account Options -> Welcome Email Enabled)
6 |
7 | Also, on default bulk customer import rest api, it disables customer welcome email (Irrespective of the above backend configuration)
--------------------------------------------------------------------------------
/CustomerImportDisableEmail/etc/adminhtml/system.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Magento\Config\Model\Config\Source\Yesno
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/CustomerImportDisableEmail/etc/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CustomerImportDisableEmail/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/CustomerImportDisableEmail/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | %s%'.05d%s
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/FormatIncrementId/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/FormatIncrementId/registration.php:
--------------------------------------------------------------------------------
1 | scopeConfig->getValue(
17 | 'admin/frontend_disable/show_as_frontend',
18 | ScopeInterface::SCOPE_WEBSITE
19 | );
20 | }
21 | /**
22 | * Get Custom URL from config
23 | */
24 | public function getCustomUrl()
25 | {
26 | return $this->scopeConfig->getValue(
27 | 'admin/frontend_disable/custom_url',
28 | ScopeInterface::SCOPE_WEBSITE
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/FrontendDisable/Model/Config/Source/Custom.php:
--------------------------------------------------------------------------------
1 | 0, 'label' => __('Normal')],
12 | ['value' => 1, 'label' => __('Blank Page')],
13 | ['value' => 2, 'label' => __('Redirect to Home Page')],
14 | ['value' => 3, 'label' => __('Redirect to Admin')],
15 | ['value' => 4, 'label' => __('Custom URL')]
16 | ];
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/FrontendDisable/Observer/FrontendDisable.php:
--------------------------------------------------------------------------------
1 | Configuration > Advanced > Admin > Disable Frontend
26 | *
27 | */
28 | public function execute(\Magento\Framework\Event\Observer $observer)
29 | {
30 |
31 | $configType = $this->frontendDisableHelper->getConfigType();
32 |
33 | if ($configType != 0) {
34 |
35 | $this->actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
36 |
37 | $controller = $observer->getControllerAction();
38 |
39 | if ($configType == 2) {
40 | $this->redirect->redirect($controller->getResponse(), $this->storeManager->getStore()->getBaseUrl());
41 | }
42 | if ($configType == 3) {
43 | $this->redirect->redirect($controller->getResponse(), $this->helperBackend->getHomePageUrl());
44 | }
45 | if ($configType == 4) {
46 | $this->redirect->redirect($controller->getResponse(), $this->frontendDisableHelper->getCustomUrl());
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/FrontendDisable/etc/adminhtml/system.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Theshreyas\FrontendDisable\Model\Config\Source\Custom
10 |
11 |
12 |
13 |
14 | 4
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/FrontendDisable/etc/frontend/events.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/FrontendDisable/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/FrontendDisable/registration.php:
--------------------------------------------------------------------------------
1 | scopeConfig = $scopeConfig;
19 | }
20 |
21 | /**
22 | * @inheritdoc
23 | */
24 | public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) {
25 | $storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
26 |
27 | $merchant_id = $this->scopeConfig->getValue('payment/amazon_payment/merchant_id', $storeScope);
28 | $client_id = $this->scopeConfig->getValue('payment/amazon_payment/client_id', $storeScope);
29 | $sandbox = $this->scopeConfig->getValue('payment/amazon_payment/sandbox', $storeScope);
30 | $payment_region = $this->scopeConfig->getValue('payment/amazon_payment/payment_region', $storeScope);
31 | $button_color = $this->scopeConfig->getValue('payment/amazon_payment/button_color', $storeScope);
32 | $button_size = $this->scopeConfig->getValue('payment/amazon_payment/button_size', $storeScope);
33 |
34 | return [
35 | 'merchant_id' => $merchant_id,
36 | 'client_id' => $client_id,
37 | 'sandbox' => $sandbox,
38 | 'payment_region' => $payment_region,
39 | 'button_color' => $button_color,
40 | 'button_size' => $button_size,
41 | ];
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/GraphQl/Amazonpay/README.md:
--------------------------------------------------------------------------------
1 | # Theshreyas Amazonpay GraphQl Module
2 |
3 | Tested on 2.3.5-p2
--------------------------------------------------------------------------------
/GraphQl/Amazonpay/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "theshreyas/module-amazonpay",
3 | "description": "",
4 | "type": "magento2-module",
5 | "license": "OSL-3.0",
6 | "authors": [
7 | {
8 | "name": "Shreyas",
9 | "email": "shr3yas3@gmail.com"
10 | }
11 | ],
12 | "minimum-stability": "dev",
13 | "require": {},
14 | "autoload": {
15 | "psr-4": {
16 | "Theshreyas\\Amazonpay\\": ""
17 | },
18 | "files": [
19 | "registration.php"
20 | ]
21 | }
22 | }
--------------------------------------------------------------------------------
/GraphQl/Amazonpay/etc/graphql/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/GraphQl/Amazonpay/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/GraphQl/Amazonpay/etc/schema.graphqls:
--------------------------------------------------------------------------------
1 | type Query {
2 | amazon_pay_config : AmazonPayConfig @resolver(class:"\\Theshreyas\\Amazonpay\\Model\\Resolver\\AmazonPayConfig") @doc(description: "The Amazon Pay details.")
3 | getAmazonShippingAddress(input: AmazonAddressInput) : AmazonAddressOutput @resolver(class: "\\Theshreyas\\Amazonpay\\Model\\Resolver\\AmazonShippingAddress")
4 | getAmazonBillingAddress(input: AmazonAddressInput) : AmazonAddressOutput @resolver(class: "\\Theshreyas\\Amazonpay\\Model\\Resolver\\AmazonBillingAddress")
5 | }
6 |
7 | type Mutation {
8 | placeAmazonOrder(input: PlaceOrderInput): PlaceOrderOutput @resolver(class: "\\Theshreyas\\Amazonpay\\Model\\Resolver\\AmazonPay\\AmazonPlaceOrder")
9 | }
10 | input AmazonAddressInput {
11 | cart_id: String!
12 | amazonOrderReferenceId: String @Doc(description: "amazonOrderReferenceId"),
13 | addressConsentToken: String @Doc(description: "addressConsentToken")
14 | }
15 | type AmazonAddressOutput {
16 | city: String!
17 | firstname: String!
18 | lastname: String!
19 | country_id: String!
20 | street: [String!]!
21 | postcode: String!
22 | company: String!
23 | telephone: String!
24 | region: String!
25 | region_id: String!
26 | region_code: String!
27 | }
28 | type AmazonPayConfig {
29 | merchant_id: String @doc(description: "merchant_id")
30 | client_id: String @doc(description: "client_id")
31 | sandbox: String @doc(description: "sandbox")
32 | payment_region: String @doc(description: "payment_region")
33 | button_color: String @doc(description: "button_color")
34 | button_size: String @doc(description: "button_size")
35 | }
--------------------------------------------------------------------------------
/GraphQl/Amazonpay/registration.php:
--------------------------------------------------------------------------------
1 | _productRepository = $productRepository;
24 | }
25 | /**
26 | * @inheritdoc
27 | */
28 | public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
29 | {
30 | if (!isset($args['fields'])) {
31 | throw new GraphQlInputException(__('Input parameter "fields" is missing'));
32 | }
33 | $product = $this->_productRepository->getById($value['entity_id']);
34 | $data = [];
35 | foreach ($args['fields'] as $fi) {
36 | $att = $product->getResource()->getAttribute($fi);
37 | if (isset($att) && $att) {
38 | if (in_array(
39 | $att->getFrontendInput(),
40 | ['multiselect', 'select']
41 | )) {
42 | $data[$fi . '_label'] = $product->getAttributeText($fi);
43 | }
44 | $data[$fi] = $product->getData($fi);
45 | }
46 | }
47 | return json_encode((object) $data);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/GraphQl/DynamicAttributesGraphql/README.md:
--------------------------------------------------------------------------------
1 | # Overview
2 |
3 | ## Dynamic Attribute Text Values
4 |
5 | Graphql products query returns only ids for select or multiselect fields. This is quickfix which will allow to get Text Labels as well as Id Values.
6 | Compatible with Magento Community and Enterprise, versions 2.3.x - 2.4.x.
7 |
8 | # Installation Instructions
9 |
10 | ## Install by copying files
11 |
12 | 1. Create an `app/code/Theshreyas/DynamicAttributesGraphql` directory in your Magento installation.
13 | 2. Download the latest "Source code" from this page: [https://github.com/theshreyas/magento-2-quickies/tree/main/Graphql/DynamicAttributesGraphql](https://github.com/theshreyas/magento-2-quickies/tree/main/Graphql/DynamicAttributesGraphql)
14 | 3. Extract the file and copy the contents into the `app/code/Theshreyas/DynamicAttributesGraphql` directory.
15 | 4. Run following commands from your root Magento installation directory:
16 |
17 | ```
18 | bin/magento module:enable --clear-static-content Theshreyas_DynamicAttributesGraphql
19 | bin/magento setup:upgrade
20 | bin/magento cache:flush
21 | ```
22 | # Usage
23 |
24 | ## Graphql Input Payload
25 | ```
26 | {
27 | products(filter: {sku: {eq: "testProduct"}}) {
28 | items {
29 | sku
30 | fabric
31 | work
32 | dynamicAttributes(fields: ["fabric","work"])
33 | }
34 | }
35 | }
36 | ```
37 | ## Output Response
38 |
39 | ```
40 | "sku": "testProduct",
41 | "fabric": 60,
42 | "work": 65,
43 | "dynamicAttributes": "{
44 | "fabric_label":"Pure Silk",
45 | "fabric":"60",
46 | "work_label":"Tanchoi",
47 | "work":"65"
48 | }",
49 | ```
50 | You can customize according to your needs & retrieve the data at frontend from the json accordingly.
--------------------------------------------------------------------------------
/GraphQl/DynamicAttributesGraphql/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/GraphQl/DynamicAttributesGraphql/etc/schema.graphqls:
--------------------------------------------------------------------------------
1 | interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\\ProductInterfaceTypeResolverComposite") @doc(description: "The ProductInterface contains attributes that are common to all types of products. Note that descriptions may not be available for custom and EAV attributes.") {
2 | dynamicAttributes(
3 | fields: [String]
4 | ): String @resolver(class: "\\Theshreyas\\DynamicAttributesGraphql\\Model\\Resolver\\Product\\DynamicAttributes") @doc(description: "Filterable attribute with Text")
5 | }
--------------------------------------------------------------------------------
/GraphQl/DynamicAttributesGraphql/registration.php:
--------------------------------------------------------------------------------
1 | productResourceModel = $productResourceModel;
41 | $this->productFactory = $productFactory;
42 | }
43 |
44 | /**
45 | * Get list of products by IDs with full data set
46 | *
47 | * @param array $productIds
48 | * @param array $attributeCodes
49 | * @return ProductInterface[]|Product[]
50 | */
51 | public function getProductByIds(array $productIds, array $attributeCodes): array
52 | {
53 | $products = [];
54 |
55 | foreach ($productIds as $productId) {
56 | /** @var Product $product */
57 | $product = $this->productFactory->create();
58 | $this->productResourceModel->load($product, $productId, $attributeCodes);
59 | if($product->getId()){
60 | $products[] = $product;
61 | }
62 | }
63 |
64 | return $products;
65 | }
66 | }
--------------------------------------------------------------------------------
/GraphQl/FetchProductById/Model/Resolver/Product/DataProvider/ProductDataProviderInterface.php:
--------------------------------------------------------------------------------
1 | cacheTag, implode('_', $resolvedData['ids'])];
33 | }
34 | }
--------------------------------------------------------------------------------
/GraphQl/FetchProductById/Model/Resolver/ProductId.php:
--------------------------------------------------------------------------------
1 | productDataProvider = $productDataProvider;
43 | $this->productFieldsSelector = $productFieldsSelector;
44 | }
45 |
46 | /**
47 | * @inheritdoc
48 | */
49 | public function resolve(
50 | Field $field,
51 | $context,
52 | ResolveInfo $info,
53 | array $value = null,
54 | array $args = null
55 | ) {
56 | $productIds = ($args['ids'] ?? []);
57 | $fields = $this->productFieldsSelector->getProductFieldsFromInfo($info);
58 |
59 | /** @var \Magento\Catalog\Model\Product[] $products */
60 | $products = $this->productDataProvider->getProductByIds($productIds, $fields);
61 | $data = [];
62 |
63 | foreach ($products as $product) {
64 | $productData = $product->getData();
65 | $productData['model'] = $product;
66 | $data[] = $productData;
67 | }
68 |
69 | return $data;
70 | }
71 | }
--------------------------------------------------------------------------------
/GraphQl/FetchProductById/etc/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/GraphQl/FetchProductById/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/GraphQl/FetchProductById/etc/schema.graphqls:
--------------------------------------------------------------------------------
1 | type Query {
2 | product (
3 | ids: [ID!]! @doc(description: "Product IDs.")
4 | ): [ProductInterface]
5 | @resolver(class: "Growisto\\CatalogGraphQl\\Model\\Resolver\\ProductId") @doc(description: "The product query fetches products that match the specified IDs.") @cache(cacheIdentity: "Growisto\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductIdIdentity")
6 |
7 | }
--------------------------------------------------------------------------------
/GraphQl/FetchProductById/registration.php:
--------------------------------------------------------------------------------
1 | _objectManager = $objectManager;
22 | }
23 |
24 | /**
25 | * Create class instance with specified parameters
26 | *
27 | * @param string $className
28 | * @param array $data
29 | * @return \Razorpay\Magento\Model\PaymentMethod
30 | */
31 | public function create($className, array $data = [])
32 | {
33 | return $this->_objectManager->create($className, $data);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/Model/LogHandler.php:
--------------------------------------------------------------------------------
1 | _localeDate = $localeDate;
42 | $corefilesystem= $corefilesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
43 | $logpath = $corefilesystem->getAbsolutePath('log/Razorpay/');
44 |
45 |
46 | // Custom log file name for each day because log will be full for optimization
47 | $filename = 'rzp_'.Date('Y_m_d').'.log';
48 |
49 | $filepath = $logpath . $filename;
50 |
51 | $this->cutomfileName = $filepath;
52 |
53 | parent::__construct(
54 | $filesystem,
55 | $filepath
56 | );
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/Model/OrderLink.php:
--------------------------------------------------------------------------------
1 | _init(\Razorpay\Magento\Model\ResourceModel\OrderLink::class);
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/Model/PaymentAction.php:
--------------------------------------------------------------------------------
1 | \Razorpay\Magento\Model\PaymentMethod::ACTION_AUTHORIZE,
17 | 'label' => __('Authorize Only'),
18 | ],
19 | [
20 | 'value' => \Razorpay\Magento\Model\PaymentMethod::ACTION_AUTHORIZE_CAPTURE,
21 | 'label' => __('Authorize and Capture')
22 | ]
23 | ];
24 | }
25 | }
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/Model/ResourceModel/OrderLink.php:
--------------------------------------------------------------------------------
1 | _init(static::TABLE_NAME, 'entity_id');
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/Model/ResourceModel/OrderLink/Collection.php:
--------------------------------------------------------------------------------
1 | _init('Razorpay\Magento\Model\OrderLink', 'Razorpay\Magento\Model\ResourceModel\OrderLink');
17 | }
18 | }
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/Model/WebhookUrl.php:
--------------------------------------------------------------------------------
1 | _storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB);
15 | $copyButton = "Copy Url
17 |
36 | ";
37 |
38 | $element->setComment("*Please use below url for webhook* " . $baseUrl . "razorpay/payment/webhook" . $copyButton );
39 |
40 | return $element->getElementHtml();
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/Plugin/CsrfValidatorSkip.php:
--------------------------------------------------------------------------------
1 | getModuleName() == 'razorpay') {
18 | return; // Skip CSRF check
19 | }
20 | $proceed($request, $action); // Proceed Magento 2 core functionalities
21 | }
22 | }
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "razorpay/magento",
3 | "description": "Razorpay Magento 2.0 plugin for accepting payments.",
4 | "version": "3.4.1",
5 | "require": {
6 | "php": "~5.5.0|~5.6.0|^7.0",
7 | "razorpay/razorpay": "2.*"
8 | },
9 | "keywords": [
10 | "razorpay",
11 | "magento",
12 | "payments",
13 | "india",
14 | "payment gateway",
15 | "wallets",
16 | "netbanking"
17 | ],
18 | "authors": [
19 | {
20 | "name": "Team Razorpay",
21 | "homepage": "https://razorpay.com/about/",
22 | "role": "Developer"
23 | }
24 | ],
25 | "support": {
26 | "source": "https://github.com/razorpay/razorpay-magento",
27 | "issues": "https://razorpay.com/support/",
28 | "rss": "https://github.com/razorpay/razorpay-magento/releases.atom",
29 | "docs":
30 | "https://docs.razorpay.com/v1/page/integrating-your-magento-store-with-razorpay"
31 | },
32 | "homepage": "https://razorpay.com",
33 | "suggest": {
34 | "magento/module-checkout-agreements": "100.0.*"
35 | },
36 | "type": "magento2-module",
37 | "license": ["MIT"],
38 | "autoload": {
39 | "files": ["registration.php"],
40 | "psr-4": {
41 | "Razorpay\\Magento\\": ""
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/etc/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Razorpay\Magento\Model\PaymentMethod
7 | Razorpay
8 | Magento
9 | authorize_capture
10 | 0
11 | processing
12 | Key ID
13 | Key Secret
14 | 300
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/etc/csp_whitelist.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 | cdn.razorpay.com
8 |
9 |
10 |
11 |
12 | checkout.razorpay.com
13 |
14 |
15 |
16 |
17 | api.razorpay.com
18 |
19 |
20 |
21 |
22 | lumberjack.razorpay.com
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/etc/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | - Razorpay\Magento\Model\LogHandler
18 |
19 |
20 |
21 |
22 |
23 |
24 | RazorpayLogger
25 |
26 |
27 |
28 |
29 |
30 | RazorpayLogger
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/etc/events.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/etc/frontend/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | - Razorpay\Magento\Model\ConfigProvider
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/etc/frontend/routes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/etc/payment.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | 0
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/etc/schema.graphqls:
--------------------------------------------------------------------------------
1 | type Mutation {
2 | createRazorpayOrder (
3 | cart_id: String @doc(description: "cart_id to generate Razorpay Order.")
4 | ) : RazorpayOrder @resolver( class: "Razorpay\\Magento\\Model\\Resolver\\CreateRazorpayOrder") @doc(description: "Create Razorpay Order.")
5 |
6 | setRzpPaymentDetailsOnCart(input: SetRzpPaymentDetailsOnCartInput): SetRzpPaymentDetailsOnCartOutput @resolver(class: "Razorpay\\Magento\\Model\\Resolver\\SetRzpPaymentDetailsOnCart")
7 | }
8 | type RazorpayOrder {
9 | success: Boolean!
10 | rzp_order: String
11 | order_id: String
12 | amount: String
13 | quote_currency: String
14 | quote_amount: String
15 | message: String
16 | }
17 | input SetRzpPaymentDetailsOnCartInput {
18 | cart_id: String!
19 | rzp_payment_id: String!
20 | rzp_order_id: String!
21 | rzp_signature: String!
22 | }
23 | type SetRzpPaymentDetailsOnCartOutput {
24 | cart: Cart!
25 | }
--------------------------------------------------------------------------------
/GraphQl/Razorpay/Magento/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |

8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/GraphQl/RequestedQtyGraphQlBug/Plugin/Graphql/Magento/QuoteGraphQl/Model/Resolver/Cart.php:
--------------------------------------------------------------------------------
1 | stockRegistry = $stockRegistry;
23 | }
24 |
25 | public function afterResolve(
26 | \Magento\QuoteGraphQl\Model\Resolver\Cart $subject,
27 | $result,
28 | $field,
29 | $context,
30 | $info,
31 | array $value = null,
32 | array $args = null
33 | ) {
34 | $cart = $result['model'];
35 | $deleted = false;
36 |
37 | //$cart->getHasError()
38 | foreach ($cart->getErrors() as $k => $err) {
39 |
40 | if ($err->getText() === 'The requested qty is not available') {
41 |
42 | foreach ($cart->getAllVisibleItems() as $item) {
43 |
44 | $stockItem = $this->stockRegistry->getStockItem($item->getProductId());
45 |
46 | if ($stockItem->getManageStock() && $stockItem->getQty() - $stockItem->getMinQty() - $item->getQty() < 0) {
47 | $item->delete();
48 | $deleted = true;
49 | }
50 | }
51 | if ($deleted == true) {
52 | $cart->getErrors()[$k]->setText('Out of stock products removed from cart.');
53 | }
54 |
55 | }
56 | }
57 | return [
58 | 'model' => $cart,
59 | ];
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/GraphQl/RequestedQtyGraphQlBug/README.md:
--------------------------------------------------------------------------------
1 | ## This is my Hot Fix for the Requested Qty GraphQl Error [GitHub Issue](https://github.com/magento/magento2/issues/33281)
2 |
3 |
4 | Here, I am deleting the complete item from the cart as soon as I find qty error for the particular product. Instead of deleting you can set maximum available quantity as well. Comments welcome.
--------------------------------------------------------------------------------
/GraphQl/RequestedQtyGraphQlBug/etc/graphql/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/GraphQl/RequestedQtyGraphQlBug/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/GraphQl/RequestedQtyGraphQlBug/registration.php:
--------------------------------------------------------------------------------
1 | _customer = $customer;
24 | $this->_storeManager = $storeManager;
25 | $this->_stock = $stock;
26 | $this->resourceConnection = $resourceConnection;
27 |
28 | }
29 |
30 | public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
31 | {
32 | if (!isset($args['email']) || empty($args['email'])) {
33 | throw new GraphQlInputException(__('Email is required.'));
34 | }
35 | $email = trim($args['email']);
36 | try {
37 | $customer = $this->_customer;
38 | $customer->setWebsiteId($this->_storeManager->getWebsite()->getId());
39 | $customer->loadByEmail($email);
40 | if ($customer->getId()) {
41 | $this->_stock->deleteCustomer($customer->getId(), $this->_storeManager->getStore()->getWebsiteId());
42 | }
43 | $connection = $this->resourceConnection->getConnection();
44 | $connection->delete(
45 | 'product_alert_stock',
46 | ['email = ?' => $email]
47 | );
48 |
49 | return [
50 | 'message' => __('You will no longer receive stock alerts.'),
51 | 'status' => true,
52 | ];
53 | } catch (\Exception $e) {
54 |
55 | return [
56 | 'message' => __('Unable to update the alert subscription.'),
57 | 'status' => true,
58 | ];
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/GuestStockAlert/README.md:
--------------------------------------------------------------------------------
1 | # Theshreyas Guest Stock Alert GraphQl Module
2 |
3 | Default Magento 2 does not provide product stock alerts for guests. Here, I have edited existing stock alert table to include email field.
--------------------------------------------------------------------------------
/GuestStockAlert/Rewrite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Stock.php:
--------------------------------------------------------------------------------
1 | getRequest()->getParam('id');
15 | $websiteId = 0;
16 | if ($store = $this->getRequest()->getParam('store')) {
17 | $websiteId = $this->_storeManager->getStore($store)->getWebsiteId();
18 | }
19 | if ($this->moduleManager->isEnabled('Magento_ProductAlert')) {
20 |
21 | $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
22 | $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
23 | $connection = $resource->getConnection();
24 | $sql = "SELECT '' as firstname,'' as lastname, alert.email, `alert`.`add_date`, `alert`.`send_date`, `alert`.`send_count` from `product_alert_stock` AS `alert` WHERE (alert.product_id=" . $productId . ") and alert.customer_id = 0";
25 | $result = $connection->fetchAll($sql);
26 |
27 | $collection = $this->_stockFactory->create()->getCustomerCollection()->join($productId, $websiteId);
28 | foreach ($collection as $key => $value) {
29 | $result[] = $value->getData();
30 | }
31 | $collection = $objectManager->create('\Magento\Framework\Data\Collection');
32 | foreach ($result as $key => $v) {
33 | $DataObject = new \Magento\Framework\DataObject($v);
34 | $collection->addItem(
35 | $DataObject
36 | );
37 | }
38 | $this->setCollection($collection);
39 | }
40 |
41 | // return parent::_prepareCollection();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/GuestStockAlert/etc/db_schema.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
10 |
14 |
--------------------------------------------------------------------------------
/GuestStockAlert/etc/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/GuestStockAlert/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/GuestStockAlert/etc/schema.graphqls:
--------------------------------------------------------------------------------
1 | type Mutation {
2 | ProductAlertNotifyInStock(input: SubmitInput): ProductAlertNotifyInStockOutput @resolver(class: "Theshreyas\\GuestStockAlert\\Model\\Resolver\\SaveStockAlert") @doc(description: "Guest add new Stock alert.")
3 | ProductAlertUnsubscribe(email: String!): ProductAlertUnsubscribeOutput @resolver(class: "Theshreyas\\GuestStockAlert\\Model\\Resolver\\UnsubscribeStockAlert") @doc(description: "Unsubscribe Stock alert.")
4 | }
5 |
6 | input SubmitInput {
7 | product_id: Int! @doc(description: "The product Id."),
8 | email: String! @doc(description: "The customer Email.")
9 | }
10 |
11 | type ProductAlertNotifyInStockOutput {
12 | message: String @doc(description: "Success or error Message")
13 | id: Int @doc(description: "The Question Id")
14 | }
15 | type ProductAlertUnsubscribeOutput {
16 | message: String @doc(description: "Success or error Message")
17 | status: Boolean @doc(description: "Status Flag")
18 | }
--------------------------------------------------------------------------------
/GuestStockAlert/registration.php:
--------------------------------------------------------------------------------
1 | filter = $filter;
44 | $this->collectionFactory = $collectionFactory;
45 | $this->_productPriceIndexerProcessor = $productPriceIndexerProcessor;
46 | parent::__construct($context, $productBuilder);
47 | }
48 |
49 | /**
50 | * Determine if authorized to perform group actions.
51 | *
52 | * @return bool
53 | */
54 | protected function _isAllowed()
55 | {
56 | return $this->_authorization->isAllowed('Theshreyas_MassProductUpdate::maction');
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/MassProductUpdate/Helper/Data.php:
--------------------------------------------------------------------------------
1 | objectManager = $objectManager;
28 | $this->scopeConfig = $context->getScopeConfig();
29 | $this->connection = $resource->getConnection();
30 | }
31 |
32 | /**
33 | * Get command data array.
34 | * @return array
35 | */
36 | public function getActionDataByName($type)
37 | {
38 | $className = 'Theshreyas\MassProductUpdate\Model\Command\\' . ucfirst($type);
39 | if (class_exists($className)) {
40 | $command = $this->objectManager->create($className);
41 | $result = $command->getCreationData();
42 | $result['url'] = $this->urlBulder->getUrl('theshreyas_massproductupdate/massaction/index');
43 | } else {
44 | /* initialization for delimiter lines*/
45 | $result = [
46 | 'confirm_title' => '',
47 | 'confirm_message' => '',
48 | 'type' => $type,
49 | 'label' => '------------',
50 | 'url' => '',
51 | 'fieldLabel' => ''
52 | ];
53 | }
54 |
55 | return $result;
56 | }
57 |
58 | public function getMassUpdateOptions()
59 | {
60 | return ['modifyprice','modifyspecial','addspecial'];
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/MassProductUpdate/Model/Command.php:
--------------------------------------------------------------------------------
1 | _info)) {
14 | return $this->_info;
15 | } else {
16 | return false;
17 | }
18 | }
19 |
20 | /**
21 | * Gets list of not critical errors after the command execution
22 | *
23 | * @return array
24 | */
25 | public function getErrors()
26 | {
27 | return $this->_errors;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/MassProductUpdate/Model/Command/Addspecial.php:
--------------------------------------------------------------------------------
1 | _type = 'addspecial';
18 | $this->_info = array_merge($this->_info, [
19 | 'confirm_title' => 'Modify Special Price using Price',
20 | 'confirm_message' => 'Are you sure you want to modify special price using price?',
21 | 'type' => $this->_type,
22 | 'label' => 'Modify Special Price using Price'
23 | ]);
24 | }
25 |
26 | protected function _prepareQuery($table, $value, $where)
27 | {
28 | $where[] = 't.`value` > 0 ';
29 | $id = $this->_eavConfig
30 | ->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'special_price')
31 | ->getAttributeId();
32 | $entityIdName = 'entity_id';
33 |
34 | $value = str_replace('`value`', 't.`value`', $value);
35 | $sql = "INSERT INTO $table (attribute_id , store_id, $entityIdName, `value`) "
36 | . " SELECT $id, store_id, $entityIdName, $value FROM $table AS t"
37 | . " WHERE " . join(' AND ', $where)
38 | . " ON DUPLICATE KEY UPDATE `value` = $value";
39 |
40 | return $sql;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/MassProductUpdate/Model/Command/Modifyspecial.php:
--------------------------------------------------------------------------------
1 | _type = 'modifyspecial';
17 | $this->_info = array_merge($this->_info, [
18 | 'confirm_title' => 'Update Special Price',
19 | 'confirm_message' => 'Are you sure you want to update special price?',
20 | 'type' => $this->_type,
21 | 'label' => 'Update Special Price'
22 | ]);
23 | }
24 |
25 | protected function _getAttrCode()
26 | {
27 | return 'special_price';
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/MassProductUpdate/Model/CustomException.php:
--------------------------------------------------------------------------------
1 | helper->getMassUpdateOptions();
19 | if ($this->moduleManager->isOutputEnabled('Theshreyas_MassProductUpdate') &&
20 | isset($result['product_listing']['children']['listing_top']['children']['listing_massaction']['children'])
21 | ) {
22 | //$item = 'modifyprice';
23 | $children = &$result['product_listing']['children']['listing_top']['children']['listing_massaction']['children'];
24 | foreach ($availableOptions as $item) {
25 | if (array_key_exists($item, $children)) {
26 | continue;
27 | }
28 | $children[$item] = $this->generateElement($item);
29 | }
30 | //$children[$item] = $this->generateElement($item);
31 | }
32 | return $result;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/MassProductUpdate/Plugin/Ui/Model/Reader.php:
--------------------------------------------------------------------------------
1 | helper->getMassUpdateOptions();
20 | if ($this->moduleManager->isOutputEnabled('Theshreyas_MassProductUpdate') &&
21 | isset($result['children']['listing_top']['children']['listing_massaction']['children']) &&
22 | isset($result['children']['product_listing_data_source'])
23 | ) {
24 | //$item = 'modifyprice';
25 | $children = &$result['children']['listing_top']['children']['listing_massaction']['children'];
26 | foreach ($availableOptions as $item) {
27 | if (array_key_exists($item, $children)) {
28 | continue;
29 | }
30 | $children[$item] = $this->generateElement($item);
31 | }
32 | //$children[$item] = $this->generateElement($item);
33 | }
34 | return $result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/MassProductUpdate/README.md:
--------------------------------------------------------------------------------
1 | # Magento 2 Mass Product Update Actions
2 | This module provides mass update actions in admin product grid, it can update product prices for selected products by lumpsum amount or via percentage changes
3 |
4 | # Features
5 | - Mass Update Product Prices in product grid
6 | - Mass Update Product Special Prices in productgrid
7 |
8 |
9 | # Installation Instruction
10 | ```
11 | - Copy the content of the repo to the Magento 2 app/code/Theshreyas/MassProductUpdate
12 | - Run command: php bin/magento setup:upgrade
13 | - Run command: php bin/magento setup:di:compile
14 | - Run Command: php bin/magento setup:static-content:deploy
15 | - Now Flush Cache: php bin/magento cache:flush
16 | ```
17 |
18 | 
19 |
--------------------------------------------------------------------------------
/MassProductUpdate/etc/adminhtml/routes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MassProductUpdate/etc/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/MassProductUpdate/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/MassProductUpdate/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MassProductUpdate/view/adminhtml/ui_component/product_listing.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | -
7 |
- product_listing.product_listing.product_columns.ids
8 | - Theshreyas_MassProductUpdate/js/grid/tree-massactions
9 | - entity_id
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/MassProductUpdate/view/adminhtml/web/css/styles.css:
--------------------------------------------------------------------------------
1 | .theshreyas-massproductupdate-form{
2 | padding: 8px;
3 | display: -webkit-box;
4 | display: -ms-flexbox;
5 | display: flex;
6 | -webkit-box-align: center;
7 | -ms-flex-align: center;
8 | align-items: center;
9 | }
10 |
11 | .theshreyas-massproductupdate-form label{
12 | display: inline-block;
13 | margin-right: 8px;
14 | max-width: 84px;
15 | vertical-align: middle;
16 | }
17 |
18 | .theshreyas-massproductupdate-form input{
19 | vertical-align: middle;
20 | margin-right: 8px;
21 | }
22 |
23 | .theshreyas-massproductupdate-form select{
24 | vertical-align: middle;
25 | max-width: 170px;
26 | margin-right: 8px;
27 | }
28 |
29 | .theshreyas-massproductupdate-form button{
30 | vertical-align: middle;
31 | }
32 |
33 | .action-menu .action-submenu {
34 | top: 100%;
35 | margin-top: 2px;
36 | }
37 |
38 | .action-select-wrap ul.action-menu{
39 | max-height: 300px;
40 | }
41 |
42 | @-moz-document url-prefix() {
43 | .action-select-wrap ul.action-menu{
44 | max-height: 45rem;
45 | }
46 | }
--------------------------------------------------------------------------------
/MassProductUpdate/view/base/requirejs-config.js:
--------------------------------------------------------------------------------
1 | var config = {
2 | paths: {
3 | 'theshreyas_massproductupdate/template': 'Theshreyas_MassProductUpdate/templates'
4 | }
5 | };
6 |
--------------------------------------------------------------------------------
/MassProductUpdate/view/base/web/templates/grid/submenu.html:
--------------------------------------------------------------------------------
1 |
26 |
--------------------------------------------------------------------------------
/MassProductUpdate/view/base/web/templates/grid/tree-massactions.html:
--------------------------------------------------------------------------------
1 |
4 |
9 |
36 |
37 |
--------------------------------------------------------------------------------
/MoveOutofStockToLast/Model/Adapter/BatchDataMapper/CustomDataProvider.php:
--------------------------------------------------------------------------------
1 | create(\Magento\CatalogInventory\Api\StockRegistryInterface::class);
20 |
21 | $fields = [];
22 |
23 | foreach ($productIds as $productId) {
24 |
25 | $stockItem = $stockobj->getStockItem($productId);
26 | $isInStock = $stockItem ? $stockItem->getIsInStock() : false;
27 | $fields[$productId] = ['quantity_and_stock_status' => ($isInStock ? 1 : 0)];
28 | }
29 |
30 | return $fields;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/MoveOutofStockToLast/Plugin/Sort.php:
--------------------------------------------------------------------------------
1 | [
14 | 'order' => 'desc',
15 | ],
16 | ]);
17 | return $sorts;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/MoveOutofStockToLast/README.md:
--------------------------------------------------------------------------------
1 | # Magento 2 Display Out of stock products at the end
2 | Move out of stock products to the end of category page.
3 |
4 | To enable display of out of stock products, configure Stores->Configuration->Catalog->Inventory->Display Out of Stock Products->Yes
5 |
6 | # Installation Instruction
7 | ```
8 | - Copy the content of the repo to the Magento 2 app/code/Theshreyas/MoveOutofStockToLast
9 | - Run command: php bin/magento setup:upgrade
10 | - Run command: php bin/magento setup:di:compile
11 | - Run Command: php bin/magento setup:static-content:deploy
12 | - Now Flush Cache: php bin/magento cache:flush
13 | ```
--------------------------------------------------------------------------------
/MoveOutofStockToLast/etc/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | - Theshreyas\MoveOutofStockToLast\Model\Adapter\BatchDataMapper\CustomDataProvider
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/MoveOutofStockToLast/etc/frontend/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MoveOutofStockToLast/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/MoveOutofStockToLast/registration.php:
--------------------------------------------------------------------------------
1 | converter = $converter;
40 | $this->fileFactory = $fileFactory;
41 | }
42 |
43 | /**
44 | * Export data provider to XML
45 | *
46 | * @throws \Magento\Framework\Exception\LocalizedException
47 | * @return \Magento\Framework\App\ResponseInterface
48 | */
49 | public function execute()
50 | {
51 | return $this->fileFactory->create('CustomOrderCsv.csv', $this->converter->getCustomCsvFile(), 'var');
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/OrderGridExport/Controller/Adminhtml/Export/GridToXls.php:
--------------------------------------------------------------------------------
1 | converter = $converter;
40 | $this->fileFactory = $fileFactory;
41 | }
42 |
43 | /**
44 | * Export data provider to XML
45 | *
46 | * @throws \Magento\Framework\Exception\LocalizedException
47 | * @return \Magento\Framework\App\ResponseInterface
48 | */
49 | public function execute()
50 | {
51 | return $this->fileFactory->create('export.xls', $this->converter->getXlsFile(), 'var');
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/OrderGridExport/README.md:
--------------------------------------------------------------------------------
1 | # Magento 2 Order Grid Export
2 | This module provides additional options in admin order grid export.
3 |
4 |
5 | # Features
6 | - Adds 'Export XLS' option in order grid
7 | - Adds 'Export Custom CSV' option in order grid. You can customize this as per your need.
8 |
9 |
10 | # Installation Instruction
11 | ```
12 | - Copy the content of the repo to the Magento 2 app/code/Theshreyas/OrderGridExport
13 | - Run command: php bin/magento setup:upgrade
14 | - Run command: php bin/magento setup:di:compile
15 | - Run Command: php bin/magento setup:static-content:deploy
16 | - Now Flush Cache: php bin/magento cache:flush
17 | ```
18 |
19 | 
20 |
--------------------------------------------------------------------------------
/OrderGridExport/etc/adminhtml/routes.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OrderGridExport/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/OrderGridExport/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | -
7 |
-
8 |
-
9 |
- csv
10 | - CSV
11 | - mui/export/gridToCsv
12 |
13 | -
14 |
- xml
15 | - Excel XML
16 | - mui/export/gridToXml
17 |
18 | -
19 |
- xls
20 | - Excel XLS
21 | - theshreyasorderexport/export/GridToXls
22 |
23 | -
24 |
- customcsv
25 | - Custom CSV
26 | - theshreyasorderexport/export/GridToCustomcsv
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/ProductGridExport/Controller/Adminhtml/Export/GridToCsv.php:
--------------------------------------------------------------------------------
1 | fileFactory->create('export.csv', $this->converter->getCsvFile(), 'var');
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/ProductGridExport/Controller/Adminhtml/Export/GridToXls.php:
--------------------------------------------------------------------------------
1 | fileFactory->create('export.xls', $this->converter->getXlsFile(), 'var');
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/ProductGridExport/Controller/Adminhtml/Export/GridToXml.php:
--------------------------------------------------------------------------------
1 | fileFactory->create('export.xml', $this->converter->getXmlFile(), 'var');
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/ProductGridExport/Model/Export/ConvertToCsv.php:
--------------------------------------------------------------------------------
1 | filter->getComponent();
19 |
20 | $name = md5(microtime());
21 | $file = 'export/'. $component->getName() . $name . '.csv';
22 |
23 | $this->filter->applySelectionOnTargetProvider();
24 | $dataProvider = $component->getContext()->getDataProvider();
25 | $fields = $this->metadataProvider->getFields($component);
26 |
27 | $this->directory->create('export');
28 | $stream = $this->directory->openFile($file, 'w+');
29 | $stream->lock();
30 | $stream->writeCsv($this->metadataProvider->getHeaders($component));
31 | $page = 1;
32 |
33 | $searchResult = $dataProvider->getSearchResult()
34 | ->setCurPage($page)
35 | ->setPageSize($this?->pageSize ?? 200);
36 |
37 | $items = LazySearchResultIterator::getGenerator($searchResult);
38 | foreach ($items as $item) {
39 | $this->metadataProvider->convertDate($item, $component->getName());
40 | $stream->writeCsv($this->metadataProvider->getRowData($item, $fields, []));
41 | }
42 |
43 | $stream->unlock();
44 | $stream->close();
45 |
46 | return [
47 | 'type' => 'filename',
48 | 'value' => $file,
49 | 'rm' => true // can delete file after use
50 | ];
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/ProductGridExport/Model/Export/ConvertToXls.php:
--------------------------------------------------------------------------------
1 | filter->getComponent();
26 |
27 | $name = md5(microtime());
28 | $file = 'export/'. $component->getName() . $name . '.xls';
29 |
30 | $this->filter->applySelectionOnTargetProvider();
31 | $dataProvider = $component->getContext()->getDataProvider();
32 |
33 | // Force all results
34 | $searchResult = $dataProvider->getSearchResult()
35 | ->setCurPage(1)
36 | ->setPageSize($this?->pageSize ?? 200);
37 |
38 | $excel = $this->excelFactory->create([
39 | 'iterator' => LazySearchResultIterator::getGenerator($searchResult),
40 | 'rowCallback'=> [$this, 'getRowData'],
41 | ]);
42 |
43 | $this->directory->create('export');
44 | $stream = $this->directory->openFile($file, 'w+');
45 | $stream->lock();
46 | $excel->setDataHeader($this->metadataProvider->getHeaders($component));
47 | $excel->write($stream, $component->getName() . '.xls');
48 |
49 | $stream->unlock();
50 | $stream->close();
51 |
52 | return [
53 | 'type' => 'filename',
54 | 'value' => $file,
55 | 'rm' => true // can delete file after use
56 | ];
57 | }
58 |
59 | public function getRowData($item) : array
60 | {
61 | return $this->metadataProvider->getRowData($item, $this->metadataProvider->getFields($this->filter->getComponent()), []);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/ProductGridExport/Model/Export/ConvertToXml.php:
--------------------------------------------------------------------------------
1 | filter->getComponent();
26 |
27 | $name = md5(microtime());
28 | $file = 'export/'. $component->getName() . $name . '.xml';
29 |
30 | $this->filter->applySelectionOnTargetProvider();
31 | $dataProvider = $component->getContext()->getDataProvider();
32 |
33 | // Force all results
34 | $searchResult = $dataProvider->getSearchResult()
35 | ->setCurPage(1)
36 | ->setPageSize($this?->pageSize ?? 200);
37 |
38 | $excel = $this->excelFactory->create([
39 | 'iterator' => LazySearchResultIterator::getGenerator($searchResult),
40 | 'rowCallback'=> [$this, 'getRowData'],
41 | ]);
42 |
43 | $this->directory->create('export');
44 | $stream = $this->directory->openFile($file, 'w+');
45 | $stream->lock();
46 | $excel->setDataHeader($this->metadataProvider->getHeaders($component));
47 | $excel->write($stream, $component->getName() . '.xml');
48 |
49 | $stream->unlock();
50 | $stream->close();
51 |
52 | return [
53 | 'type' => 'filename',
54 | 'value' => $file,
55 | 'rm' => true // can delete file after use
56 | ];
57 | }
58 |
59 | public function getRowData($item) : array
60 | {
61 | return $this->metadataProvider->getRowData($item, $this->metadataProvider->getFields($this->filter->getComponent()), []);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/ProductGridExport/Model/LazySearchResultIterator.php:
--------------------------------------------------------------------------------
1 | generator = static::getGenerator($collection);
17 | }
18 |
19 | public static function getGenerator(AbstractCollection $collection)
20 | {
21 | $lastPage = (int) $collection->getLastPageNumber();
22 |
23 | for ($page = (int) $collection->getCurPage(); $page <= $lastPage; $page++) {
24 | $items = $collection->setCurPage($page)
25 | ->clear() // If we do not clear, getItems will return stale results.
26 | ->getItems();
27 |
28 | yield from $items;
29 | }
30 | }
31 |
32 | public function rewind(): void
33 | {
34 | $this->generator->rewind();
35 | }
36 |
37 | public function valid(): bool
38 | {
39 | return $this->generator->valid();
40 | }
41 |
42 | public function current(): mixed
43 | {
44 | return $this->generator->current();
45 | }
46 |
47 | public function key(): mixed
48 | {
49 | return $this->generator->key();
50 | }
51 |
52 | public function next(): void
53 | {
54 | $this->generator->next();
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/ProductGridExport/etc/adminhtml/di.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Theshreyas\ProductGridExport\Model\Export\MetadataProvider
6 |
7 |
8 |
9 |
10 | Theshreyas\ProductGridExport\Model\Export\MetadataProvider
11 |
12 |
13 |
14 |
15 | Theshreyas\ProductGridExport\Model\Export\MetadataProvider
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/ProductGridExport/etc/adminhtml/routes.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/ProductGridExport/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/ProductGridExport/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | -
8 |
-
9 | product_listing.product_listing.product_columns.ids
10 |
11 | -
12 |
-
13 |
- csv
14 | - CSV
15 | - productgridexport/export/gridToCsv
16 |
17 | -
18 |
- xml
19 | - Excel XML
20 | - productgridexport/export/gridToXml
21 |
22 | -
23 |
- xls
24 | - Excel XLS
25 | - productgridexport/export/gridToXls
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/RenameCountry/Plugin/Magento/Framework/Locale/TranslatedLists.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/RenameCountry/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/RenameCountry/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/SetupDataWithCSV/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/SetupDataWithCSV/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/ShowHeaderFooteronCheckout/registration.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/SnippetsNotes/FindCommands.md:
--------------------------------------------------------------------------------
1 | # All commands/shortcuts for finding/searching texts
2 | ## Linux/Github/SublimeText search
3 |
4 | **Sublime Text Find**
5 | ```sh
6 | sudo nano ~/.bashrc
7 | #append
8 | export PS1='\u@\h \[\e[32m\]\w \[\e[91m\]$(__git_ps1)\[\e[00m\]$ '
9 | #reload source
10 | source ~/.bashrc
11 | #list all aliases
12 | alias
13 | ```
14 | **Linux Text Find**
15 | ```sh
16 | #Magento 2 : Find cacheable="false" cache tag #magento2
17 | find vendor app -regextype 'egrep' -type f -regex '.*/layout/.*\.xml' -not -regex '.*(vendor/magento/|/checkout_|/catalogsearch_result_|/dotmailer).*' | xargs grep --color -n -e 'cacheable="false"'
18 |
19 | #Cli : Linux find string in folder #CLI
20 | grep -rnw '/path/to/somewhere/' -e 'pattern'
21 | grep -rnw '/path/to/somewhere/' -e 'pattern' | grep -v 'ignore'
22 |
23 | # filename
24 | grep -rnwl '/path/to/somewhere/' -e 'pattern'
25 | ```
26 |
27 | **Github Search**
28 | ```sh
29 | #edit bashrc file
30 | sudo nano ~/.bashrc
31 | #add your aliases at the end
32 | alias all="sudo rabbitmqctl delete_queue async.operations.all && sudo rm -rf var/cache/* var/view_preprocessed/* var/page_cache/* generated/* pub/static/frontend/* pub/static/adminhtml/*"
33 | #reload source
34 | source ~/.bashrc
35 | ```
--------------------------------------------------------------------------------
/SnippetsNotes/GraphQl.md:
--------------------------------------------------------------------------------
1 | **GraphQL available context params**
2 | ```sh
3 | $context == Magento\GraphQl\Model\Query\Context
4 |
5 | $customerId = $context->getUserId();
6 |
7 | $userType = $context->getUserType()
8 | # \Magento\Authorization\Model\UserContextInterface::USER_TYPE_INTEGRATION = 1;
9 | # \Magento\Authorization\Model\UserContextInterface::USER_TYPE_ADMIN = 2;
10 | # \Magento\Authorization\Model\UserContextInterface::USER_TYPE_CUSTOMER = 3;
11 | # \Magento\Authorization\Model\UserContextInterface::USER_TYPE_GUEST = 4;
12 |
13 | $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
14 | $context->getExtensionAttributes()->getIsCustomer(); //boolean
15 | $context->getExtensionAttributes()->getCustomerGroupId(); //integer|null
16 | ```
17 | **Disable GraphQL Introspection**
18 | Edit app/etc/env.php
19 | ```sh
20 | 'graphql' => [
21 | 'disable_introspection' => true,
22 | ]
23 | ```
24 | https://devhooks.in/blog/how-to-disable-graphql-introspection-in-magento-2
25 |
26 | **Change GraphQL Endpoint**
27 | add di.xml in your custom module
28 | ```sh
29 |
30 |
31 |
32 |
33 | -
34 |
- custom43_graphql
35 |
36 |
37 |
38 |
39 |
40 | ```
41 | Now, we can access our graphql using the below URL.
42 | https://yourdomain.com/custom43_graphql
43 |
44 | https://devhooks.in/blog/how-to-change-graphql-endpoint-in-magento-2
45 |
46 | **Adobe recommends that you use authorization tokens instead of session cookies for GraphQL requests.**
47 | ```sh
48 | bin/magento config:set graphql/session/disable 1
49 | ```
50 | https://developer.adobe.com/commerce/webapi/graphql/usage/authorization-tokens/#session-cookies
--------------------------------------------------------------------------------
/SnippetsNotes/Misc.md:
--------------------------------------------------------------------------------
1 | # Miscellaneous Snippets
2 |
3 | **Set Git User email & name**
4 | ```sh
5 | git config --global user.email "name@email.com"
6 | git config --global user.name "name lastname"
7 | ```
8 |
9 | ```sh
10 | git log --after="2023-12-13" --before="2023-12-21"
11 | ```
12 |
13 | ```sh
14 | git config core.fileMode false
15 | ```
16 |
17 | Custom Scripts
18 | https://devhooks.in/blog/how-to-resize-specific-sku-images-in-magento-2-using-csv
--------------------------------------------------------------------------------
/SnippetsNotes/Phpcs.md:
--------------------------------------------------------------------------------
1 | # PHPCS/PHPCBF
2 |
3 | **PHPCS Commands**
4 | ```sh
5 |
6 | ```
--------------------------------------------------------------------------------
/SnippetsNotes/TODO -- Replace Deprecated Functions.md:
--------------------------------------------------------------------------------
1 |
2 | Direct use of $_SERVER Superglobal detected.
3 | $_SERVER, $_POST, $_REQUEST, $_GET, $_FILES
4 | base_encode, strlen, unlink, curl, baseinfo,
5 | file_get_contents, file_exists
6 | ```sh
7 |
8 | ```
--------------------------------------------------------------------------------
/SnippetsNotes/TODO--DateTime.md:
--------------------------------------------------------------------------------
1 | ## php date() function
2 | Assuming today is March 10th, 2023, 5:16:18 pm
3 |
4 | ```sh
5 | $today = date("F j, Y, g:i a"); // March 10, 2023, 5:16 pm
6 | $today = date("m.d.y"); // 03.10.23
7 | $today = date("j, n, Y"); // 10, 3, 2023
8 | $today = date("Ymd"); // 20230310
9 | $today = date('h-i-s, j-m-y, it is w Day'); // 05-16-18, 10-03-23, 1631 1618 6 Satpm23
10 | $today = date('\i\t \i\s \t\h\e jS \d\a\y.'); // it is the 10th day.
11 | $today = date("D M j G:i:s T Y"); // Sat Mar 10 17:16:18 UTC 2023
12 | $today = date('H:m:s \m \i\s\ \m\o\n\t\h'); // 17:03:18 m is month
13 | $today = date("H:i:s"); // 17:16:18
14 | $today = date("Y-m-d H:i:s"); // 2023-03-10 17:16:18 (the MySQL DATETIME format)
15 | $today = date('l \t\h\e jS'); // Saturday the 10th
16 | ```
17 |
18 | ```sh
19 | # Parse English textual datetimes into Unix timestamps:
20 | $d = strtotime("10:30pm April 15 2014"); //1397601000
21 | echo "Created date is " . date("Y-m-d h:i:sa", $d); //2014-04-15 10:30:00pm
22 | ```
23 |
24 | ```sh
25 | # Return the current time as a Unix timestamp,
26 | echo time(); //1727194386
27 | ```
28 |
29 | https://stackoverflow.com/a/40484613
30 |
31 | ```sh
32 | * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone
33 | protected \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone,
34 | $date = $this->timezone->date()->format('Ymdu'); // 20231003236738
35 | ```
36 |
37 | compare dates
38 |
39 | subtract dates/ add dates
--------------------------------------------------------------------------------
/SnippetsNotes/TODO--DbSchema.md:
--------------------------------------------------------------------------------
1 | **TODO**
2 | ```sh
3 | 1. db_schema exhaustive file with all datatypes, with corresponding mysql column type
4 | /var/www/html/m3/vendor/magento/framework/Setup/Declaration/Schema/etc/types/
5 | 2. constraint, primary, foreign ,etc
6 | 3. mysql column types with maximum value it can hold
7 | 4. uninstall guide
8 | a.how to safelty uninstall module, how to delete tables as well
9 | b.how to remove modules installed via composer
10 | c.how to delete patches/column changes
11 | d.whitelist.json use? what if we dont have
12 | e.two modules altering same table?
13 | f.uninstall via command VS deleting directory and s:up
14 |
15 | module:disable vs module:uninstall vs composer remove
16 |
17 | php bin/magento module:uninstall -r Hyva_Admin Hyva_AdminTest
18 | composer remove hyva-themes/module-magento2-admin
19 | composer remove hyva-themes/module-magento2-admin-test
20 | php bin/magento setup:upgrade
21 | ```
--------------------------------------------------------------------------------
/SnippetsNotes/TODO-File-Directory.md:
--------------------------------------------------------------------------------
1 | ```sh
2 | protected \Magento\Framework\Filesystem\DirectoryList $dir,
3 | protected \Magento\Store\Model\StoreManagerInterface $storeManager,
4 | ```
5 |
6 | ```sh
7 | $this->dir->getRoot(); // Output: /var/www/html/m2
8 | $this->dir->getPath('media'); // Output: /var/www/html/m2/pub/media
9 | $this->dir->getPath('pub'); // Output: /var/www/html/m2/pub
10 | $this->dir->getPath('static'); // Output: /var/www/html/m2/pub/static
11 | $this->dir->getPath('var'); // Output: /var/www/html/m2/var
12 | $this->dir->getPath('app'); // Output: /var/www/html/m2/app
13 | $this->dir->getPath('etc'); // Output: /var/www/html/m2/app/etc
14 | $this->dir->getPath('lib_internal'); // Output: /var/www/html/m2/lib/internal
15 | $this->dir->getPath('lib_web'); // Output: /var/www/html/m2/lib/web
16 | $this->dir->getPath('tmp'); // Output: /var/www/html/m2/var/tmp
17 | $this->dir->getPath('cache'); // Output: /var/www/html/m2/var/cache
18 | $this->dir->getPath('log'); // Output: /var/www/html/m2/var/log
19 | $this->dir->getPath('session'); // Output: /var/www/html/m2/var/session
20 | $this->dir->getPath('setup'); // Output: /var/www/html/m2/setup/src
21 | $this->dir->getPath('di'); // Output: /var/www/html/m2/var/di
22 | $this->dir->getPath('upload'); // Output: /var/www/html/m2/pub/media/upload
23 | $this->dir->getPath('generation'); // Output: /var/www/html/m2/var/generation
24 | $this->dir->getPath('view_preprocessed'); // Output: /var/www/html/m2/var/view_preprocessed
25 | $this->dir->getPath('composer_home'); // Output: /var/www/html/m2/var/composer_home
26 | $this->dir->getPath('html'); // Output: /var/www/html/m2/var/view_preprocessed/html
27 | $this->dir->getRoot().'/vendor'; // Output: /var/www/html/m2/vendor
28 |
29 | $this->storeManager->getStore()->getBaseUrl(); // http://m2.test/
30 | ```
31 |
32 | Check if file/folder exists (works for both)
33 |
34 | ```sh
35 | # \Magento\Framework\Filesystem\Driver\File $fileDriver
36 | $fileOrFolderPath = '/var/www/html/m3/var/log/system.log';
37 | if ($this->fileDriver->isExists($fileOrFolderPath)) {
38 | echo "file exist";
39 | } else {
40 | echo "file does not exist";
41 | }
42 | ```
43 |
44 | 1.create file/folder if not exists
45 | 2.count no of files in a folder
46 | 3.copy/move/rename/delete/create file
47 | 4.create csv file
--------------------------------------------------------------------------------
/SnippetsNotes/TODO-Plugin-Preference.md:
--------------------------------------------------------------------------------
1 | ```sh
2 | \Magento\Framework\Filesystem\DirectoryList $dir,
3 | $this->_dir = $dir;
4 | ```
5 |
6 | ---------------------PLUGIN------------------------
7 |
8 | if og function does not return anything, plugin also dont need to return anything
9 |
10 | beforePlugin
11 |
12 |
13 | afterPlugin
14 | ---------------------PREFERENCE------------------------
15 |
16 | preference types
17 | 11111]
18 | public function __construct(
19 | LocatorInterface $locator,
20 | StoreManagerInterface $storeManager,
21 | ConfigInterface $productOptionsConfig,
22 | ProductOptionsPrice $productOptionsPrice,
23 | UrlInterface $urlBuilder,
24 | ArrayManager $arrayManager
25 | ) {
26 | $this->locator = $locator;
27 | $this->storeManager = $storeManager;
28 | $this->productOptionsConfig = $productOptionsConfig;
29 | $this->productOptionsPrice = $productOptionsPrice;
30 | $this->urlBuilder = $urlBuilder;
31 | $this->arrayManager = $arrayManager;
32 | }
33 | 22222]
34 | public function __construct(
35 | $name,
36 | $primaryFieldName,
37 | $requestFieldName,
38 | CollectionFactory $collectionFactory,
39 | PoolInterface $pool,
40 | array $meta = [],
41 | array $data = []
42 | ) {
43 | parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
44 | $this->collection = $collectionFactory->create();
45 | $this->pool = $pool;
46 | }
47 |
48 |
49 |
50 | https://magento.stackexchange.com/a/359121
--------------------------------------------------------------------------------
/SystemXML/Block/Adminhtml/Form/Field/ColorPicker.php:
--------------------------------------------------------------------------------
1 | getElementHtml();
9 | $value = $element->getData('value');
10 |
11 | $html .= $value.'';
31 | return $html;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/SystemXML/Block/Adminhtml/Form/Field/DatePicker.php:
--------------------------------------------------------------------------------
1 | setDateFormat(\Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT);
14 | $element->setTimeFormat('HH:mm:ss'); //set date and time as per your need
15 | $element->setShowsTime(true);
16 | return parent::render($element);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/SystemXML/Block/Adminhtml/Form/Field/Ranges.php:
--------------------------------------------------------------------------------
1 | addColumn('from_qty', ['label' => __('From'), 'class' => 'required-entry']);
22 | $this->addColumn('to_qty', ['label' => __('To'), 'class' => 'required-entry']);
23 | $this->addColumn('price', ['label' => __('Price'), 'class' => 'required-entry']);
24 | $this->addColumn('tax', [
25 | 'label' => __('Tax'),
26 | 'renderer' => $this->getTaxRenderer()
27 | ]);
28 | $this->_addAfter = false;
29 | $this->_addButtonLabel = __('Add');
30 | }
31 |
32 | /**
33 | * Prepare existing row data object
34 | *
35 | * @param DataObject $row
36 | * @throws LocalizedException
37 | */
38 | protected function _prepareArrayRow(DataObject $row): void
39 | {
40 | $options = [];
41 |
42 | $tax = $row->getTax();
43 | if ($tax !== null) {
44 | $options['option_' . $this->getTaxRenderer()->calcOptionHash($tax)] = 'selected="selected"';
45 | }
46 |
47 | $row->setData('option_extra_attrs', $options);
48 | }
49 |
50 | /**
51 | * @return TaxColumn
52 | * @throws LocalizedException
53 | */
54 | private function getTaxRenderer()
55 | {
56 | if (!$this->taxRenderer) {
57 | $this->taxRenderer = $this->getLayout()->createBlock(
58 | TaxColumn::class,
59 | '',
60 | ['data' => ['is_render_to_js_template' => true]]
61 | );
62 | }
63 | return $this->taxRenderer;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/SystemXML/Block/Adminhtml/Form/Field/TaxColumn.php:
--------------------------------------------------------------------------------
1 | element
12 | *
13 | * @param string $value
14 | * @return $this
15 | */
16 | public function setInputName($value)
17 | {
18 | return $this->setName($value);
19 | }
20 |
21 | /**
22 | * Set "id" for