How Can We Help?
< Back
You are here:
Print

Upgrading Add to Cart Pro from 1.0 or 1.1 to 1.2

It is no secret this is an existing project taking on a new name.

During this expansion, we made a mistake that caused updates to be broken. You can either download the newest version to get the fix in your account or you can follow the guide below to reactivate automatic updates from your existing plugin:

Modifying the plugin on your site

<?php

/**
 * The admin-specific functionality of the plugin.
 *
 * @link       www.theritesites.com
 * @since      1.0.0
 *
 * @package    Add_To_Cart_Pro
 * @subpackage Add_To_Cart_Pro/admin
 * @author     TheRiteSites <contact@theritesites.com>
 */

namespace TRS\A2CP;

use TRS\A2CP\Single;
use TRS\A2CP\Group;

class Admin {
        .
        .
        .

	public function register_scripts() {
                .
                .
                .
	// This line, 75, needs to be changed
		wp_localize_script( 'a2cp-settings', 'A2CPSETTINGS', array( 
	// This next line is the replacement needed.
		wp_localize_script( 'a2cp-settings', 'EAA2CSETTINGS', array(

		.

	}

The register scripts function should look like this when you are done:

	public function register_scripts() {
		$plugin = defined( 'A2CP_NAME' ) ? A2CP_NAME : '';
		$index_js = 'a2cp-settings.js';
		$js_file =  plugin_dir_url( __DIR__ ) . 'assets/js/a2cp-settings.js';

		$path = realpath( dirname( __DIR__ ) ) . '/dist/request/';
		if ( file_exists( $path . $index_js ) && ! ( A2CP_DEBUG || WP_DEBUG ) ) {
			$dir = plugin_dir_path( dirname( __FILE__ ) ) . 'dist/request/';
			$js_file =  plugins_url( $index_js, $dir .'request/' );
		}
		wp_register_script( 'a2cp-settings',
			$js_file,
			array(),
			filemtime( realpath("$js_file") )
		);
		wp_localize_script( 'a2cp-settings', 'EAA2CSETTINGS', array(
			'ajax_url'	=> admin_url( 'admin-ajax.php' ),
			'db_key' => get_option( A2CP_LICENSE_KEY ),
			'debug' => get_option( 'a2cp_debug' ),
			'nonce' => wp_create_nonce( 'a2cp_nonce' ),
		));
	}

Now you should be able to continue with automatic updates as usual!

If there are any questions that remain, please contact us!

Table of Contents