Tutorial: Install a LAMP Web Server with the Amazon Linux AMI

Tutorial: Install a LAMP Web Server with the Amazon Linux AMI

Open below URL and follow up step by step then you will not face any problem.
if you have any problem you can comment in this blog i will reply you within 24 hours.

Tutorial: Install a LAMP Web Server with the Amazon Linux AMI

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html

Install composer on Amazon AMI running on EC2

Install composer on Amazon AMI running on EC2

$ cd ~
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer


 then you can run
 $ sudo composer install

What is interceptor or plugins in Magento 2?

Question : What is interceptor or plugins in Magento 2?

Plugins (Interceptors)

Basically plugin, or interceptor both are same. it is a class only which are modifies the behavior of public class functions by intercepting a functionality and running code before, after, or around that function call. This allows you to substitute or extend the behavior of original, public methods for any class or interface.

Extensions that wish to intercept and change the behavior of a public method can create a Plugin class.

This interception approach reduces conflicts among extensions that change the behavior of the same class or method. Your Plugin class implementation changes the behavior of a class function, but it does not change the class itself. Magento calls these interceptors sequentially according to a configured sort order, so they do not conflict with one another.

Plugins can not be used on following:

Final methods
Final classes
Non-public methods
Class methods (such as static methods)
__construct
Virtual types
Objects that are instantiated before Magento\Framework\Interception is bootstrapped

What is object manager in Magento 2?

ObjectManager

Object manager is Maento 2 core class a "Magento/Framework/ObjectManagerInterface".

Object manager to avoid boilerplate code when composing objects during instantiation.

In the Magento framework, the implementation of the ObjectManagerInterface performs the duties of an object manager.

Responsibilities :

The object manager has the following responsibilities:

1. Object creation in factories and proxies.
2. Implementing the singleton pattern by returning the same shared instance of a class when requested
3. Dependency management by instantiating the preferred class when a constructor requests its interface
4. Automatically instantiating parameters in class constructors

Deploy your static content on development mode for easy to develop your theme.

If your website is in developer mode, and you run bin/ magento dev:sourcetheme:
deploy, most files in this directory will be symlinked to their
sources throughout the Magento codebase. In production mode, you run
bin/ magento setup:static-content:deploy to process and copy files to
this directory.

Magento 2 - How can i enable path hint or block hint by CLI command?

You can enable Block Hints with the  bin/magento dev:template-hints:enable. This only works in
Developer mode.

How to switch Php version between two version on aws

First go to path of CD /use/bin directory and search here should be installed your Php version wchich one you whamt to switch after that you have to run below command.    /n.                      







Sudo update-alternatives —set Php /use/bin/php55 or php7

5. What step during the layout loading is the node processed?

5. What step during the layout loading is the node processed?

A. After the generation of layout blocks.

B. Vefore the generation of layout update XML, but after the generation of layout blocks.

C. Before the generation of layout blocks, but after the generation of layout XML.

D. After the generation of layout blocks, but before rendering the page.

Magento 2 | How can we use jQuery without "require(['jquery'],function($){" this code.

Magento 2 | How can we use jQuery without "require(['jquery'],function($){" this code.

We have face problem we implement some slider and also we have wrighten many script in phtml.
If we add the jquery library then magento is giving the error in core files and all script are stopped accept my cutome script once i remove the the jquery library
then core script are working but my custom script are not working its giving jquery not define you can see error below screenshots.

Magento 2 | How to set production mode manually

In magento 2 probubly have permission issues with server. if you are not able to set production mode by CLI command you can follow below changes.

open your magento 2 root dirctory, Open file "/app/etc/evn.php" and search "'MAGE_MODE' =>". you can change your mgento mode here manually.

CLI command for production mode

magento deploy:mode:set production

CLI command for developer mode

magento deploy:mode:set developer

Magento 2 | how to see current magento mode

Display the current mode

User below commnad for make sure which mode currently are nunning.

Command
php bin/magento deploy:mode:show

Add custom field for all products for order line

How to add custom fields for Order Line Items in magento

 

 

Work Flow to add custom Field to Order line Item
Use this url to add to cart: Ex: http://magento.com/checkout/cart/add/?product=196&qty=2&training_location=California
1. checkout_cart_item_default.phtml:::
Add the following below product name
<dl class=”item-options Kiran” id=”checkout_cart_item_default”>
<dt>Training Location</dt>
<dd><?php echo $_item->getTrainingLocation(); ?></dd>
</dl>
2. Table: sales_flat_quote_item
Add field: training_location
3. Product Detailed Page: Add training_location text field as input
4. Code -> Core -> Mage -> Sales -> Model -> Quote.php
Find: public function addItem(Mage_Sales_Model_Quote_Item $item)
Add: $item->setTrainingLocation($_REQUEST[‘training_location’]);
Befoe: $item->setQuote($this);
—————
5. Table: sales_flat_order_item
Add field: training_location
6. XML: code_core_mage_sales_etc_config.xml
ADD: <training_location><to_order_item>*</to_order_item></training_location>
Between: <sales_convert_quote_item> and </sales_convert_quote_item>
Also Add:
<training_location><to_quote_item>*</to_quote_item><to_invoice_item>*</to_invoice_item><to_shipment_item>*</to_shipment_item><to_cm_item>*</to_
cm_item></training_location>
Between: <sales_convert_order_item> and </sales_convert_order_item>
—— Show The Info In Various Locations ——
To show in admin orders area
7. app_design_adminHTML_default_default_template_sales_order_view_items_renderer_default.phtml
Add:
<?php if($_item->getTrainingLocation()): ?>
<?php echo “<strong>Training Location:</strong> “.$_item->getTrainingLocation(); ?>
<?php endif; ?>
Below: <?php echo $this->getColumnHtml($_item, ‘name’) ?>
8. To Show in Checkout/Order review Page
frontend_template_checkout_onepage_review_item.phtml
Add: <?php if ($_item->getTrainingLocation()):?>
<dl class=”item-options Kiran” id=”checkout_cart_item_default”>
<dt>Training Location</dt>
<dd><?php echo $_item->getTrainingLocation(); ?></dd>
</dl>
<?php endif; ?>
Below: <h3 class=”product-name”><?php echo $this->htmlEscape($this->getProductName()) ?></h3>
9. To show in Myorders view page
frontend_template_sales_order_items_renderer_default.phtml
Add: <?php if ($_item->getTrainingLocation()):?>
<dl class=”item-options Kiran” id=”checkout_cart_item_default”>
<dt>Training Location</dt>
<dd><?php echo $_item->getTrainingLocation(); ?></dd>
</dl>
<?php endif; ?>
Below: <h3 class=”product-name”><?php echo $this->htmlEscape($_item->getName()) ?></h3>
10.
######################################
Usefull Links:
http://www.magentocommerce.com/boards/viewthread/19344/
http://magentocoder.jigneshpatel.co.in/add-to-cart-with-custom-attributes-values/
Use like below in product view page
<input type=”text”title=”Qty” value=”My Test Location” maxlength=”12″ id=”training_location” name=”training_location”>

Magento configrable product get child product by super attribute php code

Magento set phtml template in cntroller with block

Magento create block from controller php code


this code write in your controller you have to no write in xml layout

How to add custom fields for Order Line Items in magento

magento index rewright url create

hello this script for create your module rewrite URL, create script

Remove precision from price of a product

Remove precision from price of a product

 

As I said in the title, I want to remove precision from price ( .00 )
I did these :
  1. In app/code/core/Mage/Directory/Model/Currency.php
in
public function format()
I changed
 return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets);
to
 return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);
  1. In /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php
in
public function getEscapedValue()
I changed
 return number_format($value, 2, null, '');
to
 return number_format($value, 0, null, '');
  1. In js/varien/js.js
I changed
var precision = isNaN(format.precision = Math.abs(format.precision)) ? 2 : format.precision;
var requiredPrecision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision;
to
var precision = 0;
var requiredPrecision = 0;
  1. And in app/code/core/Mage/Core/Model/Store.php
I changed
public function roundPrice($price)
    {
        return round($price, 2);
    }
to
 public function roundPrice($price)
    {
        return round($price, 0);
    }
Then I cleared the cache, and reindexed Magento (which is i version1.9), But the precision didn't remove, Am I missing something? what should I do?

 

 

i am using its working thank bro

Magento add new class accourding to your module and you

add class with php

if ($root = $this->getLayout()->getBlock('root')) {
    $root->addBodyClass('whatever');
}
 
and xml
 
<reference name="root">
    <action method="addBodyClass"><classname>whatever</classname></action>
</reference> 

stiki menu jquery simple

How to check if Magento is running in production mode or developer mode

If you want to know. your Magento 2 website is running on which environment you can run below command on terminal and very easily you can kn...

Popular Posts

Posts