Drupal Commerce basic settings

Drupal: 
Difficulty level: 
Modules: 

Drupal Commerce certainly raises questions beginners because it is big, and its structure is not easy to learn the first time. One problem - the frequent occurrence of errors. In Commerce mistakes do happen during the setup phase. Therefore, the lesson is dedicated to installation, configuration, line.

This artice translated from russian by Google Translate, bit corrected by tlito.
The material in the process of writing.

Lesson's subject: how to set up a shop Drupal Commerce?
Questions: how to translate the price and order total? Why anonymous users can not place an order? How to change the message of the completion of the order? Where orders are saved? How to add to the cart button without refreshing the page, dynamic?

Let us first consider something without which the store will definitely not work.

Shopping anonymous visitors

It often happens that Vyus goods does not display goods anonymous. This is because they do not have access to view the product in stock. Corrected by adding permission to the Users page - Permit. Check the box for all (perhaps you instead of goods - Product) in the following paragraphs:
View own products of any type
View own Product products
View all Product products

and so for all other product types, if you define the different types of products on Store - Products - Product types.

Making orders anonymous users

If you onen page /cart as anonymous user, and there are no button Checkout, you should give the right to anonymous. Open the page People - Permissions. Activate the checkboxes for anonymous and registered at the rows:
Create customer profiles of any type - Only registered
View own customer profiles of any type - Only registered
Create orders of any type - all
Create Order orders - all

Also other settings as desired:
View own orders of any type - can be given to registered if you want to

Translate Commerce field Price

This is here: Store - Products - Product types - desired type - manage fields. For basic Product type, this page has an address: admin/commerce/products/types/product/fields. There is a field Price. If you click the edit button, Drupal will tell you that the field is protected from changes or can not be changed. This can be easily solved through the database. Open your base in phpMyAdmin, find the table field_config, in her line:
commerce_price commerce_price commerce_price ....
This line has value 1 in the column locked, ie protected. It should be corrected to 0. Then again open the Price field settings and you will be able to correct the name, translating in to your language. Then return to the base 1 in the column locked, just for security.

For multilingual website Price field can be translated in the same way by canceling the database protection from editing and clicking the "translate" while editing this field. And there is another method in Google.

Traslate Order Total on the Cart page

The first method is through a simple database
Open the page order management fields admin/commerce/config/order/fields you will see there is a line Order total. If you change, then Drupal will inform that the field can not be changed, this should lift the ban changes done so. Open your database in phpMyAdmin, find the database table field_config and her string
commerce_order_total commerce_price commerce_price ...
Column locked This line is 1, that is, the field is disabled. Fix to 0. Now you can edit this field admin/commerce/config/order/fields - there click edit Order total opposite and write their name fields, such as Total. Save. And the database again return 1 column locked, just in case that does not break.

The second method, complex, more suitable for multilingual sites
Copied to: http://www.drupal.ru/node/97588
1) short put http://drupal.org/project/i18n includes modules field translate
2) pass admin / config / regional / i18n / strings include english
3) pass admin / config / regional / translate / i18n_string put the check fields click REFRESH
4) translate as obchno admin / config / regional / translate / translate
5) Repeat steps 3

The third way, unreliable (after updating the module again have to do)
Found here: http://rails-dev.ru/blog/perevod-or-i-order-total-v-drupal-commerce
To put the "Order total" open file "sites / all / modules / commerce / modules / price / commerce_price.module", in line 493 change
'title' => check_plain ($ instance ['label']), on the
'title' => check_plain (t ($ instance ['label'])),
Then we translate the string through the usual translation interface.

The fourth way through the theme
Found here: http://dreamr1der.ru/drupal_commerce_1
Add to your topic template.php such code, and then the Configuration - Languages ​​- Translation - get and set the Order total

/**
* Implements hook_themet_commerce_price_formatteed_components().
* Fix Order total for drupal commerce.
*/
function YOUTHEME_commerce_price_formatted_components($vars) {
$vars['components']['commerce_price_formatted_amount']['title'] = t('Order total');
return theme_commerce_price_formatted_components($vars);
}

Translation of the Address field and the country's default setting

These tasks are done simultaneously. In order to allow visitors to leave the shipping information and your address, you must have activated modules Customer, Customer UI. If it is on the page Store is a link Customer profiles - click. Further, in the upper-right corner, click on the tab Profiles types. Then "manage fields" in the default Billing Information profile, click edit at line Address. Correct field name "Address" to your language, choose default country and save.
There are other options, such as access to the country name in one line or full name in the two fields, hidden zip, the explanation for this field.

Currency settings

Install the module Commerce Currency Settings, to customize for each currency number of decimal places, the output style icon and a symbol icon currency exchange (for example, usd or just symbol $). This module is especially important for multi-currency shops.

Adding to cart without reloading the page

To do this, there are two, and maybe more modules, but you need to choose the right: Commerce Fast Ajax Add to Cart - This code adds the dynamic update feature in the basket adding a product (without reloading the page). Although it is not a module, and the project sandbox, it is recommended to put Commerce Fast Ajax Add to Cart, since it does not contaminate the database cache table forms.
If you could not download this module project or your shop is small, and the cache does not matter, then there is Commerce Ajax Cart, but it caches the form and clog base data.

Errors that happen and how to fix them

1. Unknown field in entityfieldquery, the field is broken
EntityFieldQueryException: Unknown field: commerce_product function EntityFieldQuery-> addFieldCondition () (line 770 in the file includes / entity.inc).
Use recovery module broken fields - Commerce Repair. It is activated and adds a link to the page Store - Configuration, ie here admin/commerce/config, this button is Repair Commerce fields. Press, the module will do the restoration, and the error may disappear. Such errors occur for a variety of reasons: the failure database, slow database, do not complete the operation, and you have gone from the page Commerce big, and everywhere the changes on the site are correct.