Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Might I suggest that Ecwid Plugin be given a couple of updates to satisfy those like @ext237 and myself, who are used to really customizing a lot of customer sites?

    • An admin panel area with custom CSS references for various parts of the Ecwid presentation. This panel could list the various display items by their common descriptive names, then translate those programmatically to whatever class or ID your developers currently use. That would permit customization of the back-end features with far less interruption to front-end customizations.
    • An admin panel area for custom JS, with documented examples of which pieces and parts are acceptable for customization within your framework. Quform provides documentation with sample code snippets, AND a full API reference for similar customizations.
    • Add several action and/or filter hooks to various portions of the output and/or workflow. This would permit customizations at safe and documented points controlled by your developers. Such a filter would allow me to add custom options to various controls (like the Date Picker), without having to pick through your classes with jQuery (or similar framework). Provided with sufficient hooks, we custom developers would have very little need to perform undocumented modifications. Instead, we would follow a model very similar to WooCommerce and their hundreds of third party plugins, and plugins to plugins, and themes.

    Understanding that these suggestions are not overnight remedies, and would require a full regression test prior to deployment; I think they would go a long way toward improving the extensibility and reputation of your plugin. This would make it easier for customizers to promote your plugin, and by extension, all of your services.

    Just a suggestion…

    Thread Starter mvbaxter

    (@mvbaxter)

    Wow, that was fast! Thank you very much.

    Thread Starter mvbaxter

    (@mvbaxter)

    You can download my modified version of this plugin here:
    https://baxterfun.com/uploads/woocommerce-oscommerce-import.zip

    Sorry, but I didn’t put much effort into documenting my changes. You’ll see the code indicated above within the .php file. I also haven’t added the field to indicate where the files are located. I didn’t see myself using this often enough to justify the effort.

    To answer your question regarding where the files to … They go to your configured wp_upload_dir folder, so they blend with your other graphics, just as they would if you manually uploaded them.

    Good luck!

    Thread Starter mvbaxter

    (@mvbaxter)

    Check to see if you have CURL running on your PHP5 server. If so, but still not working, let me know. I can post the entire file via download URL, with instructions on what to look for and what to modify. If not, you’ll know what to ask of your web host. ??

    Thread Starter mvbaxter

    (@mvbaxter)

    Here is what worked for me. Please note that I hard-coded the name of our images folder, rather than taking the time to create an options field where you could indicate the images folder input field [recommended]. You may need to modify that to match yours.

    // new function to validate url for image to import
    function woocommerce_osc_validate_url($url){
    		$ch = curl_init($url);
    		$opts = array(CURLOPT_RETURNTRANSFER => true, // do not output to browser
    			  CURLOPT_URL => $url,            // set URL
    			  CURLOPT_NOBODY => true, 		  // do a HEAD request only
    			  CURLOPT_TIMEOUT => 5);   // set timeout
    		curl_setopt_array($ch, $opts); 
    
    		$retval = curl_exec($ch); // do it!
    		if ($retval !== FALSE){
    			$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    			$retval = ($code == 200 ? TRUE : FALSE); // check if HTTP OK
    			curl_close($ch); // close handle
    		} // END IF
    		return $retval;
    	}
    // modified the import_image function to use the CURL validator above
    function woocommerce_osc_import_image($url){
    		$attach_id = 0;
    		$wp_upload_dir = wp_upload_dir();
    
    		$filename = $wp_upload_dir['path'].'/'.basename($url);
    
    		if(file_exists($filename)) $url = $filename;
    // checking two folders because some fool stuffed some of our images in each
                   // first look in default /img/ folder.
    		$enc_url = rtrim($_POST['store_url'],'/').'/img/'.rawurlencode(basename($url));
                  // if not found, look in /images/ folder
    		if (woocommerce_osc_validate_url($enc_url)===FALSE)
    			$enc_url = rtrim($_POST['store_url'],'/').'/images/'.rawurlencode(basename($url));
    
                   // using CURL again, to copy file, for efficiency and to detect success/failure
    		$fp = fopen($filename,'w');
    		$ch = curl_init($enc_url);
    		curl_setopt($ch, CURLOPT_FILE, $fp);
    
    		$data = curl_exec($ch);
    
    		curl_close($ch);
    		fclose($fp);
    
    // only create attachment information if the file copied successfully
    		if ( $data === TRUE){ // the file copied correctly
    			$wp_filetype = wp_check_filetype(basename($filename), null );
    
    			$attachment = array(
    			'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ),
    			'post_mime_type' => $wp_filetype['type'],
    			'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
    			'post_content' => '',
    			'post_status' => 'inherit'
    			);
                            // Not sure why '37' but it is working, so I'll leave it...
    			$attach_id = wp_insert_attachment( $attachment, $filename, 37 );
    			require_once(ABSPATH . 'wp-admin/includes/image.php');
    			$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
    			wp_update_attachment_metadata( $attach_id, $attach_data );
    		}
    		return $attach_id;
    	}

    Hope this helps!

    Thread Starter mvbaxter

    (@mvbaxter)

    Found and fixed my problems.

    1. My client’s Non-std OSC installation had images in a different folder than the importer expected. Edited the importer to correct this.
    2. The importer was importing dummy files with 654k in size, none of which contains anything, because the target URL didn’t point to a real file. Added a cURL function to check for the actual existence of the file in the URL. If it doesn’t existing, nothing is processed.

    If this plugin gets updated, I recommend placing a field where a user could indicate the location of their respective image folders. This would have solved my problem.

    Thread Starter mvbaxter

    (@mvbaxter)

    Added the following code to the listSubscribe() function in CC_SuperClass. This allows me to add to my lists, rather than replacing them:

    // Check if email already exists; update if it does
     if($existingID = self::CC_Contact()->subscriberExists($params['email_address'])) {
    //added next three lines to ensure our new selection adds to our subscribed lists, instead of replacing them...
    	$contactDetails = self::CC_Contact()->getSubscriberDetails($params['email_address']);
    	$contactLists = $contactDetails['lists'];
    	$params["lists"] = array_unique(array_merge($contactLists, $params["lists"]));
    //end of new code
                $contactXML = self::CC_Contact()->createContactXML((string)$existingID,$params);

    Thanks for the suggestions, but I have tried just about every combination I could think of, including a fresh install, with twenty ten and no active plugins. The only consistent issue seems to be wordpress 3.1.1 with a non-firefox browser.

    I have multiple sites. The 3.0 sites don’t have the problem, but the 3.1 sites do. They are on different hosts, and some are upgrades from 3.0 to 3.1, while two others are brand new installations.

    I can modify the widgets, and use drag/drop, in Firefox. I get inconsistent and sometimes strange results from Chrome, IE7 & IE8.

    You might try Firefox until somebody gets around to diagnosing and/or fixing this!

Viewing 9 replies - 1 through 9 (of 9 total)