MySQL Issue: Table storage engine for ‘catalog_product_relation’ doesn’t have this option

July 30, 2016  |  1 Comments  |  by Raj (MagePsycho)  |  Linux, Mac OS-X, Magento, Mysql

When you export the Magento database dump from MySQL 5.5.x and try to import in MySQL 5.7.x, You are likely to face an error:

ERROR 1031 (HY000) at line 3002: Table storage engine for ‘catalog_product_relation’ doesn’t have this option

PROBLEM

This is probably due to the table option that you have in your CREATE TABLE DDL: ROW_FORMAT=FIXED

Let’s check if there is any such string in the SQL dump (Ex: magento-db-dump.sql).

cat magento-db-dump.sql | grep '=FIXED'

Which resulted as:

) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Catalog Product Relation Table';
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Catalog Product To Website Linkage Table';

Refer – MySQL Row Format Option

SOLUTION

Removing ROW_FORMAT=FIXED option from CREATE TABLE DDL will fix the issue.
So let’s try possible solutions.

#1

sed -i 's/ROW_FORMAT=FIXED//g' magento-db-dump.sql

This didn’t work for me in MacOSx which resulted in following error:

sed: 1: “magento-db-dump.sql”: invalid command code m

#2

sed -i '' 's/ROW_FORMAT=FIXED//g' magento-db-dump.sql

And even this resulted as:

sed: RE error: illegal byte sequence

#3
But this one worked for me in MacOSx (Refer Mac OS X, Sed, and strange document encoding to know more about the issue)

LC_ALL=C sed -i '' 's/ROW_FORMAT=FIXED//g' magento-db-dump.sql

Re-check if the string has been removed or not:

cat magento-db-dump.sql | grep '=FIXED'

If the string is removed, now try to import as:

mysql -u <user> -p <db-name> < magento-db-dump.sql

Yay! Now it imported successfully.
Please do share and care if you liked this article.

Cheers!

Assign group to the customer using dropdown or group code in Magento

January 5, 2016  |  1 Comments  |  by Raj (MagePsycho)  |  Magento

If you are looking for functionality which allows customers to select their required customer group at registration & checkout either by using group dropdown or group code, then Customer Group Selector / Switcher Extension is for you.

Customer-Group-Selector

1. Associate Customer Group Using Dropdown

You can show the selected list of customer groups as dropdown at registration, checkout and my account edit pages. So that customer can select the group of their choice while registration . This feature can be very handy for your B2B stores.

1.1 Group Dropdown at Registration

It’s pretty straight forward to have customer group dropdown at registration, see the settings below:

Customer Group Selector Type - Dropdown

Registration – Customer Group Dropdown

Note: If you are using your own customized registration template (.phtml), then you can simply use the following code in your template:

<!-- Customer Group Field Widget -->
<li>
<?php
echo $this->getLayout()
->createBlock('magepsycho_customerregfields/customer_widget_type')
->setObject($this->getFormData())
->setIsEditPage(false)
->toHtml()
?>
</li>
<!-- //Customer Group Field Widget -->

1.2 Group Dropdown at Checkout

You can also enable customer group dropdown at Checkout Page which will be shown at Billing Address form (as shown below).
In order to enable it, just make ‘Is Enabled to Checkout?’ to Yes from the setting.

Customer Group Selector Type - Dropdown at Checkout Page

Checkout – Customer Group Dropdown

Note: If you are using custom billing address template (.phtml) file, then you can simply use the following code:

<!-- Customer Group Field Widget -->
<li>
<?php
echo $this->getLayout()
->createBlock('magepsycho_customerregfields/customer_widget_type')
->setObject($this->getQuote())
->setIsEditPage(false)
->setFieldIdFormat('billing:%s')
->setFieldNameFormat('billing[%s]')
->toHtml()
?>
</li>
<!-- //Customer Group Field Widget -->

1.3 Group Dropdown at My Account Edit Page

If you want the customer group to be editable from My Account Edit page, you can simply enable it from the extension settings (refer below screenshot)

Customer Group Selector Type - Dropdown - My Account Edit Page

My Account Edit Page – Customer Group Dropdown –


Note: If you have customized edit page, then you can use following snippet of code in order to show the field in the form:

<!-- Customer Group Field Widget -->
<li>
<?php
echo $this->getLayout()
->createBlock('magepsycho_customerregfields/customer_widget_type')
->setObject($this->getCustomer())
->setIsEditPage(true)
->toHtml()
?>
</li>
<!-- //Customer Group Field Widget -->

2. Associate Customer Group Using Code

If you want to associate customer group based on some code, then this option is for you. It allows customers to enter group code and the customer will be assigned to the group associated with the code.
For this you just have to chose ‘Group Selector Type’ to ‘Group Code’ and add group codes from settings (refer to the below screenshot).

Group Settings: Customer Group Selector Type - Group Code

Group Settings: Customer Group Selector Type – Group Code

2.1 Group Code at Registration

Similarly to group dropdown, you can have group code field at Registration, Checkout and My Account Edit Page.

Registration Page - Customer Group Code

Registration Page – Customer Group Code

2.2 Group Code at Checkout

Checkout Page - Customer Group Code

Checkout Page – Customer Group Code

2.3 Group Code at My Account Edit Page

My Account Edit Page - Customer Group Code (Editable)

My Account Edit Page – Customer Group Code (Editable)

Note: You can use the same code as above if you have want to include the group selector field at registration, checkout & account edit pages.

(This extension comes bundled with Store Restriction Pro & Custom Login Redirect Pro)

Magento 2 installation on MEMP (Mac OS X + Nginx + MySQL + PHP-FPM) stack

September 7, 2015  |  6 Comments  |  by Raj (MagePsycho)  |  Mac OS-X, Magento, Magento 2

Magento is a highly customizable e-commerce platform and content management system that you can use to build online storefronts or web sites for selling merchandise. Magento provides common e-commerce features, such as shopping carts and inventory management, and encourages extensive customization to meet your organization’s specific goals.

Magento 2 Merchant Beta codebase was released on July 15, 2015. This is a significant milestone before the general availability of Magento 2 in Q4 2015.

Before you begin installation

1. MEMP(Mac OS X + Nginx + MySQL + PHP-FPM) stack should already be installed & configured in your system. And system should meet the requirements discussed in Magento system requirements.

If MEMP stack is not installed, I would recommend homebrew package manager for installation.
2. Some Assumptions
Magento Dir: ~/Sites/opensource/magento/magento2beta
Virtual Host: magento2beta.dev

Once your MEMP system is ready meeting all the requirements, you are ready to move ahead for the installation.

Installation Steps

1. Create the project folder & clone the magento2 codebase

mkdir ~/Sites/opensource/magento/magento2beta && cd ~/Sites/opensource/magento/magento2beta
git clone git@github.com:magento/magento2.git .
Git Clone Magento2

Git Clone Magento2

2. Checkout to master branch

git checkout master

OR you can directly use the following command while cloning:

git clone -b master https://github.com/magento/magento2.git
Git Checkout Master Branch

Git Checkout Master Branch

Note:
You can clone either the master or develop branch:
– master is more stable
– develop is more recent

Initially we had an issue installating the sample data with develop branch, which resulted in the following error:

Fatal error: Call to undefined method Magento\Catalog\Model\Resource\Product\Interceptor::getWriteConnection() in app/code/Magento/SampleData/Module/Catalog/Setup/Product/Gallery.php on line 144

Sample data installation error in Magento 2

Sample data installation error

Due to recent changes, you can now use sample data with either the develop branch (more current) or the master branch.

3. File permission

chmod -R 755 ./

4. Update Magento dependencies using Composer
Install Composer if it’s not already installed:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Now run Composer to update dependencies:

composer install

This command updates package dependencies and can take a few minutes to complete.

Update Magento dependencies using Composer

Update Magento dependencies using Composer

5. Install sample data before Magento installation

– Edit composer.son:
In the first section, add “minimum-stability”: “beta”, before license.

then run the following commands:

composer config repositories.magento composer http://packages.magento.com
composer require magento/sample-data:1.0.0-beta

Sample Data Installation

Sample Data Installation Result


Note: You can also install sample data after Magento installaiton

[EDIT]
Magento 2 dev team has an updated version on how to install sample data:
http://devdocs.magento.com/guides/v2.0/install-gde/install/web/install-web-sample-data.html

6: Finally install Magento System
Run following command in order to install the Magento system:

php bin/magento setup:install --base-url=http://magento2beta.dev/ \
--db-host=localhost \
--db-name=magento2beta \
--db-user=root \
--db-password=root \
--admin-firstname=Raj \
--admin-lastname=KB \
--admin-email=myemail@gmail.com \
--admin-user=admin \
--admin-password=pass123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--sales-order-increment-prefix="ORD$" \
--session-save=db \
--use-rewrites=1 \
--use-sample-data \
--cleanup-database

To find more information on command options, please check the following url:
http://devdocs.magento.com/guides/v2.0/install-gde/install/cli/install-cli-install.html#instgde-install-cli-magento

Magento 2 - CLI Installation

Magento 2 – CLI Installation

Magento 2 - Installation Complete!

Magento 2 – Installation Complete!

7: Installation Complete!
Now you can explore the frontend and backend.
Some Screenshots:

Magento 2 - Homepage

Magento 2 – Homepage

Magento 2 - Category Page

Magento 2 – Category Page

Magento 2 - Product Page

Magento 2 – Product Page

Magento 2 - Cart Page

Magento 2 – Cart Page

Magento 2 - Checkout Page

Magento 2 – Checkout Page

Magento 2 - Admin Dashboard

Magento 2 – Admin Dashboard

Have fun with Magento 2!