• Resolved Amine

    (@ablamohamedamine)


    Hello;

    I’m using the OCDI plugin to import demo for my theme that I developed, but I’m facing 2 issues:

    1-When I import demo the first time, some menus and widgets doesn’t appear till I import the demo for the second time.

    2-The pages are well imported, but they are not linked on advanced section of WooCommerce, I mean the cart page is imported but when I go to advanced section in WooCommerce, I find that the cart page is not mentionned there.

    How can I fixe this 2 issues, please?

    Regards.

    Amine.

    • This topic was modified 12 months ago by Amine.
Viewing 15 replies - 1 through 15 (of 31 total)
  • Plugin Support David

    (@dpinson)

    Hi there @ablamohamedamine,

    Thanks for reaching out. I wonder if your server may be terminating the process early. When you get a moment, try running an import while the WordPress debug feature is turned on. That way we can find out if you might be running into any errors when the plugin runs.

    Check out this guide on our site. It goes over some of the issues you might encounter. It also provides some recommended settings for things like max_input_time and max_execution_time.

    As for the WooCommerce issue, the pages are imported but we don’t automatically assign them in your WooCommerce settings. To do that, you would need to write a custom function to update the settings after the import runs.

    Check out our advanced integration guide here. It provides information on the after_import function and how you can use it to run custom PHP after the importer runs. You could use it to to find your WooCommerce pages and then update the options with the correction IDs.

    Check out this snippet for a better idea of what I mean. We haven’t tested it, but it should help get you pointed in the right direction:

    function my_custom_ocdi_after_import_setup() {
    $pages = get_pages();
    foreach ($pages as $page) {
    switch ($page->post_title) {
    case 'Cart':
    update_option('woocommerce_cart_page_id', $page->ID);
    break;
    case 'Checkout':
    update_option('woocommerce_checkout_page_id', $page->ID);
    break;
    case 'My Account':
    update_option('woocommerce_myaccount_page_id', $page->ID);
    break;
    case 'Terms and Conditions':
    update_option('woocommerce_terms_page_id', $page->ID);
    break;
    }
    }
    }
    add_action( 'ocdi/after_import', 'my_custom_ocdi_after_import_setup' );

    I hope that helps! Have a great day!

    Thread Starter Amine

    (@ablamohamedamine)

    Dear @dpinson ; thanks a lot for your answers an efforts.

    I’ll try why you suggest for me and come back to you as soon as possible.

    Regards.

    Amine.

    Thread Starter Amine

    (@ablamohamedamine)

    Hi again @dpinson ;

    1-I make sure that the recomendation is good in my host and I activate the debug, any issue was displayed, I always should upload the demo twice.

    2-It works thank you, but “My Account” page get the ID of an other page, I don’t know why.

    Anyway here’s the file’s code to check it if you can:

     function dziridemo_ocdi_plugin_notice() {

        $installed_plugins = get_plugins();

        if ( !isset( $installed_plugins['one-click-demo-import/one-click-demo-import.php'] ) ) {

            $install_url = wp_nonce_url(

                self_admin_url( 'update.php?action=install-plugin&plugin=one-click-demo-import/one-click-demo-import.php' ),

                'install-plugin_one-click-demo-import/one-click-demo-import.php/one-click-demo-import.php');

            ?>

                <div class="notice error is-dismissible">

                    <p><?php echo __( 'The plugin <strong> Dziri Demo </strong> require One Click Demo Import' ); ?></p>

                    <p><a href="<?php echo esc_url( $install_url ); ?>" class="button-primary"><?php echo __( 'Install One Click Demo Import' ); ?></a></p>

                </div>

            <?php

        }

        else if ( ! is_plugin_active( 'one-click-demo-import/one-click-demo-import.php' ) ) {

            $activate_url = wp_nonce_url(

                self_admin_url( 'plugins.php?action=activate&plugin=one-click-demo-import/one-click-demo-import.php' ),

                'activate-plugin_one-click-demo-import/one-click-demo-import.php');

            ?>

                <div class="notice notice-warning is-dismissible">

                    <p><?php echo __( 'One Click Demo Import is installed but not activated. Please activate One Click Demo Import to use th plugin <strong> Dziri Demo </strong>' ); ?></p>

                    <p><a href="<?php echo esc_url( $activate_url ); ?>" class="button-primary"><?php echo __( 'Activate One Click Demo Import' ); ?></a></p>

                </div>

            <?php

        }

    }

    add_action( 'admin_notices', 'dziridemo_ocdi_plugin_notice' );

    // One Click Demo Import Plugins

    function dziridemo_register_required_plugins( $plugins ) {

        $theme_plugins = [

            [ // WooCommerce

                'name'     => 'WooCommerce',

                'slug'     => 'woocommerce',

                'required' => true

            ],

            [ // Contact Form 7

                'name'     => 'Contact Form 7',

                'slug'     => 'contact-form-7',

                'required' => true

            ],

        ];

        return array_merge( $plugins, $theme_plugins );

    }

    add_filter( 'ocdi/register_plugins', 'dziridemo_register_required_plugins' );

    // Remove Pages

    function dziridemo_remove_pages( $selected_import ) {

        $pages = get_posts( array(

            'post_type' => 'page',

            'numberposts' => -1,

            'post_status' => 'any'

        ));

        foreach ($pages as $page) {

            wp_delete_post($page->ID, true);

        }

    }

    add_action( 'ocdi/before_content_import', 'dziridemo_remove_pages' );

    // Remove Sidebares Content

    function dziridemo_before_widgets_import( $selected_import ) {

        $sidebars_widgets = get_option('sidebars_widgets');

        foreach ($sidebars_widgets as $sidebar_id => $widgets) {

            if ($sidebar_id != 'wp_inactive_widgets') {

                $sidebars_widgets[$sidebar_id] = array();

            }

        }

        update_option('sidebars_widgets', $sidebars_widgets);

    }

    add_action( 'ocdi/before_widgets_import', 'dziridemo_before_widgets_import' );

    function dziridemo_import_demo() {

        return [

            [

                'import_file_name'           => 'Dziri Demo',

                'import_file_url'            => plugin_dir_url(__FILE__) . '/demo/dziri.WordPress.xml',

                'import_widget_file_url'     => plugin_dir_url(__FILE__) . '/demo/dziri.widgets.wie',

                'import_customizer_file_url' => plugin_dir_url(__FILE__) . '/demo/dziri-export.dat',

                'import_preview_image_url'   => plugin_dir_url(__FILE__) . '/demo/dziri-screenshot.png',

                'preview_url'                => 'https://dziri.teamine.agency/',

            ],

        ];

    }

    add_filter( 'ocdi/import_files', 'dziridemo_import_demo' );

    // One Click Demo Import Settings

    function dziridemo_after_import_setup() {

        $main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );

        set_theme_mod( 'nav_menu_locations', array(

                'header-menu' => $main_menu->term_id,

            )

        );

        update_option( 'show_on_front', 'page' );

        $pages = get_pages();

        foreach ($pages as $page) {

            switch ($page->post_title) {

                case 'Home':

                    update_option('page_on_front', $page->ID);

                    break;

                case 'Blog':

                    update_option('page_for_posts', $page->ID);

                    break;

                case 'Cart':

                    update_option('woocommerce_cart_page_id', $page->ID);

                    break;

                case 'Checkout':

                    update_option('woocommerce_checkout_page_id', $page->ID);

                    break;

                case 'My Account':

                    update_option('woocommerce_myaccount_page_id', $page->ID);

                    break;

                case 'Terms and Conditions':

                    update_option('woocommerce_terms_page_id', $page->ID);

                    break;

            }

        }

    }

    add_action( 'ocdi/after_import', 'dziridemo_after_import_setup' );

    Plugin Support David

    (@dpinson)

    Hi there @ablamohamedamine,

    Can you share the import files with us? This way we can take a look at them to help get this sorted out. You can reach out to us using the WP Mail SMTP contact form here to send them over: https://wpmailsmtp.com/contact/

    Regarding the issue where the My Account page is getting the wrong idea, you may need to try switching out the method of detection from post_title to post_name. Here is an example of what I mean:

    // .... 
    $pages = get_pages();

    foreach ( $pages as $page ) {
    switch( $page->post_name ) {
    // ....
    case 'my-account': update_option('woocommerce_myaccount_page_id', $page->ID);
    break;
    // ....
    }
    }

    I hope that helps! Have a great day!

    Thread Starter Amine

    (@ablamohamedamine)

    Hi @dpinson ; really happy for your answers and help; thnak you.

    I sent and email where I sent the whole theme and plugin’s files.

    For My Account page, it works now with the new editing ! 😀

    Regards.

    Amine.

    Thread Starter Amine

    (@ablamohamedamine)

    BTW I add this code update_option(‘woocommerce_shop_page_id’, $page->ID) for the case “shop” but it doesn’t works, you can check it on teh sended mail.

    Regards.

    Amine.

    Thread Starter Amine

    (@ablamohamedamine)

    Hi @dpinson ;

    I found an other issue, when I import data in sencod languages other than english, the pictures are not uploaded.

    Regards.

    Amine.

    Plugin Support David

    (@dpinson)

    Hi there @ablamohamedamine,

    Thanks for the responses and feedback. Our development team took a look and tried to replicate the issue. They were able to run the import without any issues. They suggested that your need to run the import twice might have something to do with the hosting environment, such as a caching mechanism that’s interfering. Try using the import again, and then wait for a few minutes or try editing a post. That may flush any caching that’s in place.

    Regarding the My Account page, that also worked for us. We looked at the xml file and it’s importing well when we test. Try re-exporting your file and then double check the xml file that is being shipped. Something may be off.

    Regarding the language issue, we’re checking into that on our side. If you can let us know which other languages you’re trying, we can check to see if it may be specific to the language being used.

    I hope that helps! Have a great day!

    Thread Starter Amine

    (@ablamohamedamine)

    Hello @dpinson ; Thank you very very much for your help, effort and time.

    -For the My Account page it works, the issue now is with the shop page.

    -I tried to upload the content for thye Arabic language.

    Regards.

    Amine.

    Plugin Support Darshana

    (@darshanaw)

    Hi @ablamohamedamine,

    Thank you for your patience.

    I’m checking this thread while David is away. I checked with one of our developers, and it was confirmed that the Shop page is imported as intended, based on the .xml file.

    Regarding the images, it seems that they are not being imported because the URLs in the xml file are not correct.

    We suggest creating a fresh XML file for your demo data and trying the import again.

    Thanks again for your understanding and cooperation.

    Plugin Support Darshana

    (@darshanaw)

    Hi @ablamohamedamine,

    We haven’t heard from you in a while, so I’m going to go ahead and close out this thread for now. If you’re still having trouble, feel free to respond here at your convenience and we’ll be happy to help.

    Have a great day!

    Thread Starter Amine

    (@ablamohamedamine)

    Hi @darshanaw ; sorry for my late answer, I was busy and have some issues on my host.

    I update the plugin’s files (Customizer, Widget and Content), I got this 3 issues:

    -The shop page is not displayed till I access to modify page.

    -The shop/categories sidebar widgets had a mixed order.

    -The images add on customizer are not displayed.

    Where can I end the new plugin updates?

    Regards.

    Amine.

    • This reply was modified 10 months, 1 week ago by Amine.
    Plugin Support Darshana

    (@darshanaw)

    Hi @ablamohamedamine,

    Thank you for getting in touch! I have shared your feedback with one of our developers, and I will update you once I receive more information from them.

    Thank you!

    Plugin Support Darshana

    (@darshanaw)

    Hi @ablamohamedamine,

    I appreicate your patience! Our developers have requested a copy of the updated import files (.xml) so they can test it on their end. This will help us assist you further.

    Thanks, and please let me know if you have any questions!

    Thread Starter Amine

    (@ablamohamedamine)

    Hi @darshanaw ; thanks for your help.

    The plugin is approuved on wordpress.org, I’ll upload it and share the link with you.

    Regards.

    Amine.

Viewing 15 replies - 1 through 15 (of 31 total)

You must be logged in to reply to this topic.