Wednesday, 2 May 2018

Magento 2 : How to get associated products of a grouped product in product list page

The following sample code how to load a group product by object manager and get all child products (associated simple products) as an array.


$product_id = $_product->getId();
$groupedProduct = $objectManager->create('Magento\Catalog\Model\Product')->load($product_id);
$_children=$groupedProduct->getTypeInstance()->getAssociatedProducts($groupedProduct);
                                    if(count($_children)>0){                                      
                                    foreach ($_children as $child){
                                    echo "Here are your child Product Ids ".$child->getID()."\n";                                       
                                        }                                      

                                    }

Thursday, 15 March 2018

Magento 2 : [Solution] Update default Order Id / Invoice Id / Shipment Id

Go to your database from phpmyadmin,

Here _1 is used for store id after tablename.

Default Frontend store id is 1. if you have multi store then you have to set query for each store with table name like sequence_order_2 upto sequence_order_.*

Enter below query for table sequence_order_1 is used for default store. If you have multiple store you have to set tablename as per store id in below query.

This is only used for order placed from frontend.

sequence_order_1 is used for order id management in magento 2.

ALTER TABLE sequence_order_1 AUTO_INCREMENT=100000001;

Next order id is start from 100000002.

Below Query is defined for INVOICE, if you want to change invoice id

ALTER TABLE sequence_invoice_1 AUTO_INCREMENT=100000001;

For Shipment ALTER TABLE sequence_shipment_1 AUTO_INCREMENT=100000001;

Magento 2 : [Solution] Remove compare functionality in Magento 2

Removed compare product functionality by adding below code in my theme 'degault.xml' file.

/app/design/frontend/themes/default/Magento_Theme/layout/default.xml

<referenceBlock name="catalog.compare.sidebar" remove="true"/>
<referenceBlock name="catalog.compare.link" remove="true"/>

And

/app/design/frontend/themes/default/Magento_Catalog/layout/default.xml

<referenceBlock name="catalog.compare.sidebar" remove="true"/>
<referenceBlock name="catalog.compare.link" remove="true"/>

Thursday, 22 February 2018

Magento 2 : [Solution] How to Remove Links on My Account Navigation


Complete list of customer account using XML removal for Magento 2.


<!-- Store credit -->
<referenceBlock name="customer-account-navigation-customer-balance-link" remove="true"/>

<!-- Downloadable product link -->
<referenceBlock name="customer-account-navigation-downloadable-products-link" remove="true"/>

<!-- Subscription link -->
<referenceBlock name="customer-account-navigation-newsletter-subscriptions-link" remove="true"/>

<!-- Billing agreement link -->
<referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>

<!-- Product review link -->
<referenceBlock name="customer-account-navigation-product-reviews-link" remove="true"/>

<!-- My credit card link -->
<referenceBlock name="customer-account-navigation-my-credit-cards-link" remove="true"/>

<!-- Account link -->
<referenceBlock name="customer-account-navigation-account-link" remove="true"/>

<!-- Account edit link -->
<referenceBlock name="customer-account-navigation-account-edit-link" remove="true"/>

<!-- Address link -->
<referenceBlock name="customer-account-navigation-address-link" remove="true"/>

<!-- Orders link -->
<referenceBlock name="customer-account-navigation-orders-link" remove="true"/>

<!-- Wish list link -->
<referenceBlock name="customer-account-navigation-wish-list-link" remove="true"/>

<!-- Gift card link -->
<referenceBlock name="customer-account-navigation-gift-card-link" remove="true"/>

<!-- Gift registry -->
<referenceBlock name="customer-account-navigation-giftregistry-link" remove="true"/>

<!-- Order by SKU -->
<referenceBlock name="customer-account-navigation-checkout-sku-link" remove="true"/>

<!-- Reward points -->
<referenceBlock name="customer-account-navigation-reward-link" remove="true"/>

Any issues please email me.

Thanks,
Kuldeep singh

Wednesday, 10 January 2018

Mysql [SOLVED] ERROR 1227 (42000) at line *: Access denied; you need (at least one of) the SUPER privilege(s) for this operation

Mysql [SOLVED] ERROR 1227 (42000) at line 1080: Access denied; you need (at least one of) the SUPER privilege(s) for this operation

Either remove the DEFINER=.. statement from your sqldump file, or replace the user values with CURRENT_USER.

Like

Find
DEFINER=`olddbusername`@`localhost`

Then replace

DEFINER=`newdbusername`@`localhost`

Thanks,

Monday, 1 January 2018

When save a Category Error : A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.

Solved this problem with below command line:

php bin/magento maintenance:enable; 
php bin/magento setup:upgrade; 
php bin/magento setup:static-content:deploy -f; 
php bin/magento cache:clean; 
php bin/magento maintenance:disable

if can not solve then remove category content and save it.


Any issues please email me.

Thanks,
Kuldeep singh

Wednesday, 29 November 2017