YML Dump WordPress + Woocommerce on-line shop content

Describing plugin BG_YML_DUMP to YML Dump WordPress + Woocommerce on-line shop content. YML (Yandex Markup Language) is ridigly formalized by Yandex XML subset. It’s utilized to dump online shop content (categories and products) and load it to Yandex Market and some other partner program. То же самое по-русски

During dump process:

  • header is created with online shop name, company name, web-design agency name, web-designer email address, which are taken from plugin settings;
  • currency section is created. The main currency will be taken from Woocommerce settings and it’s rate is 1. If online shop works for different countries, those countries currencies will be included to this section and rates will be according Central (National) bank of the country, issues main currency;
  • cathegory section is created. If a category is a child one, the parent category will be included;
  • all products is dumped;
  • one can include to the dump only some of product categories or exclude some of them.

Dump is made as scheduled task one a day. File is created on server under WordPress folder tree and has URL http://site_URL/wp-content/uploads/yml/file_name.xml, where file_name is siteURL with dots, replaced by an underscore. For example, the dump file URL for site www.example.com will be http://www.example.com/wp-content/uploads/yml/www_example_com.xml.

If someone needs to get online shop content dump in real time (immediatelly), shortcode [bg-wc-uml-dump] can be placed on any site page. Of cource, it’s better to use specially created page. The dump will be made any time those page is rendered in browser.

Plugin Installation

You have to get plugin file bg_yml_dump.zip here, contains folder /bg_ymp_dump with plugin, readme, licence files and /languages folder with bg_ymp_dump.pot file to translate messages. Russian translation is also included.

Upload the /bg_ymp_dump folder to your /wp-content/plugins/ directory.
Activate the plugin through the Plugins menu in WordPress® (on-line shop site in case of WordPress Multisite).

YML Dump shop content

You have to prepare following information:

  1. On-line shop short name
  2. Owner on-line shop company name.
  3. WEB-design agency or WEB-master name.
  4. WEB-designer email address.
  5. Products vendor name.
  6. If You want to dump in tag typePrefix only the product category or all it’s parents also.
  7. If You want to dump only some product categories or exclude some of them, You need a list of this categories.
  8. If You want to limit max. number of images URL per product, You need this number.

Navigate to the «Settings»->»ProductYML Dump» Options panel for configuration details. On the tab “General Options” You have to fill all fields by prepared information and click button «Save Changes» (Fig. 1.).

YML Dump. Fig. 1. BG_YML_DUMP Plugin settings (Tab 1)

Fig. 1. BG_YML_DUMP Plugin settings (Tab 1)

On the second tab “Restrictions” You can enter product category restrictions during dump and/or max. number of images URL per product (Fig. 2.) and click button «Save Changes».

YML Dump. Fig. 2. BG_YML_DUMP Plugin settings (Tab 2)

Fig. 2. BG_YML_DUMP Plugin settings (Tab 2)

If You got some problems, You can use the “Help” tab (Fig. 3.) which can be opened clicking “Help” button in the up-right corner of the screen.

YML Dump. Fig. 3. BG_YML_DUMP Plugin settings (Help)

Fig. 3. BG_YML_DUMP Plugin settings (Help)

That’s it. You will get your on-line shop content dump every night.

Some Changes in YML Dump file

Only if You understand what You are doing! I recommend to test all changes in the test site first and only then to move to the working site had made backup before.

1. Brand name

It’s possible to print brand name it tag <vendor></vendor> for multibrand online shop. It’s necessary to create Attribute with any name and slug “brand“. All brand names should be values for this attribute.

VERY IMPORTANT! When You create product do not click “Used for variations” checkbox for this Attribute.

2. Change YML file placement

To change YML file position one have to create filter in the child theme functions.php file. This filter should change folder address where YML file will be created:

if ( function_exists('bg_yml_dump')) {
    add_filter('bg_yml_dir_name', 'my_dir_name');
    function my_dir_name($dir_name) {
        // Here all staff to change dump directory beginning with $dir_name =
        return $dir_name;
    }
}

3. Change category name in tag <typePrefix>…</typePrefix>

Plugin prints product category name in tag <typePrefix>…</typePrefix>. In order to change contents of this tag, one have to create a filter in the child theme functions.php file. This filter should create desired contents for this tag:

if ( function_exists('bg_yml_dump')) {
    add_filter('bg_yml_type_prefix', 'my_type_prefix');
    function my_type_prefix($type_prefix) {
        // Here all staff
        return $type_prefix;
    }
}

4. Adding some extra information in the YML product description

Some online shops use third party plugins to add an extra information to their product descriptions. To add product YMP dump with any non standard information for woocommerce, it’s necessary to create a filter in the child theme functions.php file. This filter should looks like:

if ( function_exists('bg_yml_dump')) {
    add_filter('bg_yml_extra_tags', 'my_extra_tags', 10, 2);
    function my_extra_tags($product_extra_tags, $product) {
        // Here all staff
        return $product_extra_tags;
    }
}

As the filter result, the variable $product_extra_tags should contain lines like

<tag1>Contents tag1</tag1>"\n"

 where tag1 is a valid YML tag.

Described plugin BG_YML_DUMP to YML Dump WordPress + Woocommerce on-line shop content

, ,

No comments yet.

Leave a Reply