Social Icons

twitterfacebookgoogle pluslinkedinemail

Saturday, 13 October 2018

How to add External JS and CSS in Magento 2




Hello Friends,

Sometimes we need to add some external js or css in Magento 2.

So, Here is the code which will help you to add external js or css in your Magento 2 Project.

Please update below path of the file

/app/design/frontend/<ThemeName>/<Theme>/Magento_Theme/layout/default_head_blocks.xml
like
/app/design/frontend/Magento/luma/Magento_Theme/layout/default_head_blocks.xml

if there will no file than please copy from below path and add it in your theme template.
vendor/magento/module-theme/view/frontend/layout/default_head_blocks.xml

Wednesday, 21 March 2018

Magento 2 Internal Server Error

Hello Guys,

Recently I faced one issue related to Internal Server Error. after debug and google I found some of the solution which are useful to you.

After installation of magento 2 or setup old source code to the server at that time we are getting error like


Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.





So, First of all we must check related to .htaccess file. I am sure this is cause of the .htaccess file.

we must check .htaccess file in setup root directory and also under the pub/ directory.

Setup Root .htaccess file should be like .htaccess

Pub/.htaccess file should be like pub/.htaccess

After Changes .htaccess please run the below commands

1. rm -rf var/cache/* var/page_cache/* var/generation/* var/view_preprocessed/* var/di/*
2. php bin/magento setup:upgrade
2. php bin/magento setup:di:compile (if deploy mode is production)
3. php bin/magento setup:static-content:deploy
4. chmod -R 777 var/* pub/* generated/*

if still facing same issue than please enable mod_rewrite and mod_version php module from your hosting server.
Also please check folder permission.

you can share comment here if still facing issue. I will sure help you to fix it.

Thank you.
Anant Prajapati (Enjoy Your Self)


Wednesday, 28 February 2018

Magento 2 How to Get Current Store Date Time

Hello Friends,

if you want to display current date time zone wise in magento 2 than you can use this code. it will help you to display current timezone date.



$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$objDate = $objectManager->create('Magento\Framework\Stdlib\DateTime\TimezoneInterface');
$objDate->date()->format('y-m-d H:i:s')



Hope this short article will help you fix date issue.

Sunday, 6 August 2017

Share Facebook and twitter in magento

Hello Friends,

This article is use to share your product in facebook and twitter. Here is the simple code to add into app/design/frontend/<theme>/<theme>/template/catalog/product/view.phtml

Please check first your theme path and also detail page file. here is the default path
 app/design/frontend/base/default/template/catalog/product/view.phtml

You can find file path to enable path hint from back-end.

Add below code and save the file

<?php $_productName = urlencode(trim($_helper->productAttribute($_product, $_product->getName(), 'name')))?>
                    <?php $_productImageUrl = urlencode(trim($this->helper('catalog/image')->init($_product, 'image')))?>
                    <?php $_productUrl = urlencode(trim($_product->getProductUrl()))?>
<?php $_u = 'p[url]=' . $_productUrl . '&p[images][0]=' . $_productImageUrl . '&p[title]=' . $_productName . '&p[summary]=' . urlencode(trim($_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description'))); ?>   
                    <div class="social-links" style="float: right;">
                        <a href="javascript:void(0);" title="<?php echo $this->__('Share on Facebook') ?>" class="link-facebook svg-replace" onclick="window.open( '<?php echo 'http://www.facebook.com/sharer.php?s=100&' . $_u; ?>' , '_blank' ,'height=500,width=500'); return false">
                            <img class="fb-icon" style="" src="<?php echo $this->getSkinUrl(); ?>images/social-fb-icon.png" alt="Share Facebook" />
                        </a>
                       
                        <a href="javascript:void(0);" target="_blank" title="<?php echo $this->__('Share on Twitter') ?>" class="link-twitter svg-replace" onclick="window.open( '<?php echo 'http://twitter.com/home?status=' . $_productName . '+' . $_productUrl; ?>' , '_blank' ,'height=500,width=500'); return false">
                            <img class="twitter-icon" style="" src="<?php echo $this->getSkinUrl(); ?>images/social-twitter-icon.png" />
                        </a>
                    </div>

Notes: This code will help you in core php, WordPress, Drupal, Joomla and other framework also you just need to setup parameter and it will work.

Thank you,
Enjoy Your Self,

Thursday, 6 October 2016

Magento 2: how to create new admin user without access backend

Hello Friends,

In Magento2, Sometime your account is disabled or forgot the password of your current admin user and you can not update the password from database because magento 2 use the encrypted technique
So, don't worry about it. here is the very simple trick to create new user.


For this you must have ssh access because you can create new user using the command in magento 2.



php setup_magento2/bin/magento admin:user:create --admin-user anant --admin-password anant101289 --admin-email anantprajapati111@email.com --admin-firstname Anant --admin-lastname Prajapati






Now You can login with this user and update your current user password from back-end.

Hope, this trick will help you to resolve your reset password / forgot password / new user issue.

Thanks
Enjoy Your Self
 

Free Advertisement

Free Advertisement

Free Advertisement

Free Advertisement