• Resolved katiev

    (@katiev)


    I switched site from sub-domain (new.littlebachco.com) to main domain and re-directed all images/links etc. The ‘select image field’ on the product page is working fine. However the images shown from the ‘image selected’ summary section on the cart page is still trying to link to the old domain.

    We use the same 5 images throughout lots of different PPOM options set up on the Meta List. Where can I update these 5 images rather than manually editing each PPOM setting. Thanks.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • I had the same problem when doing an import from an export of a different domain with the image dropdown add-on. I thought the image URLs were relative (e.g. /wp-content/uploads/whatever.jpg) instead of absolute (e.g. https://domain/wp-content/uploads/whatever.jpg). That should probably be changed in the future. Hint, hint @nmedia.

    You could do one of the following:
    1. Use your server’s phpMyAdmin tool, select your database and use this SQL code UPDATE {$wpdb->prefix}_nm_personalized SET the_meta = REPLACE(the_meta,'new.littlebachco.com','littlebachco.com') in the SQL console. Be sure to replace {$wpdb->prefix} with whatever your WordPress database prefix is. Most often it is wp.

    2. Add this database call to your theme’s functions.php:
    $wpdb->query("UPDATE {$wpdb->prefix}_nm_personalized SET the_meta = REPLACE(the_meta,'new.littlebachco.com','littlebachco.com')");
    Remove the code after you’ve loaded or refreshed any page on your website. The code only needs to be run once.

    3. Export all PPOM meta groups and do a search and replace of all the old domains to the new domain and then import the modified file to your site. The JSON export is a bit messy though and has a lot of "‘s in it.

    • This reply was modified 5 years, 7 months ago by brozra. Reason: Saw user mentioned going from subdomain to primary domain and changed code accordingly

    Hi,

    Thanks @brozra, ok we will think better on this in future.

    Thread Starter katiev

    (@katiev)

    Thanks @brozra – It appears we are experiencing similar issues as I have just sent a message / reply on a different topic you raised about an error you were having on the woocommerce settings!

    I appreciate your response to this topic. I have a quick question – if I opt for option 2 that you kindly explained (the functions.php one), do I paste the code at the top of the functions document?

    Also, my prefix is ‘wp_’ therefore can you check this is what I would need to paste into the functions file:

    $wpdb->query("UPDATE {$wpdb->wp_}_nm_personalized SET the_meta = REPLACE(the_meta,'new.littlebachco.com','littlebachco.com')");

    And this would replace all instances of ‘new.littlebachco.com’ to the new domain of ‘littlebachco.com’?

    Sorry for the simple questions – I would rather double check then do more damage than it’s worth! Thanks.

    @katiev $wpdb->prefix is an object value string that contains the prefix you assigned to your WordPress database when you first set it up. So in your case, your prefix is just ‘wp’. The code itself will work just fine as is. The suggestion for changing out the $wpdb->prefix was just for using a straight up SQL query within phpMyAdmin.

    You can add the code anywhere in your functions.php file. This is the exact code you need to add to your theme’s functions.php file:

    $wpdb->query("UPDATE {$wpdb->prefix}_nm_personalized SET the_meta = REPLACE(the_meta,'new.littlebachco.com','littlebachco.com')");

    Then just load or refresh any page and the database entries will be updated. Remove the code after loading or refreshing a page. It only needs to be run once.

    NOTE: One other thing to consider is that the PPOM plugin references the ID of the post of the image for the cart / emails so if you uploaded the associated images to the primary domain in a different sequence than the subdomain then the images in the cart and emails probably won’t show. I had to manually replace EVERY image in EVERY PPOM meta group. If you are still having issues after running the above code then that is what you will also have to do.

    Also, for future reference, moving a WordPress installation from one domain to another is best accomplished by doing a search and replace for the old domain to the new domain throughout the entire database and copying the files. There are boundless articles on how to properly move WordPress from one domain to another. This article would be useful in your case:
    https://www.wpbeginner.com/wp-tutorials/how-to-properly-move-wordpress-from-subdomain-to-root-domain/

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Broken Images in Checkout’ is closed to new replies.