Search blog

Sunday, November 26, 2017

[Explained] - Multistore/Multisite Key Points & Concepts in Magento 1x/2x

>> Inventory

It is global across all the websites and stores. Either the product is IN STOCK or Not! If you need different inventories, you will have to use third party modules.

>> Fundamental Concept

A single installation of Magento can have multiple stores that share the same Admin. Multiple stores can share the same domain, be set up as subdomains of the same domain, or have entirely different domains. Stores that have the same IP address and domain, use the same security certificate, and share a single checkout process. If you want each store to have a dedicated checkout process under its own domain, each store must have a distinct IP address with a separate security certificate. Here are some examples of how URLs can be configured for multiple stores:
  • yourdomain.com/store1 - Each store has a different path, but shares the same domain.
  • yourdomain.com/store
  • store1.yourdomain.com - Each store has a different subdomain of the primary domain.
  • store2.yourdomain.com
  • store1.com - Each store has a dedicated domain.
  • store2.com
The important thing to understand is that the stores uses the same Magento code, shares the same Admin, and catalog. They can, however, have different identities, product selections, and themes.

The multi-store feature is one of the most important and powerful feature of Magento. (Multi store is also known as multi site.) It allows growing businesses to manage multiple websites and stores through one Magento installation under a single admin panel.

The primary purpose behind the Magento Store layer is the ability to sell various different products, structured within different categories to the same user base with the same checkout parameters.

Because the Magento Store Layer requires that you create a new Magento Store View you will have all of the functionality of the aforementioned, plus some additional functionality.

Magento uses the terminology of GWS (Global, Website, Store) to explain the ability to create multiple websites and stores through one installation. There is one more part called Store View that is added to each Magento installation automatically.

The three components of GWS are explained below:
  • Global refers to the complete installation of Magento
  • Website is the domain you are utilizing. Each domain or website can have multiple stores, while you can also have multiple domains on a single installation
  • Stores are your actual product catalogue. Multiple stores can be created on a single domain or more than one domains
  • Store View – Mainly for language or separate design on store-2-store basis
And while we are at it, I think it would be wise to explain the Store Views term too. Store Views can be defined as the multiple presentation of your front-end data. Most e-Commerce stores use this feature to have stores in multiple languages.

[Explained] - Multistore/Multisite Key Points & Concepts in Magento 1x/2x
Click on image to enlarge

The only use of Magento Store View is for multi- language or different theme design. You will typically have one Store View per language.

>> Magento Multi Store


>>> Features that CANNOT be implemented in a multi-store:
  • Payment Method: You will not be able to have specific payment methods for each Store
  • Shipping Method: You will not be able to have separate shipping methods for each Store
  • Products:
    • You cannot change the tax structures within Stores
    • You cannot manage a separate inventory with Stores
  • Configuration Settings: You will not be able to manage ANY configuration settings between Stores
>>> Features that CAN be implemented in a multi-store:
  • Products: You will be able to manage a completely different catalog between Store
  • Categories: You will be able to manage a completely different category structure for each Store
Stores are ‘children’ of websites. They are your actual product catalog. Products and Categories are managed on the store level. A root category is configured for each store. They are your actual product catalog. Products and Categories are managed on the store level.

>> Multiple Magento Websites

The primary purpose behind the Magento Website layer is the ability to change every aspect of the customer experience, including the ability to manage a completely different set of customers for each Website.

In mutli-website — From one administration you can manage a few shops.

There’s essentially nothing that you cannot do with multiple Magento Websites. From the reporting and orders to the customer base and checkout configurations, you can manage everything with different parameters. Basically Multiple Magento Website is just like Multi-site in Drupal.

>> When to use Magento Multiple Website?


If you want to sell your products in several stores and have to change one of the following criteria in these shops, then you have to go for different websites:
  • different price
  • different tax classes
  • different (base) currencies
  • different payment options
  • different shipping options
>> If you just create store groups, your customers will be able to log in to all shops with the same credentials whether you like it or not.

>> If you create websites, it's up to you whether your customers can log in to all shops with the same credentials.

>>  Conceptual Example

Imagine that you sell electronics, software and DVDs. For that you want to create 3 websites. You would like them on separate subdomains, so we have companyname.com/electornics, companyname.com/software and companyname.com/dvds.

In companyname.com/electornics store you would like to sell mobile devices and computers, thus you create 2 separate stores for them - Mobiles and Computers. Each of them has lots of categories and subcategories, so it makes sense to create separate category tree with own root category for each. From one website your clients can switch between the stores.

Additionally, Mobile phones you you need to be available in English and Spanish and Computers in English, Spanish and French. Thus, for ‘Mobiles’ you create 2 store views and for ‘Computers’ 3 Magento store views.

The following scheme illustrates the mentioned above:

Click on image to enlarge
 

WARNING!!!

When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.). – Setting s can be found at: Store >> Config >> General >> Web

Source: http://devdocs.magento.com/guides/v2.0/config-guide/multi-site/ms_websites.html

Wednesday, November 15, 2017

How to Find/Edit Location/Path of php.ini File in your Ubuntu/LAMP Setup

In some cases, you might have two PHP configuration files: one for the PHP command line and for the web server. If so, make the change in both php.ini files.

1. To Edit web server's php.ini file


Open any text editor of you choice like Gedit and Copy/Paste the following PHP code and Save the file as 'info.php' inside the Document Root folder of your Web Server. Usually the path to your Document Root should be something like '/var/www/html/'. Make sure to save your file under the 'html' folder.

 <?php   
 phpinfo();   
 ?>  

Now access this file from a browser using the following URL: http://localhost/info.php

You should be seeing a page open as shown in the image below. The path to your 'php.ini' file will be under Loaded Configuration File. In my case the path was as follows: Loaded Configuration File    /etc/php/5.6/apache2/php.ini

How to Find/Edit Location/Path of php.ini File in your Ubuntu/LAMP Setup
Click on image to enlarge




2. To Edit CLI's 'php.ini' file


Open your Terminal (CTRL+ALT+T) and enter the following command:
 php --ini  

You should get output as shown in the image below. Here too you should be looking for the Loaded Configuration File path. In my case it was /etc/php/5.6/cli/php.ini.

Edit CLI's 'php.ini' file
Click on image to enlarge

Sunday, November 12, 2017

Type Juggling and Type Casting in PHP

Type juggling and type casting can be used to change a value's type. While programming, it's important to know the type of the value and use type casting or juggling to convert it to compatible types.

Type Juggling:

When PHP converts a value from one type of value to another, it is called type juggling. PHP does not require (or support) explicit type definition in variable declaration; a variable's type is determined by the context in which the variable is used. That is to say, if a string value is assigned to variable $var, $var becomes a string. If an integer value is then assigned to $var, it becomes an integer.

 <?php  
 $foo = "0"; // $foo is string (ASCII 48)  
 $foo += 2; // $foo is now an integer (2)  
 $foo = $foo + 1.3; // $foo is now a float (3.3)  
 ?>  

Type Casting:

When you explicitly set a type to change the value into another type, it is called type casting. PHP is a loosely typed language and assigns types to variables depending what is assigned to it. Variables coming from get/post and cookies etc are generally cast as strings rather than other types and there are often other times when you need to specifically cast a type in PHP as e.g. an integer.

An example of this in action is as follows, where $foo starts off as a string value and is then cast into an integer:

 $foo = '1';  
 echo gettype($foo); // outputs 'string'  
 settype($foo, 'integer');  
 echo gettype($foo); // outputs 'integer'   

Tuesday, November 7, 2017

Restarting Pulse Audio from Terminal

For whatever reason(s), you would like to restart Pulse Audio, the following are the steps that will help you just do that:

In a standard setup running pulseaudio -k restarts the daemon. Nothing else to do.

In case Pulse Audio is not running typing pulseaudio without further options will start the daemon using defaults in /etc/pulse/daemon.conf and /etc/pulse/default.pa.

User-defined settings in 'home/.pulse/ ' or 'home/.config/pulse/' will override system-wide settings.

NOTE: In case of issues it will often help to DELETE these directories before restarting pulseaudio. You can only delete files that were generated at the present date.

For details see PulseAudio Wiki.

Finally to restart PA from your terminal:

 sudo service pulseaudio restart  

If the restart command doesn't work, you can try starting PulseAudio by entering the following command in your terminal:
 pulseaudio  
or

You can also run PulseAudio from the Run Command Prompt in Gnome Shell. First press Alt+F2, and then enter pulseaudio, and finally select pulseaudio as shown in the image below.

Restarting Pulse Audio from Terminal
Click on image to enlarge
Reference: How can I restart pulseaudio without logout?

Suspend Your Ubuntu System From The Terminal

If you would like to suspend your Ubuntu system from the terminal, then use the following command:

 sudo pm-suspend  

Top 5 Posts (Weekly)